DistanceField

本文详细介绍如何在Unreal Engine 4中设置和使用Mesh Distance Fields实现动态全局光照(DFGI)。通过调整SkyLight和静态网格体属性,以及使用特定的控制台变量,可以为场景中的可移动光源提供逼真的间接照明效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Distance Field Global illumination

http://timhobsonue4.snappages.com/distance-field-global-illumination

https://docs.unrealengine.com/en-us/Engine/Rendering/LightingAndShadows/DistanceFieldAmbientOcclusion

 

 

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.

r.DistanceFieldGI=1

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.

 

Landscape

​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 VariableDescription
r.HeightfieldGlobalIlluminationThis will enable Distance Field Global Illumination to work with Static Meshes. Default is set to On when DFGI is enabled.
r.GenerateLandscapeGIDataWhether to generate a low-resolution base color texture for landscapes for rendering real-time global illumination.
r.HeightfieldInnerBounceDistanceThis is the distance that bounce will be considered for heightfield GI. The Default is set to 3000.
r.HeightfieldOuterBounceDistanceTint 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 VariableDescription
r.VPLMeshGlobalIlluminationThis 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 VariableDescription
r.AOMaxViewDistanceThis 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.AOViewFadeDistanceScaleThis 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.

 

Conclusion

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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值