5.8 KiB
Use shadowmasks
Shadowmasks use the Shadowmask mixed lighting mode combine baked and real-time shadows at runtime and render shadows in the far distance.
HDRP supports the following Mixed Lighting Modes:
Enable shadowmasks
To use shadowmasks in HDRP, you must enable shadowmask support in your Unity Project’s HDRP Asset and then make your Cameras use shadowmasks in their Frame Settings :
- Under Render Pipeline Supported Features, enable the Shadowmask checkbox. This enables support for shadowmasks in your Unity Project.
- Next, you must make your Cameras use shadowmasks. In your HDRP Asset, navigate to Default Frame Settings > Lighting and enable the Shadowmask checkbox to make Cameras use shadowmasks by default.
Set up 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:
- Go to Edit > Project Settings > Graphics > Pipeline Specific Settings > HDRP.
- 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.
On a Light, when you select the Mixed mode. The lightmapper precomputes Shadowmasks for static GameObject that the Light affects.
Change the 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.
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 advanced 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. |
Directional Lights don't use Fade Distance. Instead they use the Max Distance property located in the HD Shadow Settings of your Scene’s Volumes.
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.