
Unreal Engine 5 is the most popular game engine of 2025. Of course, it has flaws, particularly concerning Nanite and Lumen, but the Epic logo is prominent among the most popular titles. Recent hits to feature UE5 include Clair Obscure, Oblivion Remastered, Runescape, Delta Force, Fragpunk, Split Fiction, InZOI, etc. How does Lumen differ from traditional ray-tracing, and how does it work?
Lumen vs. Ray Tracing: What’s the Difference
Lumen replaces the traditional two-step ray tracing pipeline (BVH testing and hit point shading) with faster but less accurate methods: Distance Fields and Surface Cache.
- Distance Fields accelerate ray intersection testing using simpler, more approximate ray marching.
- Surface Cache eliminates expensive shader calculations for every intersection by storing the necessary lighting data for various hit points.
- The process is further optimized by using Screen Tracing for onscreen objects and low-res distance fields for distant geometry.

Screen Tracing
Screen Tracing is the first step in the Lumen pipeline.
- It is conducted against objects in the depth buffer or screen space.
- It is primarily used for object edges, boundaries, and crevices as a higher-quality SSAO replacement.
- Objects missed by screen tracing are served by the distance fields.
Mesh Distance Fields
Mesh Distance Fields are 3D representations of an object (or set of combined objects).

- Each point in an MDF stores the nearest distance to an object surface within the volume.
- This is computed offline and allows skipping the empty space in the MDF when ray marching.
- Ray marching is an optimized form of ray tracing used to calculate diffuse lighting.
- You march along a ray’s path in small steps.
- At each step, the distance to the closest surface is calculated using an MDF.

- Shading is applied if a surface is detected in the ray’s proximity.
- The amount of shading applied depends on the distance to the object.
- Upon intersection, shadow, diffuse, and reflection rays are cast outwards towards light sources or probes.
- MDFs rely on the Surface Cache to determine the lighting at intersection points. Instead of costly shader calculations, it is referenced from the cache (and updated gradually over frames).

Global Distance Fields
Global Distance Fields are abstract volumes obtained by combining all the MDFs in the scene.
- The result is a bare-bones geometrical representation with minimal per-object detail.
- The GDFs are used for large-scale or “global” lighting.
- GDFs are cached and updated only when required.
- Mesh Distance Fields are used for objects near the camera, leaving the rest of the geometry to Global Fields.
- GDFs replace MDFs at medium quality settings.


Global Field Lighting
While the Surface Cache and its cards work well for MDFs, they can’t be used for global distance fields. GDFs are large, merged MDFs, and there’s no way to know which part was intersected by the light ray:
- The cards are merged into a collection of voxels around the camera.
- Each voxel stores lighting as per the directions of its six faces and the neighboring voxels.

Heightfields
Large open worlds are divided into heightfield components that are raymarched in 2D. Upon a hit, the surface cache is referenced to determine the point’s radiance. The surface cache also helps ascertain whether the hit point is transparent (tracing continues) or opaque (tracing ends).

Surface Cache
Surface Cache forms Lumen’s backbone:
- It stores the material and lighting data for various surface points, called cards.
- Upon intersection (using Distance Fields), the lighting at a point is referenced from this cache.
- It is calculated, cached, and updated gradually over frames.

The Surface Cache is updated based on the usage and freshness of the cache pages. Direct and indirect lighting have different update policies, with the former being much faster.

Direct Lighting cache pages are updated by converting them into 8×8 tiles. Using the depth buffer order, every tile accounts for up to 8 lights or more. The shadows are calculated using a mix of shadow maps for onscreen and compacted shadow rays for offscreen texels.

Indirect Lighting is calculated using light probes placed in the scene. The distribution is scant (1 per 4×4 tile). At each texel, data is interpolated from the four closest probes and previous frame data. Multiple bounce indirect lighting is simulated by sampling the current frame’s direct and the last frame’s indirect lighting.

