0
0
Unityframework~8 mins

Material properties in Unity - Performance & Optimization

Choose your learning style9 modes available
Performance: Material properties
MEDIUM IMPACT
Material properties affect rendering speed and GPU workload by controlling how surfaces look and react to light.
Applying materials to 3D objects in a scene
Unity
Material sharedMat = Resources.Load<Material>("RedMaterial");
// Reuse sharedMat for all objects needing the same look
Reusing shared materials reduces draw calls and GPU state changes.
📈 Performance GainDraw calls reduced drastically, improving frame rate especially with many objects
Applying materials to 3D objects in a scene
Unity
Material mat = new Material(Shader.Find("Standard"));
mat.SetFloat("_Glossiness", 1.0f);
mat.SetColor("_Color", Color.red);
// Applying unique material instance per object
Creating a unique material instance for every object causes many draw calls and high GPU load.
📉 Performance CostIncreases draw calls linearly with object count, causing frame drops on many objects
Performance Comparison
PatternDOM OperationsReflowsPaint CostVerdict
Unique material per objectN/AN/AHigh GPU cost per object[X] Bad
Shared material reusedN/AN/ALower GPU cost, fewer draw calls[OK] Good
Rendering Pipeline
Material properties are processed during the GPU rendering stage, affecting shader execution and pixel output.
Shader Compilation
Fragment Shader Execution
Rasterization
⚠️ BottleneckFragment Shader Execution is most expensive due to complex lighting and texture calculations.
Optimization Tips
1Reuse shared materials to reduce draw calls and GPU workload.
2Avoid creating unique material instances per object unless necessary.
3Simplify material properties to reduce fragment shader complexity.
Performance Quiz - 3 Questions
Test your performance knowledge
What is a main performance cost of using unique material instances per object in Unity?
AIncreased draw calls and GPU workload
BSlower CPU physics calculations
CMore memory used for textures only
DLonger script execution time
DevTools: Unity Profiler
How to check: Open Unity Profiler, select GPU module, run scene and observe draw calls and shader time.
What to look for: High number of draw calls and long fragment shader times indicate material inefficiency.