TheGameCreators / GameGuruRepo

The GameGuru Repository For Community Collaboration
http://www.game-guru.com
137 stars 56 forks source link

GameGuru MAX - Add Parallax Shader #3441

Closed MonkeyFrogStudio closed 1 year ago

MonkeyFrogStudio commented 2 years ago

There's a texture/UV issue with Aztec Column A:

aztec

bond1mjb commented 2 years ago

@MonkeyFrogStudio I can confirm this error also exists in the original licensed file.

@LeeBamberTGC This is not one of my models, it's one of the licensed assets from here: https://www.cgtrader.com/3d-models/architectural/other/low-poly-mayan-inca-aztec-column-modular-pack-mossy-210616

I can't fix this error without breaking the UV mapping, the original author would need to fix the mapping and bake new textures for this asset from his source models.

colAuv

MonkeyFrogStudio commented 2 years ago

@bond1mjb Do you have the model in FBX, OBJ, or GLB format? I might be able to fix it, keeping the UVs intact, allowing you to use the originally baked textures.

bond1mjb commented 2 years ago

@MonkeyFrogStudio Here is the original model from that pack in OBJ format. It might not look perfect, but you could probably at least make the distortion less noticable without needing new textures. Hope this helps:) Column A.zip

MonkeyFrogStudio commented 2 years ago

@bond1mjb Here's the UV corrected column:

Column_A_Fixed.zip

The UVs and texture for that model are pretty messed up, but the distortion is a lot less. A lot of the remaining distortion is in the texture itself. I just fixed the one area that I had pointed out in my first post. ;)

EDIT - Gave it another go. It's virtually impossible to fix due to how the textures were previously baked. But I think this version, with adjusted UVs, is a lot less noticeable.

bond1mjb commented 2 years ago

@MonkeyFrogStudio Yeah there is only so much you can do on a model like this, I'm pretty sure it was decimated directly from the high poly source and textures baked down from that. Your edit makes it less noticeable.

Lee, Rick, or Zak will probably need to add it to the official pack files, I'm not sure who is directly responsible for that task.

earthling45 commented 2 years ago

+13.000 triangles and +40.000 vertices for just this column. How can this be cheaper to render than parallax occlusion? column

MonkeyFrogStudio commented 2 years ago

Because polygons are fairly "cheap" when it comes to game engines these days. ;)

But it is quite high for this type of model. The modeler may have baked it down from a high-poly source, but the overall polygonal construction is pretty poor overall. It would be fairly easy to drastically reduce the poly count while maintaining the same level of quality, to be frank.

earthling45 commented 2 years ago

Baking is baking details of a high poly mesh onto a normal map for a low poly model, isn't it? I think this is a tessellated mesh and with tessellation your going to have these problems if the mesh isn't dense enough. With a high res mesh it is going to look fantastic, most (quixel/substance) materials are presented in such a way, but lower the resolution of the high res mesh and it starts to look really awfull. It is simply not usable in a game and here there is also no question of lod stages either in this pack which if TGC was really serious about optimization would absolutely be a requirement. Polygons are not cheap, such high res models are going to use up much more memory as presented in the short video below. https://www.youtube.com/watch?v=4fH8ToDAcy8&ab_channel=nm-8.com

MonkeyFrogStudio commented 2 years ago

Yes, I was talking about the fact that the modeler first used a higher resolution model to ultimately create this. He did bake the details in to his normal map. He did tesselate the model. I just didn't go into specifics. But I wasn't intending to.

Your video is from 7 years ago. Quite a bit has changed in 7 years in many engines and also PC technology that has made polygons a lot less intensive than they used to be. I didn't say that they were "free", but "cheap". And "cheap" is relative. Please don't take things so literally.

earthling45 commented 2 years ago

Don't take my comments personally :)

I must admit i am a bit annoyed by this because TGC does not want to implement parallax occlusion so that we have the option to use it because of a performance hit in GGM. I think that it should be up to us to judge where and how to use it while maintaining a balance of eye candy and performance of our created game levels. Yet, we see something like the above posted column without any optimization being considered. The video i posted on discord was 2 years old i think and that also showed that tessellation is much heavier than parallax, even though that mesh wasn't so dense as the above column.

MonkeyFrogStudio commented 2 years ago

Completely agree. They don't want to add parallax occlusion or PBR height maps.

LeeBamberTGC commented 2 years ago

Thanks for the fix, I will add to this weeks update. Does anyone want to have a crack at converting this column into a lower polygon column with accompanying height map texture. We can attempt an experiment to compare a hundred of them rendered with parallax against the high poly originals, should be revealing :)

MonkeyFrogStudio commented 2 years ago