The Final Gather
The Final Gather backs the Surface Cache, accounting for missing lighting data. It is based on the Screen Space Radiance Cache.
- It uses screen probes that are placed on pixels (screen space).
- Screen Space Radiance probes operate at 1/16 the resolution.
- Their results are interpolated spatially and temporally.
- Importance sampling projects the lighting from the previous frame (Screen Radiance Cache) onto the current frame.
- The Cache indexes the direction and the position of each frame’s rays, assisting temporal reprojection.
- When it fails, the World Space Cache is used.

World Radiance Cache
A separate, low-resolution World Radiance Cache is used for distant lighting.
- They are placed in world space and operate at 1/256 the resolution.
- They utilize temporal accumulation with gradual updation.
- The World Space Radiance Cache has higher directional resolution but lower spatial resolution.
- It works well in situations where all of the lighting in a room is coming from a small distant window.
- The Screen Space probe rays are shorter, falling back to the World Space Cache upon misses.

Areas with detailed geometry use a denser probe grid, and ambient occlusion is added to the temporally sampled lighting for a refined result.

Volumetric & Transparency Final Gather
Volumetric effects, including fog and smoke, are calculated using a separate froxel grid covering the viewport frustum:

- It consists of octahedral probes traced to determine the lighting, backed by spatial interpolation.
- The results are integrated with the translucency or volumetric fog pass and temporally accumulated to improve stability.
- Transparency is calculated by placing probes everywhere around the visible froxel grid. These probes are traced, creating radiance mipmaps.
- The Translucency Radiance Cache and the Opaque World Radiance Cache are overlapped to fill the gaps.
Hardware Lumen Ray Tracing
- Like traditional ray tracing algorithms, it replaces the distance fields with BVH, which is rebuilt every frame.
- Polygon intersection testing offers notable quality upgrades over distance fields.
- Instead of pixels, it operates on probes, surface cache texels, and tiles.

- Hardware Lumen works well with skinned meshes (moving objects) and produces more detailed reflections.
- Ray tracing also uses Far-Field traces, which significantly improve distant lighting. It extends the global illumination and reflection coverage to 1 km from the camera.
- HWRT can be paired with the Surface Cache. In this mode, the BVH intersection is carried out as usual, but instead of shading each hit point, the lighting information is derived from the surface cache.
Reflections
By default, Lumen uses the software pipeline to render on- and off-screen reflections. Most of the former are calculated using the Screen Traces. The offscreen reflections are calculated as follows:
- Mesh Distance Fields for nearby surfaces—if the high-quality mode is enabled.
- Global Distance Fields for far-off surfaces, or all surfaces (for medium-quality).
- Upon a hit, the reflections are quickly rendered using the Surface Cache.
- This method often produces noisy, approximate reflections that are prone to artifacting.

The Hardware Ray Tracing pipeline leverages BVH testing for exact hit-point calculation. Upon a hit, the engine:
- Evaluates its material properties (color, roughness, normal).
- Traces additional shadow rays towards light sources to determine direct illumination and shadowing.
- It can be combined with the Surface Cache to reduce shader calculations for better performance.
Virtual Shadow Maps
Virtual Shadow Maps are very high-resolution shadow maps with a virtual resolution of 16k x 16k pixels. They are split into pages of 128×128 that are cached and rendered only when needed for onscreen shadows. Shadow Map Ray Tracing (SMRT) is used to produce soft shadows and contact hardening.

Shadow Map Ray Tracing involves intersection testing against the virtual shadow map instead of actual geometry.
- Shadow rays are cast from the surface towards the light source.
- Along them, numerous samples are projected and tested against the shadow maps to produce soft shadowing and contact hardening.
- The shadow ray distribution is based on the light radius or angle.

Landscape Shadows, cast by directional lights. are rendered using clipmaps. Each clipmap level has its own 16K VSM, but covers twice the area as the previous one. By default:
- The closest, most detailed clipmap covers 64 cm from the camera, while the broadest covers up to 40 km.
- The clipmap resolution at a point depends upon its distance from the camera: the farther, the lower.