Unreal Engine: rendering and shaders¶
Shader and PSO compilation, the shared Derived Data Cache, materials and their permutations, Nanite and Lumen, and quality settings for each platform. The engine-independent rendering rules are in Graphics and GPU rendering. Profiling, memory and asset loading are in Content and performance, and frame budgets are in Game development.
Entries are sorted by score from 1 to 10 (criteria): 9โ10 start here or strongly recommended, 6โ8 recommended, 1โ5 further reading or conditional.
Key rules¶
- 8
UNREAL-17Keep PSO precaching on, hold the first loading screen untilFShaderPipelineCache::NumPrecompilesRemaining()reaches zero, and test first-run smoothness with-clearPSODriverCache. Count the PSOs that precaching missed withr.PSOPrecache.Validation, and add a small bundled PSO cache, one per graphics API you ship, only where precaching leaves hitches. This appliesGFX-5. (Unreal Engine, PSO Precaching, Creating a Bundled PSO Cache) - 7
UNREAL-19Build materials as a few parameterized parent materials, create the variations as Material Instances, and use Material Instance Dynamic only for values that change at run time. A Material Instance changes a material's look without recompiling its shaders. This appliesGFX-6. (Unreal Engine, Material Instances) - 7
UNREAL-20Keep material permutations down: use few static switch parameters and few combinations of them across instances, and keep usage flags to the kinds of mesh a material is really used on, because each combination and each flag compiles more shaders. Use the Material Analyzer to find instances that share the same static overrides and reparent them, and check each platform's shader cost in the Material Editor's Platform Stats. This appliesGFX-6. (Unreal Engine, Material Instances: static parameters, Material Properties: usage flags, Material Analyzer, Material Editor UI) - 7
UNREAL-21Decide for each target platform, before content production starts, whether to use Nanite and Lumen. Both need a Shader Model 6 GPU on PC (DirectX 12, or Vulkan for Nanite) and are designed for current consoles, and Nanite doesn't support forward rendering, VR stereo rendering or MSAA. Where Nanite is supported, Epic recommends enabling it wherever possible. This appliesGFX-1. (Unreal Engine, Nanite Virtualized Geometry, Lumen Global Illumination and Reflections, Hardware and Software Specifications) - 7
UNREAL-22Set rendering quality for each platform and device inConfig/DefaultDeviceProfiles.ini, through the scalability groups (sg.*) and console variables, and test every quality level on low-, mid- and high-spec hardware. Device profiles are Epic's recommended way to handle scalability across mobile devices and across PC quality levels. This appliesGFX-2. (Unreal Engine, Setting Up Device Profiles, Scalability Reference, Scalability and the Developer) - 6
UNREAL-18Give the team a shared Derived Data Cache, so that each shader and other derived asset is built once for everyone: a Zen Storage Server or a network drive for people in one office, and Unreal Cloud DDC for a distributed team. Epic strongly recommends a shared DDC for teams in a common location, and it helps most in projects with many Nanite meshes. (Unreal Engine, Using Derived Data Cache: Shared DDC, Zen Storage Server, How to Set Up Unreal Cloud DDC, Nanite)
How to enforce¶
Tools that check the key rules above automatically, in CI, the IDE or a commit hook. "Partly" means the tool covers only some of what the rule asks.
- 7 PSO precache validation: with
r.PSOPrecache.Validation=2, a build logs every PSO that was needed but not precached, or precached too late, andstat PSOPrecacheshows the counts, so an automated playthrough on test hardware can fail on misses. Partly checksUNREAL-17.