Defining surface appearance.
WHAT PHYSICALLY BASED MATERIALS USE
Base colour Metallic quality Roughness Normal detail Ambient occlusion
WHY THAT APPROACH DOMINATES
Materials behave consistently under any lighting, rather than being tuned per scene.
WHAT A VERTEX SHADER DOES
Transforms positions, and can deform geometry.
WHAT A FRAGMENT SHADER DOES
Computes the colour of each covered pixel.
WHY FRAGMENT COST MATTERS MOST
It runs per pixel, so a small addition multiplies enormously.
WHAT SHADER COMPLEXITY COSTS
Frame time, particularly at high resolution.
WHAT TO AVOID IN FRAGMENT SHADERS
Branching, where it can be avoided Expensive operations repeated per pixel Many texture reads
WHAT SHADER VARIANTS ARE
Compiled versions for each combination of features.
WHY THEY MATTER
Their count can explode, causing long builds and large files.
WHAT VISUAL SHADER EDITORS PROVIDE
Shader creation without writing code.
WHAT THEY COST
Less control, and sometimes less efficiency.
WHAT TO PROFILE
Shader cost, on the weakest target device.
WHAT TO PREPARE
Simplified variants for lower-end hardware.