Mesh Distance Fields Settings Reference

Choose your OS:

The Mesh Distance FieldsNEW! system in Unreal Engine 4 (UE4) can be used with various different systems that can be enabled or disables. These settings and properties can be used to obtain a specific style for your project or simply for optimization purposes.

Below you'll find the details about the available menu systems and settings you can use that are specific to Mesh Distance Fields.

Project Settings

The Project Settings contains the settings available to enable Mesh Distance Field generation for your assets in your project along with some optimization options you can enable to make their use more efficient in some cases.

These settings can be found in the Project Settings > Rendering > Lighting section.

Click image for full size.

Property

spacer.png

Description

Generate Mesh Distance Fields

Whether to build Distance Fields of Static Meshes, which can be used with Distance Field Shadows and Distance Field Ambient Occlusion. Enabling this will increase mesh build times and memory usage and also requires you to restart the editor for it to take effect.

Eight Bit Mesh Distance Fields

Whether to store mesh distance fields in an 8-bit fixed point format instead of a 16-bit floating point. Eight-bit uses half the memory but introduces artifacts for large meshes or thin meshes. Changing this setting requires you to restart the editor.

Generate Landscape Real-time GI Data

Whether to generate a low-resolution base color texture for landscapes for rendering real-time global illumination. Enabling this option will increase mesh build times and memory usage. Changing this setting requires you to restart the editor.

Compress Mesh Distance Fields

Whether to store mesh distance fields compressed in memory, which reduces how much memory they take up, but also causes serious hitches when making new levels visible. It should only be enabled if your project does not stream level in-game. Changing this setting requires you to restart the editor.

Light Components

Below are the available Mesh Distance FieldNEW! settings and properties that can be set for each Light Type available.

Directional Light

Below are the Directional Light settings that affect Ray Traced Distance Field Shadowing .

Distance Field Shadow Settings

Property

spacer.png

Description

Light

Light Source Angle

This is the light source's angle in degrees and is used to support soft area shadows for dynamic shadowing methods using Distance Fields or Capsule Shadows.

Distance Field Shadows

DistanceField Shadow Distance

This is the farthest distance that will have Distance Field Shadowing. Distance Field Shadows will also cover the distance between this value and the Dynamic Shadow Distance Movable Light for CSM shadows.

RayTraced DistanceField Shadows

This will toggle Distance Field Shadows on for the light source.

Advanced Properties

Distance Field Trace Distance

This sets a distance in world units for how far shadows can cast from their shadow caster. When using larger values, you will increase the shadowing cost for the scene.

Ray Start Offset Depth Scale

This controls how large an offset ray traced shadows have from the receiving surface as the camera gets further away. This can be used to hide self-shadowing artifacts from low-resolution distance fields on large Static Meshes.

Cascaded Shadow Maps VS Ray Traced Distance Field Shadows

Cascaded Shadow Maps provide very detailed shadowing but doesn't work well across extended view distances, whereas, Ray Traced Distance Field Shadows can shadow over a much farther distance more efficiently but rely heavily on the resolution of the volume texture generated for the Mesh Distance Field for its quality. Mesh Distance Field quality may require a higher resolution to capture important details that would normally show up with shadow mapping. For this reason, it is recommended to use a combination of Cascaded Shadow Maps for areas close to the camera and Distance Field Shadowing for farther distances.

Cascaded Shadow Maps

Ray Traced Distance Field Shadows

Despite the distance of all points of the lift from the ground, the shadow remains crisp and detailed when using Cascaded Shadow Mapping. Ray Traced Distance Field Shadows allow for softening of the shadow based on the Light Source Radius and the distance of the shadow being cast from the surface to provide a natural look.

Light Source Angle

The Light Source Angle softens or sharpens shadows based on the rotational angle of the light and the value entered. This allows for very soft shadowing to happen for points of the mesh farther away from the shadow receiving surface. Shadows closer to the mesh and the receiving surface will be sharper.

Light Source Angle: | 1 (Default)

Light Source Angle: | 2

The further the shadows stretch away from the mesh or farther that they are from the shadow receiving surface the softer the shadow will become.

Distance Field Trace Distance

The Distance Field Trace Distance controls how far a ray trace for shadowing can extend for any shadow casting mesh. Because shadows can extend along receiving surfaces for very long distances, this can cause shadowing to become more costly for densly populated scenes. Lowering the trace distance limits how far any one point of the distance field shadow can cast from a particular mesh without using a shorter Distance Field Shadow Distance.

Distance Field Trace Distance: | 10000 (Default)

Distance Field Trace Distance: | 5000

This is a very tall tree being lit by a Directional Light with a shallow angle (like at sunrise or sunset). Lowering the trace distance limits the top of the tree from casting indefinitely.

Point/Spot Light

Below are the Point and Spot Light settings that affect Ray Traced Distance Field Shadowing .

PointSpotLight.png

Property

spacer.png

Description

Light

Source Radius

This is used as the size of the light source sphere. When you use larger values, you get a larger penumbra, but it will cost more performance.

Distance Field Shadows

