Shader Variant (Shader variant) is a technical term that is extremely important in rendering and optimizing game graphics (technical art). Explanation of a large number of internal program branches that are automatically generated for the GPU from a single shader file depending on the combination of enabled/disabled functions (e.g. presence/absence of shadows, presence/absence of fog).

Real-world analogy: It is wasteful to manufacture all the actual attachments (combinations) of a multifunctional all-purpose tool knife in advance

Shader variant is the wasteful work of manufacturing and displaying thousands of Jutoku knives with ``scissors, screwdriver, and can opener'' as separate objects for every combination pattern that may be used (knife with only scissors sticking out, knife with scissors and screwdriver sticking out, etc.).'' Since GPUs are not good at branching on an ad hoc basis during game execution, such as "if shadows are ON, pass through this code," it is necessary to create all actual programs (variants) for all branching patterns in advance and load them into memory. If this number explodes (variant explosion), the display shelf (memory) will be punctured.

Shader Variant concept infographic diagram

Illustration: Shader Variant (Infographic that clearly illustrates the basic processing flow and mechanism of shader variant) in Japanese notation

Detailed mechanism and operating principle

We will dramatically reduce the total number of programs by organizing unnecessary keyword branches (Shader Keywords) and implementing a "Shader Stripping" script that automatically thins out unnecessary variants at build time.