Voxel-Based Global Illumination

Overview

This GI solution is based on voxel ray tracing and provides 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.

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 in-directional lighting.

Note: Current default configuration provides only diffuse GI, for specular we still need light probes. System may be used as AO add-on to light probes or may completely replace diffuse contribution of light probes.

Performance

The performance depends on which GI settings are used. Usually on Xbox One it takes 4-5 ms of GPU time and on 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, it provides large scale AO for the cost of about 2.5 ms on Xbox One.

User Interface

GI settings are located in: RollupBar -> Environment -> Total illumination

Parameter Description

In the editor UI every GI parameter has a tool tip containing a proper description.

Active
Activates voxel GI for the level

Injection multiplier
Modulates light injection (controls the intensity of bounce light)

Sky color multiplier
Controls amount of the sky light
This value may be multiplied with TOD fog color

Use TOD sky color
if non 0 - modulate sky light with TOD fog color (top)
Values between 0 and 1 controls the color saturation

Saturation
Controls color saturation of propagated light

Diffuse bias
Constant ambient value added to GI
Helps preventing completely black areas
If negative - modulate ambient with near range AO (prevents constant ambient in completely occluded indoor areas)

Diffuse cone width
Controls wideness of diffuse cones
Wider cones work faster but may cause over-occlusion and more light leaking
Narrow cones are slower and may bring more noise

Cone max length
Maximum length of the tracing rays (in meters)
Shorter rays work faster

Update geometry
When switched from OFF to ON - forces single complete re-voxelization of the scene
This is needed if terrain, brushes or vegetation were modified

Min node size
Smallest SVO node allowed to create during level voxelization
Smaller values helps getting more detailed lighting but may work slower and use more memory in pool
It may be necessary to increase VoxelPoolResolution in order to prevent running out of voxel pool

Skip non GI lights
Disable all lights except sun and lights marked to be used for GI
This mode ignores all local environment probes and ambient lights

Low spec mode
Set low spec mode
Values greater than 0 simplify shaders and scale down internal render targets
If set to -2 it will be initialized by value specified in sys_spec_Shading.cfg (on level load)

Use light probes
If enabled - environment probes lighting is multiplied with GI
If disabled - diffuse contribution of environment probes is replaced with GI
In modes 1-2 it enables usage of global env probe for sky light instead of TOD fog color

Voxelizaion LOD ratio
Controls distance LOD ratio for voxelization
Bigger value helps getting more detailed lighting at distance but may work slower and will use more memory in pool
It may be necessary to increase VoxelPoolResolution parameter in order to prevent running out of voxel pool

Voxel pool resolution
Size of volume textures (x,y,z dimensions) used for SVO data storage
Valid values are 128 and 256
Engine has to be restarted if this value was modified
Too big pool size may cause long stalls when some GI parameter was changed

SSAO amount
Allows to scale down SSAO (SSDO) amount and radius when GI is active

Objects max view distance
Voxelize only objects with maximum view distance greater than this value (only big and important objects)
If set to 0 - disable this check and also disable skipping of too small triangles
Changes are visible after full re-voxelization (click <Update geometry> or restart)


Tips and other parameters:

  • All mentioned above variables are global for entire level. If you need adjusting indirectional light intensity locally you can use normal ambient lights to modulate or tint it.
  • In material properties there is Voxel Coverage parameter controlling transparency of voxels per material, It allows manually fixing some over-occluded areas.

Debugging

  • 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.

  • Use r_profiler 1 or 2 to get GPU profiling information.

Current Limitations

  • 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 camera was teleported to completely new location it may take up to 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 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. Btw temporal AA (r_AntialiasingMode 2/3) works just fine.

Advanced Experimental Options

By default, the GI system released in 3.8.1 is actually only exposing a simplified sub-set of more advanced GI system, which supports features like multiple bounces and ray traced speculars. 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 may be found in the tool tips.

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

The disadvantages:

  • 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 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 is getting injected into voxelization, then it may be propagated (within the voxelization) and then we sample it during ray tracing pass.

Here you can see example of information stored in voxels: 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

The disadvantages:

  • More 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)

Tip: If you getting "Display driver stopped responding and has recovered" error message you can use this workaround from Microsoft.

Voxel-Based Global Illumination Updates in CRYENGINE releases

For more information on Voxel-Based Global Illumination feature updates in CRYENGINE, please refer to the Appendix.