Version: 2021.1
Lighting Mode
Lighting Mode: Shadowmask

Lighting Mode: Baked Indirect

This page describes the behavior of all Mixed LightsLight components whose Mode property is set to Mixed. Some calculations for Mixed Lights are performed in advance, and some calculations for Mixed Lights are performed at runtime. The behavior of all Mixed Lights in a Scene is determined by the Scene’s Lighting Mode. More info
See in Glossary
in a SceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary
, when that Scene uses a Lighting Settings Asset with its Lighting Mode property set to Baked Indirect.

When you set a Scene’s Lighting Mode to Baked Indirect, Mixed Lights behave like Realtime LightsLight components whose Mode property is set to Realtime. Unity calculates and updates the lighting of Realtime Lights every frame at runtime. No Realtime Lights are precomputed. More info
See in Glossary
, with the additional benefit of baking indirect lighting into lightmapsA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
See in Glossary
. GameObjectsThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
lit by Mixed Lights cast real-time shadows up to the Shadow Distance you define in the Project.

Render pipeline support

  • The Built-in Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
    See in Glossary
    supports Baked Indirect Lighting Mode.
  • The Universal Render Pipeline (URP) supports Baked Indirect Lighting Mode.
  • The High Definition Render Pipeline (HDRP) supports Baked Indirect Lighting Mode.

Mixed Light behavior

When you set a Scene’s Lighting Mode to Baked Indirect, Mixed Lights behave as follows:

  • Dynamic GameObjects lit by Mixed Lights receive:
    • Real-time direct lighting.
    • Baked indirect lighting, using Light ProbesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info
      See in Glossary
      .
    • Shadows from dynamic GameObjects, using the shadow map, up to the Shadow Distance.
    • Real-time shadows from static GameObjects, using the shadow map, up to the Shadow Distance.
  • Static GameObjects lit by Mixed Lights receive:
    • Real-time direct lighting.
    • Baked indirect lighting, using lightmaps.
    • Real-time shadows from static GameObjects, using the shadow map, up to the Shadow Distance.
    • Real-time shadows from dynamic GameObjects, using the shadow map, up to the Shadow Distance.

Setting your Scene’s Lighting Mode to Baked Indirect

  1. Select the Lighting Settings Asset for the Scene.
  2. In the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    , navigate to Mixed Lighting.
  3. Use the drop-down menu to set the Lighting Mode to Baked Indirect.

Shadows and runtime performance

Because all shadows from Mixed Lights are real-time in Baked Indirect Lighting Mode, this can impact performance. You can reduce this impact by using the Shadow Distance property to limit the distance up to which Unity draws real-time shadows.

Changing Light properties at runtime

In the Baked Indirect Lighting Mode, you can subtly change the properties of a Mixed Light at runtime. Changes affect the real-time direct lighting that the Mixed Light contributes to the Scene, without affecting the baked indirect lighting that the Mixed Light contributes to the Scene. This allows you to combine the benefits of baked indirect lighting with some of the dynamic capabilities of a Realtime Light. This works especially well in Baked Indirect Lighting Mode, due to the lack of precomputed shadows.

You must be careful with runtime changes to Light properties, and only make small changes that don’t cause unrealistic combinations of real-time direct and baked indirect lighting. For example, if you bake a red Mixed Light into a lightmap and then change its color to green at runtime, the direct lighting is green but the indirect lighting baked into the lightmap remains red. The same applies to moving a Mixed Light at runtime: direct lighting follows the Light’s new position, but indirect lighting remains at the position at which the Light was baked.

This video shows an example of how to slightly modify a Mixed Light without causing noticeable inconsistencies in the indirect lighting: https://youtu.be/XN6ya31gm1I

Lighting Mode
Lighting Mode: Shadowmask
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961