@LeeBamberTGC Why use this model and try to reduce it (it's a mess)? Why not have a new model created, one with a height map and another with parallax occlusion for your test?

LeeBamberTGC commented 2 years ago

@MonkeyFrogStudio Only that it was suggested that the column would benefit from being parallax vs pure geometry. Do I misunderstand the request for parallax to improve performance in this specific case?

MonkeyFrogStudio commented 2 years ago

Do I misunderstand the request for parallax to improve performance in this specific case?

Heh, no. I don't think either myself or earthling45 were saying this would be a good case in which to use parallax occlusion mapping. What we were saying is that it's pretty amazing that these very unoptimized columns are okay to use in MAX (even sold as part of a DLC), but something like parallax occlusion is not a consideration at all because it may be heavy on the engine. No one was asking for these columns to use parallax occlusion mapping. The comparison was between a very unoptimized model (lots of polygons in a scene can cause frame drops) being used and that's okay, so why not also have parallax occlusion available so game developers using MAX can choose to use it (or not) where appropriate?

LeeBamberTGC commented 2 years ago

@MonkeyFrogStudio Gotcha, thanks for clarifying. For info, the TGC team did not create the Aztec structures, we worked with a third-party artist who had already created this collection. We had no control over their creation, and they passed our quality and performance tests on min spec. I can find the author's email if you wish to suggest how he can improve his models in the future, or if you know of better model collections out there we can talk to the artists, and we could pull together more optimized DLCs for the future.

MonkeyFrogStudio commented 2 years ago

@LeeBamberTGC You're welcome. bond1mjb had already pointed out that he (and TGC) had not created these models and even had provided a link (see second post) to where they could be purchased/licensed. So, if I had wanted to contact the creator, I am sure I could do it via the link provided, but thanks. The models all look descent enough in MAX. It's only when you open a file, like the OBJ file given to correct the UVs in error, that you see the issues with the actual model. The issues are more than poly-count. Even if polygons are fairly cheap these days, there's rarely a reason for a flat plane to be more than two tri-faces (one quad). A flat floor panel that is 1000 polygons would also pass the specs on a min spec machine. But that doesn't mean a flat floor panel should be made of 1000 polygons, right?

LeeBamberTGC commented 2 years ago

@MonkeyFrogStudio Sure thing, I imagine there are many routes to victory when making better models and I also shudder a little when I see a hundred thousand polygons used to make a brick wall :) I guess I trust the artists to make good decisions when making game-ready assets, which means keeping an eye on polygon and texture budgets. Please do keep feeding back if you see content come through the official DLC channels, as there could be a way to feedback directly to the third-party artists to make some changes while they have focus.

MonkeyFrogStudio commented 2 years ago

@LeeBamberTGC Take a look at Column_A with a standard numbered checker pattern attached:

uvs

When creating UVs for a model, you try to eliminate distortion as much as possible, even on organic models. This is a non-organic form. The UVs should be mostly nice and straight with all squares/numbers the same size and lacking distortion. Yet we see distortion everywhere when this checker texture is applied. In many places the UVs are wavy. Some areas of the UV have numbers/squares that are much larger than others ... and distorted. It's because the 3D modeler mostly unwrapped this as one contiguous piece instead of creating separate UV islands for each side:

uvs2

earthling45 commented 2 years ago

Yes, i think relaxing those uv's wasn't on the map. If you look at the colums flat shaded you'll notice that this isn't just tessellated but patterns crafted with brushes i think. making that into a flat surface is negatively going to affect the lighting in my view. Though i give critique, i could not do this and i think overal it is a nicely crafted pack which the creator of this pack has made. :)

MonkeyFrogStudio commented 2 years ago

Well, since he was baking the textures down anyway, he could have split this into several UV islands (one for each side, at least) and done some work to prevent the UV distortions.

Overall, they look nice in MAX, until you really start to examine them up-close. Then you see the distortions, some texture stretching here and there, etc.

distort

These are just a few areas, all from Column_A (screen shots taken in MAX).

earthling45 commented 2 years ago

@LeeBamberTGC some files to play with. https://drive.google.com/file/d/1Kpm-44rh77pvV0diUQS-MTfFtMKn7BTe/view?usp=sharing

Not the column but two meshes, high and low poly. One tessellated, based on the texture though i kept the poly count lower and thus you will see a poor result. The other a simple plane, and of course the textures including height.

LeeBamberTGC commented 2 years ago

@earthling45 Do you want to see if you can get this model and textures working in the latest Wicked Engine Editor? It will be very revealing to learn if parallax or an equivalent already exists to support the height map.

earthling45 commented 2 years ago

@LeeBamberTGC just had my first experience with Wicked outside of GGM. :)

As i understand there is the option for tessellation where is the distance from the object determines how much tessellation is applied on the model. And as shown in the image below, parallax is also supported.

wicked

I'm actually curious to try out both options with several models, create a scene and see where it goes with performance. Have some learning to do though because although i suceeded in importing and applying the textures, this engine is a great unknown to me. :)

earthling45 commented 2 years ago

No geometry created through the shader so tessellation would require a high res mesh thus a no go.

LeeBamberTGC commented 2 years ago

@earthling45 Great stuff getting the WE editor on your side :) Please let me know how the parallax support looks!

earthling45 commented 2 years ago

@LeeBamberTGC Lee, though i am getting familiar with both parallax and displacement in the latest Wicked editor, one question which is on my mind is how relevant it will be for GGM? As i understand GGM is DX11 and support for DX11 has been dropped last year so shouldn't i be using the last build with DX11?

