Saturday, February 8, 2020

textures - Unity Performance: How many Materials per Object?


I have learned that a Mesh with 4 Materials each 1024x1024 in Size is somewhat slower than a Mesh with 1 Material 2048x2048 in Size? In my usual workflow I tend to seperate different Materials into different Materials so an Object tends to have around 2-8 Materials. I have created more than a hundred Assets like this.


Is the performance dramatically affected by this? Is it acceptable to upload such Objects to sites like turbosquid or sell them on Unity Asset Store or will the buyer behead me after noticing?


enter image description here


Window Textures need to be transparent, Metal / Wood / Concrete need different smoothness settings. As far as I know Unity doesn't support Gloss maps.



Answer



There is roughness setup, so Unity does support it. And it depends on a shader that is written, Unity doesn't have to support anything except shader language (as far as my understanding goes).



Yes, it does have a performance hit. For every new shader, it needs to calculate that shader on GPU. Objects with the same material share the same shader which means some things aren't calculated twice.


Conclusion: it's always better to keep the number of materials & shaders as low as possible if it doesn't change the final look, if it does change it then it's just a matter of what is more important at the project stage - performance or look.


Normally characters in AAA games have from 2 to 3 materials attached. One for skin, one for clothes, one for eyes. Props and other objects usually have 1 material, but some of them might require different shader or setup, so it's possible that they might have some maps or more materials/shaders.


Personally, I would be upset if the asset that I bought required many unnecessary materials. Also, I would think that it is not even unwrapped, so you can't change the texture or delete materials.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...