Lightmap

The baking system is the process of finally generating light maps and applying them in the scene by calculating the influence of all light sources on the object in the engine scene. The purpose of this system is to reduce the calculation of real-time light sources, thereby improving the efficiency of the scene.

lightmap

Creating

The following three steps are required to turn on the baking system:

  1. Click the menu button in the top menu bar Project (Project), click the Lightmap (light map) button in the pop-up menu bar to pop up the lightmap panel.

    create lightmap

  2. Before baking, you need to set bakeable to true in the static light attribute of the light source component in the editor.

    Note: currently only one main direction light source is supported.

    enable lightbake

    • Bakeable: When checked, enable bake lighting
    • CastShaow: When checked, enable cast static shadow
    • EditorOnly: When checked, only takes effect in the editor
  3. In the lightmap panel that pops up, after setting the corresponding parameters, click the Lightmap Generate button and select the corresponding storage folder to generate the lightmap

    Note: the storage folder must be under Effective Assets.

    create lightmap asset

Using

During the process of generating baked maps, there will be a generated progress prompt. After the generation, you can view it in the Baked tab in the lightmap panel.

bake result

Among them, Baked result (baked result display panel) shows the lightmap texture after baking, Lightmap clear (clear button) can delete the generated result of baking, and information output panel shows the information of each baked image (file name, size, etc.).

Note: before the lightmap is enabled, the model needs to include two sets of uv, the second set of uv is used to access the lightmap, and Materials also need to check the lightmap option to apply the shadow information after the model is baked.

Editing

The baking process is to calculate the generated results according to the parameters set on the panel, as shown below:

bake result

The following table describes the specific meaning of each parameter:

ParameterDescription
MSAAMultisampling. Has the following values: 1, 2, 4, 8
ResolutionBaking map size. Has the following values: 128, 256, 512, 1024, 2048
GammaGamma correction value
GIScaleGlobal illumination scaling factor
GISamplesGlobal illumination sampling coefficient
AOLevelAO Level
AOStrengthAO Strength
AORadiusAO Radius
AOColorAO Color