Bake Lighting Tool
- Calculate static voxel lighting inside Voxel Probes and put it into generated 3D lighting maps.
- Calculate reflection cubemaps for Environment Probes in static mode.
- Calculate shadow maps for Omni and Projected light sources in static mode.
The Bake Lighting tool enables you to improve performance by dropping the most of light and shadow computations.
Light Baking is the way of precomputing and storing data that describes how light rays bounce around static geometry causing indirect lighting. Adding indirect lighting to modelling helps to significantly improve the realistic look of the scene.
The following comparison shows the use of different lighting in the scene containing two light sources: a red OmniLight and a WorldLight (with the Sun Shafts camera effect enabled). The left image contains the scene illuminated with direct light only, so that unlit areas look like silhouettes and a large number of details is hidden in the darkness.
The right image shows the scene with both direct and indirect light, which makes it look way more realistic and consistent.
The computation of indirect lighting is a very expensive task for the processing unit, so it is usually performed once at the development stage (lighting is baked) and the results are used later for static lighting at run time.
In terms of UNIGINE, light baking is available if there is at least one voxel or non-dynamic environment probe in the scene. To get the lighting baked, perform the following steps:
Prepare the scene: set up lighting and emissive geometry, choose the light baking mode, hide or exclude unnecessary and dynamic objects from calculations via masking and/or adjusting surface flags.
Create and place voxel probes at the places where the lighting remains relatively static (e.g. interiors, outdoor buildings, and immovable objects).
Place voxel probes inside other voxel probes to create insets defining the areas that require higher detail. Note that voxel probes with the additive blending mode enabled cannot be used for this purpose, as they are blended instead of replacing each other.
Create non-dynamic environment probes and cover the areas which require appropriate reflections on reflective materials.
Disable the Grab by Bake Lighting parameter for probes, the cubemap texture of which should not be modified by the Bake Lighting tool. This is applicable for cases when you do not want to modify your assets and are going to generate new ones.
- Adjust the Baking Settings of probes and the settings of the Bake Lighting tool.
Click Bake to begin light baking for all enabled light sources (or Bake selected lights to affect only selected light sources) and wait for the process to complete.
At this stage, the Bake Lighting tool performs the following:
You can stop the process at any moment, the achieved result will be maintained.
- For each enabled Omni and Projected light source in the Static mode the shadow map is grabbed and saved in the Depth Texture asset.
- For each enabled World light source in the Static Shadow Cascade mode the shadow map is grabbed and saved in the Depth Texture asset.
- For each enabled Environment Probe, a cubemap is grabbed from the center point of the probe depending on its parameters.
- For each enabled Voxel Probe, a cycle over all the voxels is performed in order to grab lighting from 6 faces of a voxel and append it to the resulting 3D lighting map.
Enable post and camera effects.
Bake Lighting Settings#
Bake Lighting Settings#
|Number of Bounces||Number of light ray bounces.|
|Voxel Size Multiplier||Multiplier for the Voxel Size parameter for each voxel probe.|
|Voxels per Frame||Number of voxels computed and visualized per single frame.
The parameter is available for changing during the baking process. Higher values cause longer user interface response but accelerate the calculations.
|Light Node||Progress of light baking for the current light node at the moment.|
|Bounce||Progress of calculating the current bounce.|
|Overall||Overall progress of light baking for all light nodes in the scene.|
|Bake selected lights||Starts baking for selected lights regardless of whether they are enabled or not.|
|Bake/Stop||Starts baking for all enabled lights in the scene.|
Modes of Light Sources#
Omni, Projected, and World light sources have the Mode parameter that defines their contribution to the light baking process and determines if shadows are to be baked.
The following modes are available:
Dynamic. The light source provides direct realtime lighting only. It is considered disabled while light baking is being calculated, that is why the scene remains unlit when the light is turned off after light baking. No shadows are baked.
Dynamic mode. The light source is enabled.Dynamic mode. The light source is disabled.
Static. The light source contributes to light baking and remains enabled all the time providing direct realtime lighting while the indirect light is being baked. This option can cause a lack of physical accuracy registered by the eye. Shadows for Omni, Proj, and World lights are baked.
Static mode. The light source is enabled.Static mode. The light source is disabled.
Baking Shadows from Light Sources#
In addition to baking information about indirect lighting and reflections into voxel and environment probes, the Bake Lighting tool also bakes shadows into shadow map textures for Omni, Proj, and World light sources, if their light source mode is set to static.
If any light source is moved by the manipulator in the Editor or its shadow map resolution is changed, the shadow map is rebaked automatically.
The settings of the Bake Lighting tool do not affect baked shadow maps.