In this lesson, you will learn how to utilize the Shader Complexity view mode to pinpoint expensive pixel shaders and excessive overdraw that degrade your GPU’s frame rate.
Understanding Shader Complexity
When your GPU renders a frame, the "cost" is determined by two main factors: how many instructions the shader executes per pixel and how many times that pixel is drawn over itself (Overdraw). The Shader Complexity view mode acts as a diagnostic heat map, translating these mathematical costs into a color-coded visual guide in your viewport.
To enable this, navigate to the View Mode menu in the top-left of your viewport (labeled "Lit") and select Optimization > Shader Complexity.
Interpreting the Heat Map
The view mode uses a spectrum to represent the cumulative cost of your materials:
- Green: Indicates efficient, low-cost shaders.
- Red: Indicates high-cost shaders. This usually points to complex mathematical operations within your material graph, such as heavy use of
Power,Sine, orNoisenodes, or excessive texture samples. - White/Bright Pink: Represents extreme overdraw. This is common with transparent materials like particle systems, clouds, or overlapping UI elements. If you see bright colors in an area with many overlapping meshes, your GPU is likely struggling to calculate the final pixel color due to the sheer volume of "layers" it must process.
Practical Application
If you identify a "hot" area in your scene:
- Simplify the Material: Check the material editor for high-cost nodes. Use the
Stat Materialconsole command if you need specific instruction counts for an individual asset. - Reduce Overdraw: If you are dealing with transparent materials, try to optimize your particle density or use
Maskedmaterials instead ofTranslucentwhere possible, as masked materials avoid the depth-sorting and blending costs associated with transparency. - Adjust LODs: Ensure your high-complexity materials are swapped out for simpler versions at a distance using Material LODs.
By regularly checking this mode, you prevent "hidden" performance drains before they become deep-seated bottlenecks in your project.
Key Takeaway: The Shader Complexity view mode is your primary visual tool for identifying expensive pixel processing and overdraw, allowing you to prioritize material optimization based on actual GPU cost rather than guesswork.