- Home /
2 materials/shaders 1 texture?
What would be performance difference here, compared to 1 material/shader and 1 texture? I am talking about 2 meshes.
So:
2 mesh + 2 material(1 per mesh) + 1 texture = ? DrawCalls.
VS
2 mesh + 1 material + 1 texture = ? DrawCalls.
Answer by robertbu · Dec 29, 2013 at 08:20 AM
If both meshes have exactly the same material, and you don't make any changes to that material at runtime, and the number of vertex attributes for the mesh is
http://docs.unity3d.com/Documentation/Manual/DrawCallBatching.html
Note often apps use a texture atlas and change the uv coordinates in the mesh. This allows objects to have the same material (and be batched), but to display 'different' textures.
Would it hurt performance more to swap a texture or a material at runtime? Changing Shader? Thank you
If you swap the texture or the shader, then you get a unique material instance and you break batching. Any change to the material, and you get a new material instance and the objects will no longer batch.
Answer by DiligentGear · Dec 29, 2013 at 08:32 AM
Check the doc here: http://docs.unity3d.com/Documentation/Manual/OptimizingGraphicsPerformance.html
Here's the good answer about reducing draw calls: http://answers.unity3d.com/questions/14578/whats-the-best-way-to-reduce-draw-calls.html