RayTraced DistanceField Shadows

Whether to use ray traced distance field area shadows.

Ray Start Offset Depth Scale

Controls how large of an offset ray traced shadows have from the receiving surface as the camera gets further away. This can be useful to hide self-shadowing artifacts from low-resolution distance fields on large Static Meshes.

Traditional Shadow Maps VS Ray Traced Distance Field Shadows

The shadow maps for Point and Spot Lights is very detailed and sharp, similar to those for Cascaded Shadow Maps for Directional Lights. Ray Traced Distance Field Shadows use the relies heavily on the resolution of the volume texture generated for the Mesh Distance Field for its quality. Mesh Distance Field quality may require a higher resolution to capture important details that would normally show up in a shadow map.

Traditional Shadow Map

Distance Field Shadow

Despite the distance of all points of the lift from the ground, the shadow remains crisp and detailed when using shadow mapping. Distance Field Shadows allow for softening of the shadow based on the Source Radius and the distance of the shadow being cast from the surface to provide a natural look.

Source Radius

The Light's Source Radius is used to soften or sharpen area shadowing by adjusting the size representation of the light source itself. Like the Directional Light's Light Source Angle , the shadows will soften the further the shadowed point is from a receiving surface.

Source Radius: | 0 (Default)

Source Radius: | 50

In this demonstration, the default value of 0 uses a hard-coded Source Radius of 20 to automatically provide soft area shadowing versus a larger light source of 50 which has much softer shadows.

The default Source Radius of 0 has a set hard-coded value of 20. When using a value greater than 0 and less than 20, the area shadows will sharpen accordingly.

Ray Start Offset Depth Scale

The Ray Start Offset Depth Scale controls where the ray starts for ray tracing shadows for a receiving surface as the camera moves farther away. It helps to prevent self-shadowing artifacts that appear from low-resolution Mesh Distance Fields or meshes that have complex geometry that cannot be reasonably captured in a volume texture.

In some cases, adjusting the Mesh Distance Field quality can reduce or remove these artifacts without need to adjust where the ray starts. Keep in mind that you may also not want to pay the higher cost of the generated volume texture that would be required and Ray Start Offset Depth Scale can help curb this for this light.

Ray Start Offset Depth Scale: | 0.003 (Default)

Ray Start Offset Depth Scale: | 0.007

Some self-shadowing artifacts are present in the rock face where it has some crevices and the resolution of the Distance Field doesn't capture that amount of detail. Adjusting the Ray Start Offset Depth Scale a minimal amount will change where the shadow trace should begin by moving it inward.

This setting should only be adjusted with minimal values and can affect shadowing for any mesh casting shadows from a light source where this setting has been adjusted. Be cautious when adjusting this and check different areas of your level when using this, especially for Directional Lights and distance objects where it could have the most impact on visual quality.

Sky Light

Below are the Sky Light settings that affect Distance Field Ambient Occlusion . These settings provide the most artistic control of DFAO in your levels.

SkyLight.png

Property

spacer.png

Description

Occlusion Max Distance

Maximum distance from an occluder to compute occlusion contribution. Raising this value will increase the cost of Distance Field AO, but allow occlusion from further away.

Occlusion Max Contrast

Can be used to raise the contrast of the computed occlusion.

Occlusion Exponent

An exponent applied to AO. Values lower than 1 will brighten the occlusion without losing contact shadows.

Min Occlusion

Useful to prevent the occlusion from going fully black when desired. This is useful to simulate multi-bounce lighting which would have prevented any areas from going fully black in real life.

Occlusion Tint

Constant color used to color the occlusion. This should be black to be physically correct; other values can provide artistic stylization.

Occlusion Combine Mode

This controls how occlusion from Distance Field Ambient Occlusion is combined with Screen Space Ambient Occlusion.

Selection

spacer.png

Description

OCM Minimum

Takes the minimum occlusion value. This is effective for avoiding over-occlusion from multiple methods but can result indoors looking too flat.

OCM Multiply

Multiply together occlusion values from Distance Field Ambient Occlusion and Screen Space Ambient Occlusion. This gives a good sense of depth everywhere but can cause over-occlusion. Screen Space Ambient Occlusion should be tweaked to be less strong compared to Minimum.

Occlusion Max Distance

The Occlusion Max Distance controls the maximum distance between two points where occlusion of one point can affect another. When adjusting the max distance, it's adjusting the accuracy that DFAO will have with other objects in the scene, which means you're increasing the cost of it as well.

Occlusion Max Distance: | 1000 (Default)

Occlusion Max Distance: | 500

Lowering the max distance means that shadowing detail cannot be captured for occlusion since the distance between these points will not cause them to affect the other.

Occlusion Max Distance: | 1000 (Default)

Occlusion Max Distance: | 1500

Increasing the max distance will increase the accuracy of occlusion because more points can be considered for shadowing, but it does come at a higher cost.

Occlusion Max Contrast

The Occlusion Max Contrast controls the difference in brightness between objects affected by DFAO.

Occlusion Max Contrast: | 0 (Default)

