- Home /
Best Method: Multiple Materials and Texture Objects
In Unity 2017, how would one determine performance for different material/mesh/texture set-ups? Is there a built in tool for this? Is it a pro-only feature?
Which of the following would be more efficient use of CPU/GPU capabilities?:
1) Assume a mesh object has 100 verts. Display 100 mesh-objects, each has a unique material and a unique texture. That's 100 materials and 100 textures over 10,000 verts.
2) Assume a mesh object has 100 verts. Display 100 mesh-objects, each has 5 materials and 5 textures, but many are shared. That's 20 unique materials and 20 unique textures over 10,000 verts.
3) Assume a mesh object has 20 verts. Display 500 mesh objects, each has 1 material and 1 texture, but many are shared. That's 20 unique materials and 20 unique textures over 10,000 verts.
Use the Profiler, you can find it at the top toolbar in Unity under Window -> Profiler. It gives detailed information about CPU, GPU, and RA$$anonymous$$ resource consumption. $$anonymous$$eep in $$anonymous$$d, the profiler only works during play mode, but you can leave play mode, and exa$$anonymous$$e the profiled information, or pause the play mode and exa$$anonymous$$e the information of any given frame.
Answer by NoMoneys · Mar 26, 2018 at 06:20 PM
The performance depends on the amount of vertices, the amount of gameobjects these meshes are distributed over, and the amount of draw calls.
For rendering a gameobject the engine has to issue a draw call to the graphics API, as the number of draw calls increase, performance decreases.
Every unique material uses a draw call aswell, so if you have many different materials, that means that there will be more draw calls. It's the same thing with textures, using just one texture file is far more efficient than many different texture files, which will each require a draw call.
We could say that option 2 is most efficient, as there is the least amount of gameobjects, unique textures, and unique materials.
You can test this out for yourself using the stats in the game window, here you can see the FPS(which is not Always accurate). and the amount of draw calls(batches). If you want to have even more control you should use the profiler, which is more accurate.
This of course, is mostly meaningless with Occlusion culling, leaving the actual problem being the RA$$anonymous$$ consumption and CPU time to build GPU instructions. As well, the textures aren't necessarily as big a problem as the shader passes. A 2k texture takes less GPU time than 3x 512 textures on 3 passes, despite having a much less combined pixel count.
Your answer
Follow this Question
Related Questions
Share material to reduce draw calls 3 Answers
Optimize SketchUp's 3D models for Unity? 2 Answers
Textures/Materials and Cinema4D 1 Answer
Mobile Material Optimization 0 Answers
Number of materials on a model 2 Answers