- 07 July 2022
- Aleksander Neyman
Epic Games (famous for its Fortnite video game, among others) has recently released Unreal Engine 5. It has attracted a lot of attention with several impressive demos showcasing the engine’s capabilities, with Matrix Awakens: An Unreal Engine 5 Experience, a standout. The remarkable level of realism it offers has been achieved thanks to new concepts inside the engine, such as the Lumen and Nanite systems and a Virtual Shadow Maps technique.
Lumen solves two challenges to realistically render light in real-time – diffuse light bouncing from surrounding objects (global illumination) and specular (indirect) reflections. Rendering compute-heavy light equations on complex scenes is beyond the capabilities of modern GPUs (even with hardware-accelerated ray tracing). That’s why Lumen introduces clever new techniques (such as Mesh Distance Fields) to precompute data during game design instead of runtime.
There are two types of geometry used in games or films (modern films also use rendering engines) – static (e.g., buildings and roads) and dynamic (e.g., people and animals). The first group doesn’t change frequently (we just view the objects from different perspectives), whereas the latter is animated with every frame. For static objects, Lumen generates Mesh Distance Fields (volumetric textures) to store their distance to the nearest surface. As the relative locations of objects don’t change, MDFs are precomputed, saving runtime computations. MDFs are used for ambient occlusion and shadowing (using software ray tracing) as well as for GPU particle collisions.
Surface Cache is another acceleration structure to store material properties for static meshes in a form of surfaces surrounding objects. Surface Cache is used to look up lighting data at ray hit point instead of calculating it in runtime. It is not precomputed but updated over multiple frames, which reduces the rendering time of a single frame.
The Nanite system is designed to render very detailed, film-quality assets in a game without being limited by the geometry throughput of modern GPUs. Nanite creates a hierarchical representation of meshes (similar concept to texture mipmaps) and chooses a level of detail depending on an object’s distance from the camera. As Nanite works for static meshes only, hierarchical representations are pre-generated during game design.
To render high-quality shadows for the Nanite and Lumen systems, the Virtual Shadow Maps technique was implemented. It supports huge 16K x 16K textures (called clipmaps). Each clipmap represents different distances and granularity of shadows from the camera, ranging from 64cm to 40km. To save on memory bandwidth, shadow maps are split into 128 x 128 pages and are only loaded when needed. They are also cached between frames unless invalidated by moving objects or lights.
UE5 supports multiple other rendering techniques, such as real-time fluids (Niagara), open-world streaming system (World Partition) or Hardware Ray and Path Tracing support (HRT/PT). It comes with documentation and is available for free. Furthermore, it is shipped with City Sample used in the Matrix demo, the Lyra Game Sample, Automotive Configurator Sample and others.
Multiple gaming studios have already announced moving over to the UE5 engine for upcoming titles, including several popular franchises. There’s no doubt that Unreal Engine 5 is going to have a big impact on the gaming industry and to all who are interested in learning how modern 3D games are created, I recommend installing it, exploring its features and having fun!