How do you debug a material that is suspected of hurting rendering performance?
After a new wall material was added the frame got heavier. stat unit shows the GPU row is the highest. You open the material's Stats panel and switch to the Shader Complexity viewmode, and read the following:
stat unit: Frame 22.4 Game 8.1 Draw 4.0 GPU 21.8
Material Stats (opaque wall material):
Base pass shader: 412 instructions (typical opaque: 100-200)
Texture samplers: 13 / 16
Shader Complexity viewmode: walls render bright red/pink
Diagnose the cause.
Open the material's stats panel to read instruction and texture-sampler counts, then use the Shader Complexity viewmode to see overdraw and cost on screen. Profile a frame with ProfileGPU to confirm the base pass is the culprit.
- ✗Reading
Shader Complexityas a draw-call count instead of per-pixel shader cost - ✗Ignoring the material stats panel's instruction and sampler counts
- ✗Optimizing a material before
ProfileGPUconfirms the base pass is the bottleneck
- →Why does a translucent material make the
Shader Complexityviewmode read worse? - →How can converting nodes to a static switch reduce a material's runtime instruction count?
Scenario
A level designer reports that after adding a new wall material the frame got noticeably heavier. The material "looks normal," and it is unclear why it is expensive.
Diagnosis
Step 1. Confirm the GPU is the bottleneck. Enter stat unit. If the GPU row is higher than Game and Draw, the frame is GPU-bound and the material is a plausible suspect.
Step 2. Open the material stats. In the material editor, enable the Stats panel. The numbers look alarming:
Base pass shader: 412 instructions ← very high
Texture samplers: 13 / 16 ← near the limit
A typical opaque material runs around 100–200 instructions.
Step 3. Enable the Shader Complexity viewmode. The walls glow red/pink — this is per-pixel shader cost, not a draw-call count. Red means an expensive pixel shader.
Step 4. Profile a frame. The ProfileGPU command (or Unreal Insights) shows BasePass grew by several milliseconds after the material was added.
Cause
The material graph contained many nodes evaluated per pixel: several layered texture samples, expensive math, and panning. That work runs for every shaded pixel, and large walls cover the whole screen.
Fix
- Move constant computations out of the pixel stage into the vertex stage (Customized UVs) or into parameters.
- Replace branches with
Static Switchnodes — unused branches are excluded from the compiled shader. - Reduce the texture sampler count; pack masks into the channels of one texture (packed RGBA).
- Recheck the stats: the goal is to bring the base pass back to ~150 instructions.