This page has been translated automatically.
Unigine Basics
1. Introduction
2. Managing Virtual Worlds
3. Preparing 3D Models
4. Materials
6. Implementing Application Logic
7. Making Cutscenes and Recording Videos
8. Preparing Your Project for Release
9. Physics
10. Optimization Basics
11. PROJECT2: First-Person Shooter
12. PROJECT3: Third-Person Cross-Country Arcade Racing Game
13. PROJECT4: VR Application With Simple Interaction

Global Illumination

In addition to lightmaps, UNIGINE has a static GI method — voxel-based global illumination. Essentially, it projects a precalculated 3D lightmap onto parts of surfaces into a box-shaped voxel volume. This approach uses spatial modulation, so UV coordinates are not required. Voxel GI is based on the use of multiple Voxel Probe sources, which opens up many possibilities. You can combine low-detail voxels with high-detail voxels (insets), you can turn them on and off one by one, mix them as you see fit in order to achieve the desired result. Voxel Probe is mainly applied in ambient lighting. When baked, Voxel Probe illuminates everything inside its volume with ambient light, providing a pretty good simulation of global illumination, including ambient occlusion, light bounces, and diffuse reflections. Of course, voxels will never be as realistic as lightmaps, nor can they provide the same density due to a number of factors, but voxel-based GI is suitable for any high-polygon and low-polygon geometry, does not require UV maps, and can be used for dynamic objects (which is clearly beyond lightmapping). The great thing is that these two techniques can be combined, and you can choose any of them depending on the requirements of a particular project (for example, lightmaps are the best option for high-quality lighting in a static scene, but if you need dynamics, you can just add voxels where needed).

Global Illumination is baked using the same Bake Lighting tool. Before baking, you need to pre-configure objects and lighting sources as we did for lightmaps: turn on Cast Global Illumination for static surfaces (turn it off for dynamic ones).

Select the Static mode for the sources to be baked, and enable the Emission Bake GI option for surfaces with emission.

Create and place one or more Voxel Probes in areas where illumination is relatively static (e.g. interiors, street buildings, immovable objects).

Place some Voxel Probes inside other Voxel Probes to create insets that define areas of higher detail. Note that Voxel Probe with the Additive Blending mode enabled cannot be used for this purpose, because instead of replacing each other, they will blend together.

Set the general Voxel Probe settings, such as Box Size and Voxel Size, which define the resolution of the voxel grid and the video memory consumed.

Baking Process#

  1. Enable the Lightmap buffer (Rendering → Buffers → Lightmap).
  2. Open the Bake Lighting window.
  3. Enable Bake Voxel Probes and adjust Voxel Size Multiplier, if necessary:

    • Configure Baking Viewport Masks to select the light sources and surfaces that should be baked.
    • Set the baking Quality: Draft is suitable for quick iterations, and Ultra provides the maximum quality.
    • Adjust Far Clipping Distance for clipping the light rays.
  4. Set the number of light ray bounces (higher values will result in a brighter lighting).
  5. Start baking process for all objects by clicking Bake All Lighting and wait for it to finish. Live preview of the process is available (the number of samples counted per frame can be adjusted during the baking process).

  6. The generated lightmaps are saved to the bake_lighting/voxel_probes folder and applied to the corresponding Voxel Probes.
  7. To improve the quality, you can also enable Lightmap Cubic Filtering in the material settings of the surfaces with the light map.
  8. The result can be checked by selecting the Indirect Lighting mode in the Rendering Debug menu.

Additive Blending#

More flexibility in lighting control is available with the Additive Blending mode. You can use it to blend lighting of several Voxel Probes together and control them separately (e.g. make a separate Voxel Probe for an indoor lamp and blend it with another Voxel Probe with lighting baked from the sky, having the ability to enable and disable them separately).

Last update: 2024-04-19
Build: ()