This GI solution is based on voxel ray tracing and provides the following effects:
- Dynamic indirect light bounce from static and most of dynamic objects.
- Large scale AO and indirect shadows from static geometry (vegetation, brushes and terrain).
- Works without pre-baking and does not require manual setup of many bounce lights or light volumes.
Pic1: Global Illumination examples
How It Works
- First we prepare voxel representation of the scene geometry (at run-time, on CPU, asynchronously and incrementally).
- Every frame on GPU we trace thousands of rays through the voxels (and shadow maps) in order to gather occlusion and indirect lighting.
The performance depends on which GI settings are used. Usually on Xbox One it takes 4-5 ms of GPU time and on a good PC (GTX 780) it takes 2-3 ms (AO + Sun bounce, no point lights, low-spec mode). The fastest configuration is "AO only" mode; this provides large scale AO at a cost of about 2.5 ms on Xbox One.
The Global Illumination settings are located in Tools -> Level Editor -> Level Settings -> Total illumination:
Pic2: Global Illumination settings location
For more information about the Global Illumination parameters in this window, click here.
- Use e_svoDebug = 6 to visualize the voxels. Make sure all important objects in the scene are voxelized otherwise they will cast no occlusion and no secondary shadows. Also make sure all unwanted and unnecessary occluders are excluded from voxelization.
- Use r_ShowRenderTarget svo_fin to show the output of GI system.
Pic3: r_ShowRenderTarget svo_fin
- Use r_profiler 1 or 2 to get GPU profiling information.
- Large scale AO and indirect shadows may be cast properly only by static geometry.
- GI is not working on some forward rendering components like particles or water.
- Some artifacts like ghosting, aliasing, light leaking and noise may be noticeable in some cases.
- Procedural vegetation and merged vegetation do not cast occlusion or secondary shadows.
- If the camera is teleported to a completely new location it may take up to a few seconds until occlusion is working properly.
- Only objects and materials with enabled shadow map casting may produce proper bounced light.
- For dynamic objects indirect light bounce is working only in the areas near voxelized static geometry.
- Bounce light may have a noticeable delay of 1-2 frames.
- r_Supersampling = 2 makes GI look strange but setting lower LowSpecMode (2X lower) pretty much restores the look and speed. Temporal AA (r_AntialiasingMode 2/3) works just fine.
Advanced Experimental Options
By default, the GI system released in 3.8.1 actually only exposes a simplified sub-set of the more advanced GI system, which supports features like multiple bounces and ray traced specular lighting. This advanced system is already in and available, but it is very experimental and is hidden by default. For unlocking advanced settings please enable Edit -> Preferences -> Experimental Features -> Lighting -> Total Illumination and then re-open the Environment settings. The description for advanced parameters can be found in the tooltips and here.
About integration modes
By default in basic mode 0 only opacity is voxelized. This allows very small memory allocations on GPU - about 16 MB. The bounced light is sampled directly from shadow maps (extended to RSM). Compute shaders are not used.
The advantages of mode 0 are:
- Small memory usage
- Completely dynamic indirect lighting (moving sun does not cause any slowdown)
- Dynamic objects can bounce indirect lighting
- Sometimes low quality of indirect lighting (more noise) especially for small point lights
- Only single bounce is possible
- Only diffuse GI is possible (environment probes are supposed to be used for specular)
Integration modes 1-2 use more memory for voxelization (at least 64 MB) - albedo, normals and several layers of radiance are voxelized together with opacity. The lighting gets injected into voxelization, then it may be propagated (within the voxelization) and is then sampled during ray tracing pass.
Below, you can see example of information stored in voxels: albedo colors, direct light injection and light propagation.
Pic4: Albedo colors, direct light injection and light propagation
The advantages of this mode:
- Support for multiple bounces (light source can be marked to be semi-static with multi-bounce support or to be fully dynamic but only with single bounce)
- Support for traced speculars (in mode 2)
- Better quality (smoother) indirect lighting
- Higher memory usage
- Large semi-static multi-bounce lights can not be moved freely (but slowly moving sun may work fine)
- Dynamic objects can not affect GI (but can receive it of course)
If you get the error message "Display driver stopped responding and has recovered", you can use this workaround from Microsoft. This fix is applicable to Windows 10 as well.
Analytical Occluders Prototype
Hand-placed analytical occluders help get sharper and more detailed occlusion in some places where voxel resolution is not enough.
Enable it using the Analytical Occluders checkbox in the Level Settings.
It activates support for hand-placed occlusion shapes and also enables soft indirect shadows from characters. For character setup please see the description of e_svoTI_AnalyticalOccludersBoneNames CVar.
How to Make a New Occluder:
- Create new Geom Entity and set flowing *.cgf as entity geometry:
- GameSDK/objects/default/primitive_sphere.cgf for capsule shapes
- GameSDK/objects/default/primitive_cube.cgf for box shapes
- GameSDK/objects/default/primitive_cylinder.cgf for cylinder shapes
- Add "_TI_AO" to the entity name
- Now you can use non-uniform scaling of entities to produce the shape your want:
- For capsules normally the entity needs to be scaled down in X and Y dimensions for example to 0.1
- Boxes and cylinders produce sharp contact shadows but capsules (on purpose) have no sharp contact shadows
The direction of shadows depends on the average light direction in that location, it is calculated automatically as part of GI calculations. The actual mesh used in the entity is not important - only the CGF name is used to pick one of 3 shapes. Normally mesh can be hidden by setting NoDraw shader in material. The entity can be moved freely (ghosting can be removed completely in future versions).