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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Light Maps

Lightmapping is a static global illumination technique using precalculated textures (lightmaps) that store brightness and reflected color of lit surfaces. By using lightmapping you can avoid heavy computations of lighting in primarily static scenes.

Lightmapping is the most efficient solution enabling to achieve realistic diffuse lighting and keep the high performance. It is capable of giving high-detailed global illumination combined with simulation of many light bounces. The number of bounces is the key aspect of creating realistic lighting in bright scenes. When you use lightmapping it doesn’t matter how many rays, bounces or light sources are there, as everything is calculated once and then baked in textures. These textures are then simply projected onto the surfaces of objects, creating a realistic look.

UNIGINE provides an integrated GPU-accelerated Lightmapper tool available in the Bake Lighting window.

Baking correct lightmaps requires proper and non-overlapping UV coordinates for all scene geometry. If your assets do not have such UV coordinates (for example, CAD models), use the automatic UV unwrapping option when importing the model.

In the Import Settings for FBX, CAD models and UNIGINE *.mesh assets, select the UV Channel and Target Resolution to be used for lightmaps (it directly affects the map quality and baking time) and, if needed, toggle UV channels for unwrapping. Traditionally, UV Channel 0 is used for texturing and Channel 1 is for lightmapping.

For all surfaces of static objects that are intended to be lightmapped, the following Lightmaps parameters are to be adjusted:

  1. Toggle the Enabled flag to enable the feature.
  2. Select Bake Unique Texture if you want to bake a new lightmap (if you want to use an already generated map, select the Use Custom Texture mode).
  3. Moreover, you can specify the lightmap Texture generated in a third-party software. Select the Use Custom Texture mode for this purpose.
Notice
You can select Baked Lightmap Checker from the Rendering Debug menu to check unwrapping and resolution uniformity on scene objects.

For a surface to contribute to the lightmap, it must have the Cast Global Illumination option enabled (this option should be disabled for dynamic objects).

Prepare light sources: set the Static mode for the sources that should contribute to lightmapping (these light sources are to be enabled during the baking process), in order to bake direct and reflected light from emissive surfaces (with the enabled Emission state in the material parameters) enable the Emission Bake GI option.

Baking Process#

  1. Enable the Lightmap buffer: Rendering -> Buffers -> Lightmap.
  2. Open the Bake Lighting window.
  3. Enable Bake Lightmaps for Surfaces. Adjust the baking settings:

    • Set up Baking Viewport Masks.
    • Select 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 the 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/lightmaps folder and applied to the corresponding surfaces.
  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.

Notice
If you are not satisfied with the baking result on certain objects or surfaces, you can select them and perform partial re-bake with different settings by clicking Bake Selected.

Lightmaps can be combined with Voxel Probes and Environment Probes.

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