I made more than 10 robots. all of them had not less than 4 materials, and some had 12 materials. I can't go back and fix this. How this will effect on the game performance later ?
-
\$\begingroup\$ Can you clarify why you need that many materials? \$\endgroup\$– SidarCommented Oct 17, 2017 at 19:22
-
\$\begingroup\$ @Sidar, for textures. I'm using Substance Painting and i need to give Evey part it own texture to look good.@DMGregory, thank you for the link. is good but i'm talking here about the performance "frames and graphics". \$\endgroup\$– user43474Commented Oct 17, 2017 at 20:06
-
\$\begingroup\$ I don't know much about subtance painter but if you can't reduce the numbers of materials with this workflow I guess it's just the way it is. Have you considered their forums, is there perhaps a discord you could join ? \$\endgroup\$– SidarCommented Oct 17, 2017 at 20:40
1 Answer
It's most likely that for every material the pipeline needs to change state and validate a lot of stuff. Which means you'd end up with a shaderpass for each material.
Depending on the scope of your game and the target you could get away with it. But if you start noticing performance issues it's best you reduce the number of materials. The fewer the better anyway.
If your materials just hold different textures : put all of those textures into one texture ( you'd have to move uv mapping though ). You could potentially reduce the materials to one this way.
If your materials take on different shaders, see if you can get the same effect with fewer shaders that takes several sampler uniforms to which you can pass different textures.
-
\$\begingroup\$ All what you said is correct. but my question is How. does materials will only effect on frames or graphics ? the game i'm working on for PC only. \$\endgroup\$ Commented Oct 17, 2017 at 20:01
-
1\$\begingroup\$ @user43474 What do you mean frames or graphics? Graphics aren't affected. Performance is. Materials affect how the render pipeline needs to make changes to prepare for the next material. Unity does sort objects by their state/materials. But it does mean for every additional material your computer needs to do additional work when it needs to switch. Desktop CPU/GPU's can easily handle some bulky operations so if it's not a performance problem leave it, but I really recommend reducing the material count. \$\endgroup\$– SidarCommented Oct 17, 2017 at 20:36