LeeBamberTGC commented 2 years ago

@earthling45 I look forward to you posting some parallax examples from Wicked :) I think users will want to set specific materials to parallax for their games, even if it is just a wall or floor piece. We are on DX11 right now, at some point we will need to resync with Wicked to the latest version, including a step up to DX12.

earthling45 commented 2 years ago

@LeeBamberTGC a cube with pebbles then. :)

Only normal. normal

With parallax. parallax

looking from an angle. layers

I've tried displacement also and got a very decent result with a prepared mesh and low tessellation factor. cobblepath

The plane is a mesh with 1600 polys, but more than enough to get a decent result. So i've reduced the mesh to 400 polygons and that still gave a very good result in my view. Of course those meshes are going to be triangulated so the count would be 800 triangles and 2400 vertices for that mesh in the middle.

displacement

I might be doing something wrong (i am after all learning as i go) but so far although tessellation occurs as expected on the ico when closing in on the model, displacement is not good. On those two meshes (middle and right side) there is no tessellation occurring when getting close. The simple plane on the left side has a higher tessellation factor and as a result of course tessellation occurs when closing in on the model, but the result is terrible and tessellation very visible.

earthling45 commented 2 years ago

Ok two more images, the material used for the tessellation now also with parallax sc_23-07-2022 01-50-21 sc_23-07-2022 01-51-10

LeeBamberTGC commented 2 years ago

@earthling45 I always had a soft spot for parallax as although it was pixel shader heavy, it did do the job quite well even if it rendered on a flat plane. Back in the old days, tesselation was expensive and hungry, so I am less confident this would be the solution at the same performance cost as a parallax shader. Thanks for your researches into this, and specifically with the Wicked Engine editor, it is really an apples to apples endeavor for when the time comes to support this in MAX :)

MonkeyFrogStudio commented 2 years ago

@LeeBamberTGC Parallax occlusion is pretty awesome, if used appropriately. However, it can be very easy to create strange artifacts, especially when pushing the effect too far (too deep or too high). How much is "too deep/high" can often depend on the material/texture being used, too.

Height/displacement (via tessellation) can also cause artifacts, but they are different kinds of artifacts which can often be less visible than the swirling, other-worldly effect of a parallax occlusion gone bad. ;)

They both have their place and both can overlap in purpose. But both also have some different use-cases. Again, if you need to see an object from a side, like a wall, then you will get much better effects out of tessellation/displacement.

According to one article I was reading, tessellation with displacement normally has about a 15% hit on frame rates. That's a decent hit. But in my interior levels, I am still maintaining about 100FPS. So, a drop to 85FPS in areas that would use tessellation/displacement would not even be noticeable.

Like any other tool, especially tools that can have a decent or heavy cost, they need to be used appropriately by the end-user.

earthling45 commented 2 years ago

@LeeBamberTGC It still seems to be expensive and hungry. :) A mesh must contain enough vertices to start with in order to get a decent result with tessellation. It is the reason why displacement was not good on the ico.

earthling45 commented 2 years ago

So to continue with this, it is obvious that for displacement round shapes are preferable because we get good results with a lower tessellation factor while for bricks it must be set quite high and still we see jagged edges. (see image) spheres

For Parallax i've made a wall part with bevelled edges, something we should be mindful of when modeling because so many models in Gameguru would look much better if corners were rounded.

For both displacement and parallax occlusion new models should be made, we cannot just apply a hight texture on an existing model without remapping and texturing them. And ideally of course enchange the model with bevel where needed. Also a thing to be mindful of is that when texturing a model, that it is done in a way so that either displacement or parallax does not produce unwanted weirdness as is visible in the images below.

example parallax wall1 example wall parallax2

The next challenge is to create a scene in the Wicked editor and learn to avoid those easily made mistakes so that no weirdness occurs when parallax is used. :)

MonkeyFrogStudio commented 2 years ago

Displacement and tessellation is not supposed to create perfect looking surfaces. It's only supposed to approximate things ... enough to provide an illusion or to add to the illusion of "reality". It's okay to not have things "perfect". Like any thing else in game creation, it's a tool. And like any other tool, it has uses where it works best. Tessellation with displacement is great on walls and cobblestone floor, cave walls, etc. It's great for some minor details, too, where you just want a bit more sense of depth than a normal map can provide (especially when seen from a severe angle). Round shapes are not preferable. You can get tessellation and displacement that looks good on flat planes, too ... and just about any shape. But you need to prepare those planes and shapes beforehand. They should not just be a plane made of two tri-faces and then uber-tessellate them just to be displaced. The plane should, at least, have some already made divisions that approximate the texture to some degree. For example, some cuts could be made to approximate the basic brick shapes. Then, when tessellated, you'll get more control - better results with less geometry (less tessellation).

earthling45 commented 2 years ago

Indeed, that is why you see those examples with the prepared meshes, 400 and 1600 polygons. :) The mesh of the sphere i created is already 2800 vertices and quite in line with the texture.

sphere

MonkeyFrogStudio commented 1 year ago

Parallax has been added, so I am closing this one. :)