Shadowmask lighting mode
The High Definition Render Pipelines (HDRP) supports the Shadowmask Lighting Mode which makes the lightmapper precompute shadows for static GameObjects, but still process real-time lighting for non-static GameObjects. HDRP also supports the Baked Indirect mixed Lighting Mode. For more information on mixed lighting and shadowmasks, see Mixed lighting modes and Shadowmask.
Using shadowmasks
To use shadowmasks in HDRP, you must set up your Project to support them. To do this:
- Enable Shadowmask for every Quality Level in your Unity Project:
- Go to Edit > Project Setting > Quality > HDRP.
- Select a Quality Level (for example, HDRPMediumQuality).
- Go to Lighting > Shadows and enable Shadowmask.
- Repeat these steps for every Quality Level.
- Enable the Shadowmask property in your Unity Project’s HDRP Asset:
- In the Project window, select an HDRP Asset to view in the Inspector.
- Go to Lighting > Shadow.
- Enable Shadowmask.
- Set up your Scene to use Shadowmask and Baked Global Illumination:
- Open the Lighting window (menu: Window > Rendering > Lighting).
- In the Mixed Lighting section, enable Baked Global Illumination and set the Lighting Mode to Shadowmask.
- Make your Cameras use shadowmasks when they render the Scene. To set this as the default behaviour for Cameras:
- Open the Project Settings window (menu: Edit > Project Settings) and select the HDRP Global Settings tab.
- Go to Frame Settings (Default Values) > Camera > Lighting and enable Shadowmask.
- Optionally, you can make your Reflection Probes use shadowmask for baked or real-time reflections. To do this:
- Go to Frame Settings (Default Values) > Realtime Reflection or Baked or Custom Reflection > Lighting and enable Shadowmask.
Now, on a Light, when you select the Mixed mode. The lightmapper precomputes Shadowmasks for static GameObject that the Light affects.
Shadowmask mode
To allow for flexible lighting setups, HDRP lets you choose the behaviour of the shadowmasks for each individual Light. To change the behavior of the shadowmask, use the Light’s Shadowmask Mode property. To do this:
- Select a Light in your Scene to view it in the Inspector window.
- Go to General > Mode > Mixed.
- Go to Shadows > Shadow Map > Shadowmask Mode and select one of the options.
For information on the behavior of each Shadowmask Mode, see the following table:
Shadowmask Mode | Description |
---|---|
Distance Shadowmask | Makes the Light cast real-time shadows for all GameObjects when the distance between the Camera and the Light is less than the Fade Distance. If you can not see this property, enable additional properties for the Shadows section. When the distance between the Light and the Camera is greater than the Fade Distance, HDRP stops calculating real-time shadows for the Light. Instead, it uses shadowmasks for static GameObjects, and non-static GameObjects don't cast shadows. Directional Lights don't use Fade Distance, instead they use the current Max Shadow Distance. |
Shadowmask | Makes the Light cast real-time shadows for non-static GameObjects only. It then combines these shadows with shadowmasks for static GameObjects when the distance between the Camera and the Light is less than the Fade Distance. When the distance between the Light and the Camera is greater than the Fade Distance, HDRP stops calculating real-time shadows for the Light. It uses shadowmasks for static GameObjects and non-static GameObjects don't cast shadows. |
Performance
Distance Shadowmask is more GPU intensive, but looks more realistic because real-time lighting that's closer to the Light is more accurate than shadowmask Textures with a low resolution meant to represent areas further away.
Shadowmask is more memory intensive because the Camera uses shadowmask Textures for static GameObjects close to the Camera, which requires a larger resolution shadowmask Texture.