Game dev
Saved & recent

Shader variants and stripping

Related terms: shader keywords, permutations, build-time stripping

A shader can compile into different versions for different feature combinations, such as normal mapping on or off. Each version is a variant. Three independent on/off features already allow eight combinations; more switches can multiply build time, storage and memory use quickly.

Stripping removes variants the game does not need before they reach the build. Keep combinations that runtime changes or downloaded content may require, even if no starting scene uses them. Stripping reduces the work to compile and store shaders; warming up the remaining variants addresses a different problem, compilation stutter during play.

Further reading
Unity: shader variant stripping
000 001 010 011 100 101 110 111 normal map reflection emission
Three independent switches produce eight combinations. This example build keeps four required variants and strips four unused ones.

View in the full Game dev collection