In this lesson, you will learn how to configure Mesh Distance Field (MDF) settings on individual static meshes to provide the foundational volumetric data required for Lumen’s global illumination and distance-field-based ambient occlusion.
The Role of Mesh Distance Fields
While Lumen relies on surface caches to compute light, it uses Mesh Distance Fields as a simplified, 3D mathematical representation of your geometry to trace rays through the scene. Imagine a complex statue; the renderer doesn't trace rays against its millions of triangles (which would be too expensive), but instead samples a "distance field"—a volume where every point knows the distance to the nearest surface of that statue.
Configuring Your Assets
To generate these fields, you must first enable them in your Project Settings. Once enabled, you configure individual assets via the Static Mesh Editor:
- Generate Mesh Distance Fields: Ensure this is checked in the mesh’s
Build Settings. - Distance Field Resolution Scale: This is your primary lever. A value of
1.0is standard, but you can lower it for small background props to save memory or increase it for large, hero objects that define the lighting in a room. - Two-Sided Distance Field: If your mesh contains single-sided geometry (like thin walls or non-watertight planes), the distance field will fail to "enclose" the volume correctly, causing light leaks. Check this box to tell the engine to treat the mesh as two-sided, effectively thickening the volume for the sake of the ray-tracing algorithm.
Verifying Results
You can visualize the outcome by navigating to the Viewport Menu > Show > Visualize > Mesh Distance Fields. You will see a pinkish-blue volumetric representation of your mesh. If the representation looks jagged or blurry, increment the Distance Field Resolution Scale. Conversely, if your memory budget is tight, look for objects with unnecessarily high scales that don't contribute significantly to the scene's global illumination and dial them back.
Key Takeaway: Mesh Distance Fields are the low-resolution "proxy" volumes that allow Lumen to perform efficient ray-traced lighting calculations; balancing resolution scale per-mesh is essential for maintaining both visual fidelity and performance.