Occlusion Max Contrast: | 0.65

Increasing the value for Contrast darkens a lot of the crevices and areas that are heavily occluded in this scene.

Occlusion Exponent

The Occlusion Exponent controls the power of the value being applied to the ambient occlusion. Lower values will brighten up the occlusion shadows without losing the details for any contact shadowing near surfaces.

The Occlusion Exponent uses a default middle-ground value that works well for most scenes. Below are some comparisons of lower and higher range values.

Occlusion Exponent: | 1 (Default)

Occlusion Exponent: | 0.6

Occlusion for the scene becomes lighter anywhere that is shadowed using DFAO.

Occlusion Exponent: | 1 (Default)

Occlusion Exponent: | 1.6

Occlusion for the scene becomes darker anywhere that is shadowed using DFAO.

Min Occlusion

The Min Occlusion controls how dark any fully occluded areas can get in your level. It gives extra control to artists to lighten DFAO in the occluded areas. This setting works well when used with Occlusion Max Contrast where occluded areas can be darkened too much and then use Min Occlusion to lighten the shadowing a bit.

Min Occlusion: | 0 (Default)

Min Occlusion: | 1

Here, Min Occlusion brightens up the DFAO occluded areas of the scene.

Occlusion Tint

The Occlusion Tint affords artists the most control over the look of DFAO by enabling the color for occluded areas to be adjusted.

Occlusion Tint Color: | Black (Default)

Occlusion Tint Color: | Purple

Only occluded areas that are shadowed by DFAO will be tinted based on the color values used.

Occlusion Combine Mode

The Occlusion Combine Mode enables you to choose to combine Screen Space Ambient Occlusion with Distance Field Ambient Occlusion in the scene.

Occlusion Combine Mode: | OCM Minimum

Occlusion Combine Mode: | OCM Multiply

Static Mesh Editor

The Static Mesh Editor houses several actor-specific settings that affect any instance of this Actor placed in your levels. These settings are contained within the Build Settings and the General Settings.

These settings can be found in the Details panel of the Static Mesh Editor.

Click image for full size.

Build Settings

The Build Settings enable you to control the quality of your Mesh Distance Field, enable two-side generation for objects like foliage, and even assign another mesh's Distance Field as the current one.

BuildSettings.png

Property

spacer.png

Description

Distance Field Resolution Scale

Enables you to adjust the quality of this Actor's generated Mesh Distance Field. This setting has an impact on the size of the volume texture that is created.

Two-Sided Distance Field Generation

Enables you to control whether the generated Mesh Distance Field should be twp-sided or not. This allows for soft shadows in instances where there are multiple planes that would overlap but comes at a higher performance cost.

Distance Field Replacement Mesh

Enables you to select another Static Mesh's Distance Field to use in place of the current Actor's own Mesh Distance Field.

General Settings

In the General Settings, you can enable options that are not quality related. It includes the ability to generate a Mesh Distance Field for a particular mesh that does not require them to be enabled for the entire project. You can also control the self-shadowing that can occur with Static Meshes that are animated or moves its vertices inside of the Distance Field.

GeneralSettings.png

Property

spacer.png

Description

Generate Mesh Distance Field

Whether to generate a Distance Field for this mesh, which can be used with Distance Field Indirect ShadowsNEW! . This is ignored if the Project Setting for Generate Mesh Distance Fields is enabled.

Distance Field Self Shadow Bias

Used for reducing self-shadowing from Distance Field methods when using World Position Offset to animate the mesh' vertices.

Actor Components

Below are the available Distance Field settings that can be toggled or overridden for individual Actors placed in your levels.

Actors.png

Property

spacer.png

Description

Distance Field Indirect Shadow

Whether to use the Mesh Distance Field representation (when present) for shadowing indirect lighting (from lightmaps or skylight) on Movable components. This works like Capsule Shadows on Skeletal Meshes, except using the Mesh Distance Field. So no physics asset is required. The Static Mesh must have Generate Mesh Distance Field enabled in the Build Settings or the project my have Generate Mesh Distance Fields enabled for this feature to work.

Distance Field Indirect Shadow Min Visibility

This controls how dark the Distance Field Indirect Shadow can be.

Override Distance Field Self Shadow Bias

Whether to override the Distance Field Self Shadow Bias setting of the Static Mesh Asset with the Distance Field Shadow Bias of this component.

Distance Field Self Shadow Bias

Useful for reducing self-shadowing from Distance Field methods when using World Position Offset to animate the mesh's vertices.

Affect Distance Field Lighting

Controls whether the primitive should affect dynamic Distance Field Lighting methods. This flag also requires that Cast Shadow be enabled.

Distance Field Indirect Shadow Min Visibility

When using Distance Field Indirect ShadowsNEW! , the shadows tone can be adjusted using the Distance Field Indirect Shadow Min Visibility setting. It gives artists the most control over how dark these shadows can ever be, enabling them to be blended with the surrounding static shadowing.

DFISMinVisibilitySetting.png

Min Visibility: 0.1

Min Visibility: 0.6