Control indirect lighting
The Indirect Lighting Controller is a Volume component that allows you to globally control the intensity of baked or precomputed indirect lighting.
This override is useful in situations where you need to animate your lighting globally.
Using the Indirect Lighting Controller
The Indirect Lighting Controller uses the Volume framework, so to enable and modify Indirect Lighting Controller properties, you must add an Indirect Lighting Controller override to a Volume in your Scene. To add Indirect Lighting Controller to a Volume:
- In the Scene or Hierarchy view, select a GameObject that contains a Volume component to view it in the Inspector.
- In the Inspector, go to Add Override > Lighting and select Indirect Lighting Controller.
API
To access and control this override at runtime, use the Volume scripting API. Because of how the Volume system works, you edit properties in a different way to standard Unity components. There are also other nuances to be aware of too, such as each property has an overrideState. This indicates to the Volume system whether to use the property value you set, or use the default value stored in the Volume Profile. For information on how to use the API correctly, see Volume scripting API.
For information about the indirect lighting controller properties, refer to Indirect lighting controller reference.
Details
An example of a situation where an Indirect Lighting Controller would be useful is when your Camera is in a dark area and you want to light the area suddenly. To create this effect:
- Create a Scene Settings GameObject (menu: GameObject > Rendering > Scene Settings) and add an Indirect Lighting Controller (click on the Scene Settings GameObject and then, in the Volume component in the Inspector, click Add Override and select Indirect Lighting Controller).
- Add a Collider to the Scene Settings GameObject and enable Is Trigger. Set the Size of the Collider to be the size of the area you want to change the indirect lighting for.
- In the Indirect Lighting Controller, set the Indirect Diffuse Intensity and Indirect Specular Intensity to 0. This dims all indirect lighting to black.
- When you light the area, animate (using Timeline or an Animation) the Volume's Weight property to transition from 1 to 0. This progressively interpolates between the values set inside the Volume and the values from other Volumes that affect your Camera.
- As a result, the Indirect lighting globally fades in. Alter the length of the animation to speed up or slow down the fade.