Tim Hobson

Distance Field Global illumination

This page covers how to setup and use dynamic Distant Field Global Illumination (DFGI) with Unreal Engine 4. In this example we will add a Console Variable to a ini file and enable Mesh Distance Fields in the Project Settings. Once Mesh Distance Fields have been enabled and generated we will then enable them to be used to provide a dynamic solution for global illumination for any light that has it's mobility set to Movable.

Enabling DFGI in the ConsoleVariable.ini file

To enable this feature, you will need to edit the ConsoleVariables.ini and (re)start the engine.
At the moment, this Console Variable cannot be changed at runtime.
1. Navigate to the folder where your Engine is installed and open the Config folder. ( ie. Epic Games/4.xx/Engine/Config/ )
2.  Open ConsoleVariables.ini file.
​​You may need to make the file writable before you can add any console variables. If so, right-click on the file and uncheck the option for Read-Only to make it writable.
3. Under the section labled [Startup] add this line at the bottom.

When finished your ConsoleVariables.ini file should look similar to this.
4. Now you can Save and close this text file. Once you start your project that has Generate Mesh Distance Fields enabled you will be able to use Distance Field GI.

How to enable distance field global illumination

1. Start by navigating to the Modes panel, then in the Lights" section, click the Sky Light and then drag it into the Viewport.
2. With the Sky Light selected, look at its properties in the Details panel. In the Transform tab set its Mobility to Movable.
3. At this point, Distance Field Global Illumination will be enabled for use with your scene. Use the settings below to adjust and visualize DFGI in your project below.

Types of Distance Field Global illumination

There are two types of dynamic global illumination that is used when you enable Distance Field Global Illumination for your project; Landscape and Static Mesh. By default, both methods are turned on, but either can be used exclusively by itself if needed. Below you will find the details for each method.


​When using Distance Fields Global Illumination with a Landscape this will use a separate representation through heightfields. Landscapes will provide a single bounce, but will not produce any bounce from the static meshes. Below you will see visualization comparisons along with the a comparison view of a scene with Distance Field Global Illumination enabled and disabled.

Landscape Global Illumiantion

To Visualize Distance Field Global Illumination in your scene, go to Show Visualize Distance Field Global Illumination in the main Viewport.
Console Variable Description
r.HeightfieldGlobalIllumination This will enable Distance Field Global Illumination to work with Static Meshes. Default is set to On when DFGI is enabled.
r.GenerateLandscapeGIData Whether to generate a low-resolution base color texture for landscapes for rendering real-time global illumination.
r.HeightfieldInnerBounceDistance This is the distance that bounce will be considered for heightfield GI. The Default is set to 3000.
r.HeightfieldOuterBounceDistance Tint color on occluded areas, artistic control.

Static Mesh

​When using Distance Field Global Illumination with static meshes this method will use Volume Point Lights (VPLs) that are placed to simulate the bounce light. These will provide a single bounce of light for your scene.
​There is known artifacts when using this method, especially with interior scenes. Exterior scenes can be less noticeable.
These are the Console Variables available that you can use specifically for dynamic GI with static meshes.
Console Variable Description
r.VPLMeshGlobalIllumination This will enable Distance Field Global Illumination to work with Static Meshes. Default is set to On when DFGI is enabled.

Visualizing Distance Field Global Illumination

To Visualize Distance Field Global Illumination in your scene, go to Show Visualize Distance Field Global Illumination in the main Viewport.
​For the purposes of these images, the Global Distance Field and smooth Ambient Occlusion methods introduced in 4.9 were disabled using the following console commands.
​  r.AOGlobalDistanceField 0
             r.AOUseSurfaceCache 1

              This will use the adapative sampling method that was used in 4.8 and earlier. If you're having issues, you can use this method to test out the results                   with Static Mesh assets.

Sky Light Properties

Distance Field Global Illumination is tied to the Distance Field Ambient Occlusion system and settings, which means you will need to add a Sky Light actor and then set its Mobility set to Moveable to your scene. By adjusting the property for Occlusion Max Distance this will affect how Global Illumination works as well.
The Directional Light can also provide some boosting to the intensity of the Distance Field GI by using the Indirect Lighting Intensity setting.
​There are a couple of console commands that you can adjust to directly affect how dynamic GI is working in your scene with Distance Fields.
Console Variable Description
r.AOMaxViewDistance This is the maximum view distance that Ambient Occlusion/Global Illumination will be computed at. This distance is limited by the Skylights MaxOcclusionDistance property. Default is set to 10000 units.
r.AOViewFadeDistanceScale This is the distance over which Ambient Occlusion/Global Illumination will fade out as it approaches the AO Max View Distance. Default is set to 0.7.


While dynamic global illumination in Unreal Engine 4 by way of Mesh Distance Fields is a new feature, it is still being developed for improved quality and performance. This how-to and overview of settings will help you get started in using dynamic GI and adjusting its settings in your scenes for the best results.