Skip to content

Commit ab979a0

Browse files
Internal/2022.3/staging
Internal/2022.3/staging
2 parents c0b248e + f67c752 commit ab979a0

24 files changed

+13023
-83
lines changed

Packages/com.unity.render-pipelines.high-definition/Documentation~/Light-Component.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ This section is only available in Realtime or Mixed light **Mode**.
204204
| **Property** | **Description** |
205205
| -------------------------- | ------------------------------------------------------------ |
206206
| **Enable** | Enable the checkbox to let this Light cast shadows. |
207-
| **Update Mode** | Use the drop-down to select the mode that HDRP uses to determine when to update a shadow map.<br />For information on the modes available, see the [Shadows in HDRP documentation](Shadows-in-HDRP.md#ShadowUpdateMode). |
207+
| **Update Mode** | Determines how often HDRP updates the shadow map for the Light. The options are: <ul><li><b>Every Frame</b>: Updates the shadow maps for the Light every frame. This is the default value.</li><li><b>On Enable</b>: Updates the shadow maps for the Light only when you enable the GameObject.</li><li><b>On Demand</b>: Updates the shadow maps for the Light only when you call the [`HDAdditionalLightData.RequestShadowMapRendering`](xref:UnityEngine.Rendering.HighDefinition.HDAdditionalLightData.RequestShadowMapRendering) API to update them.</li></ul>For more information, refer to [Update shadows less frequently](shadow-update-mode.md). |
208208
| **Resolution** | Set the resolution of this Light’s shadow maps. Use the drop-down to select which quality mode to derive the resolution from. If you don't enable **Use Quality Settings**, or you select **Custom**, set the resolution, measured in pixels, in the input field.<br/>A higher resolution increases the fidelity of shadows at the cost of GPU performance and memory usage, so if you experience any performance issues, try using a lower value. |
209209
| **Near Plane** | The distance, in meters, from the Light that GameObjects begin to cast shadows. |
210210
| **Shadowmask Mode** | Defines how the shadowmask behaves for this Light. For detailed information on each **Shadowmask Mode**, see the documentation on [Shadowmasks](Shadows-in-HDRP.md#ShadowmaskModes). This property is only visible if you tet the **Mode**, under [General](#GeneralProperties), to **Mixed**. |

Packages/com.unity.render-pipelines.high-definition/Documentation~/Mask-Map-and-Detail-Map.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ The mask map contains four grayscale textures, one in each color channel. The de
1919
| **Blue** | Detail mask |
2020
| **Alpha** | Smoothness |
2121

22+
**Note:** The detail mask texture allows you to control where the detail texture is applied on your model. Use a value of `1` to display the detail texture and a value of `0` to mask it. For instance, if your model has skin pores, you might mask the lips and eyebrows to prevent the pores from appearing in those areas.
23+
2224
To create a mask map, create a linear composited map in a photo editor, using the channels as described in the table above.
2325

2426
The following example image demonstrates the individual components of a full mask map.

Packages/com.unity.render-pipelines.high-definition/Documentation~/Shadows-in-HDRP.md

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ To enable this feature:
3232

3333
HDRP renders all real-time shadows for a frame using a shadow map atlas for all [punctual light](Glossary.md#PunctualLight) shadows, an atlas for area lights and another one for Directional Light shadows.
3434

35+
HDRP also renders separate shadow atlases for cached shadows. For more information, refer to [Update shadows less frequently](shadow-update-mode.md).
36+
3537
Set the size of these atlases in your Unity Project’s [HDRP Asset](HDRP-Asset.md). The atlas size determines the maximum resolution of shadows in your Scene.
3638

3739
For example, the default size of an atlas is 4096 x 4096, which can fit:
@@ -101,50 +103,6 @@ Directional Lights don't use **Fade Distance**. Instead they use the **Max Dista
101103

102104
**Shadowmask** is more memory intensive because the Camera uses shadowmask textures for static GameObjects close to the Camera, requiring a larger resolution shadowmask texture.
103105

104-
<a name="ShadowUpdateMode"></a>
105-
106-
## Shadow Update Mode
107-
108-
You can use **Update Mode** to specify the calculation method HDRP uses to update a [Light](Light-Component.md)'s shadow maps. The following Update Modes are available:
109-
110-
| **Update Mode** | **Description** |
111-
| --------------- | ------------------------------------------------------------ |
112-
| **Every Frame** | HDRP updates the shadow maps for the light every frame. |
113-
| **On Enable** | HDRP updates the shadow maps for the light whenever you enable the GameObject. |
114-
| **On Demand** | HDRP updates the shadow maps for the light every time you request them. To do this, call the RequestShadowMapRendering() method in the Light's HDAdditionalLightData component. |
115-
116-
The High Definition Render Pipeline (HDRP) uses shadow caching to increase performance by only updating the shadow maps for [Lights](Light-Component.md) when it's necessary. HDRP has shadow atlases for punctual, area, and directional Lights, and separate shadow atlases specifically for cached punctual and cached area Lights. For cached directional Lights, they use the same atlas as normal directional Lights.
117-
118-
When a Light that caches its shadows renders its shadow map for the first time, HDRP registers it with the cached shadow manager which assigns the shadow map to a cached shadow atlas. For directional Lights, HDRP uses the same shadow atlas for cached and non-cached directional Lights.
119-
120-
A Light's **Update Mode** determines whether HDRP caches its shadow map:
121-
122-
* If you set a Light's **Update Mode** to **OnEnable** or **OnDemand**, HDRP caches the Light's shadow map.
123-
* If you set a Light's **Update Mode** to **Every Frame**, HDRP doesn't cache the Light's shadow map.
124-
125-
If you set the Light's **Update Mode** to **OnDemand**, you can manually request HDRP to update the Light's shadow map. To do this:
126-
127-
1. Select a Light in your scene to view it in the Inspector window.
128-
2. Go to **HDAdditionalLightData** and open the More menu (&#8942;).
129-
3. Select **Edit Script**.
130-
2. Call the `RequestShadowMapRendering` function in the script.
131-
132-
If the Light has multiple shadows (for example, multiple cascades of a directional light), you can request the update of a specific sub-shadow. To do this, use the `RequestSubShadowMapRendering(shadowIndex)` function.
133-
134-
When you set **Update Mode** to **OnDemand** HDRP renders the shadow maps `OnEnable` for the first time, or when first registered with the system by default. You can change this using the `onDemandShadowRenderOnPlacement` property. If you set this property to false, HDRP doesn't render the shadows until you call `RequestShadowMapRendering` or `RequestSubShadowMapRendering(shadowIndex)`.
135-
136-
For a Light that caches its shadows, if you disable it or set its **Update Mode** to **Every Frame**, HDRP can preserve the Light's shadow map's place in the cached shadow atlas. This means that, if you enable the Light again, HDRP doesn't need to re-render the shadow map or place it into a shadow atlas. For information on how to make a Light preserve its shadow map's place in the cached shadow atlas, see [Preserving shadow atlas placement](#preserving-shadow-atlas-placement).
137-
138-
As a shortcut for a common case, HDRP offers an option to automatically trigger an update when either the position or rotation of a light changes above a certain threshold. To enable this option:
139-
140-
1. Select a Light in your Scene to view it in the Inspector window.
141-
2. Go to **Light** > **Shadows** and set **Update Mode** to **On Enable**
142-
3. Enable **Update on light movement**.
143-
144-
You can customize the threshold that HDRP uses to determine how much a light needs to move or rotate to trigger an update. To do this, use the properties: `cachedShadowTranslationUpdateThreshold` and `cachedShadowAngleUpdateThreshold` properties on the Light's **HDAdditionalLightData** component.
145-
146-
**Note**: Point lights ignore the angle differences when determining if they need to perform an update in this mode.
147-
148106
### Customising shadow caching
149107
HDRP caches shadow maps for Punctual Lights into one atlas, Area Lights into another, and Directional Lights into the same atlas as non-cached Directional Lights. You can change the resolution of the first two cached shadow atlases independently of one another. To do this:
150108

@@ -161,19 +119,6 @@ After a Scene loads with the Lights you have already placed, if you add a new Li
161119

162120
It's possible to check if a Light's shadow maps have a place in the cached shadow atlas by using `HDCachedShadowManager.instance.LightHasBeenPlacedInAtlas`. It's also possible to check if a Light's shadow maps have been placed and rendered at least once with `HDCachedShadowManager.instance.LightHasBeenPlaceAndRenderedAtLeastOnce`.
163121

164-
### Preserving shadow atlas placement
165-
166-
If you disable the Light or change its **Update Mode** to **Every Frame**, the cached shadow manager unreserves the Light's shadow map's space in the cached shadow atlas and HDRP begins to render the Light's shadow map to the normal shadow atlases every frame. If the cached shadow manager needs to allocate space on the atlas for another Light, it can overwrite the space currently taken up by the original Light's shadow map.
167-
168-
If you want to temporarily set a Light's **Update Mode** to **Every Frame** and want to set it back to **On Enable** or **On Demand** later, you can preserve the Light's shadow map placement in its atlas. This is useful, for example, if you want HDRP to cache a far away Light's shadow map, but update it every frame when it gets close to the [Camera](HDRP-Camera.md). To do this:
169-
170-
1. Select a Light in your scene to view it in the Inspector window.
171-
2. Go to **HDAdditionalLightData** and open the More menu (&#8942;)
172-
3. Select **Edit Script**
173-
4. Enable **preserveCachedShadow** and set it to **True**. HDRP preserves the Light's shadow map's space in its shadow atlas.
174-
175-
**Note**: Even if you enable **preserveCachedShadow**, if you destroy the Light, it loses its placement in the shadow atlas.
176-
177122
### Mixed Cached Shadow Maps
178123

179124
In HDRP it's possible to cache only some of the shadow map. To do this:

Packages/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
* [Local Volumetric Fog](Local-Volumetric-Fog.md)
194194
* [Light Layers](Light-Layers.md)
195195
* [Shadows](Shadows-in-HDRP.md)
196+
* [Update shadows less frequently](shadow-update-mode.md)
196197
* [Shadowmasks](Lighting-Mode-Shadowmask.md)
197198
* [Volumetric Lighting](Volumetric-Lighting.md)
198199
* [Physical Light Units and Intensities](Physical-Light-Units.md)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Update shadows less frequently
2+
3+
By default, the High Definition Render Pipline (HDRP) calculates the shadow map of a Light every frame. To improve performance, reduce how often HDRP updates the shadow map.
4+
5+
## Reduce shadow map updates
6+
7+
Follow these steps:
8+
9+
1. Select a Light in your Scene.
10+
1. In the Inspector window, in the **Shadows** section, set **Update Mode** to **On Enable** or **On Demand**.
11+
12+
- **On Enable**: Updates the shadow map only when the Light is enabled.
13+
- **On Demand**: Updates the shadow map only when you use an API to update the shadows manually.
14+
15+
In these modes, HDRP caches the shadow map when the shadows update, and uses the cached version between updates.
16+
17+
Point Lights and Area Lights have their own shadow atlas for cached shadows. Directional Lights store cached shadows in the same shadow atlas as non-cached Directional Lights. For more information about shadow atlases, refer to [Control shadow resolution and quality](Shadows-in-HDRP.md).
18+
19+
## Updates shadows manually
20+
21+
If you set the **Update Mode** of the Light to **On Demand**, follow these steps to update the shadows:
22+
23+
1. In the Inspector window for the Light, go to **HDAdditionalLightData** and open the **More** (&#8942;) menu.
24+
1. Select **Edit Script**.
25+
1. Call the `RequestShadowMapRendering` API in the script when you want to update the shadows.
26+
27+
HDRP also updates the shadows when you first enable [Contact Shadows](Override-Contact-Shadows.md).
28+
29+
If you set a Directional Light to **On Demand**, update shadows frequently so they stay up-to-date with the camera position. Otherwise you might see visual artifacts.
30+
31+
For more information about customizing which shadows HDRP updates and when, refer to the [`HDAdditionalLightData`](xref:UnityEngine.Rendering.HighDefinition.HDAdditionalLightData) API.
32+
33+
## Update shadows when the Light moves
34+
35+
To update the shadow map only when the position or rotation of the Light changes, follow these steps:
36+
37+
1. Set **Update Mode** to **On Enable**.
38+
1. Enable **Update on light movement**.
39+
40+
To customize how much a light needs to move or rotate to trigger an update, use the [`cachedShadowAngleUpdateThreshold`](xref:UnityEngine.Rendering.HighDefinition.HDAdditionalLightData.cachedShadowAngleUpdateThreshold) and [`cachedShadowTranslationUpdateThreshold`](xref:UnityEngine.Rendering.HighDefinition.HDAdditionalLightData.cachedShadowTranslationUpdateThreshold) APIs.
41+
42+
**Note**: Point Lights ignore `cachedShadowAngleUpdateThreshold`.
43+
44+
## Preserve cached shadows
45+
46+
To preserve a cached shadow map when you disable a Light or set its **Update Mode** back to **Every Frame**, edit your script to set the [`UnityEngine.Rendering.HighDefinition.HDAdditionalLightData.preserveCachedShadow`](HighDefinition.HDAdditionalLightData.preserveCachedShadow) property to `true`.
47+
48+
HDRP keeps the shadow map in the shadow atlas, so it doesn't need to re-render the shadow map or place it into a shadow atlas again. This is useful if, for example, you want HDRP to cache the shadow map of a distant Light, but update the shadow map every frame when the Light gets closer to the camera.
49+
50+
**Note**: If you destroy the Light, HDRP no longer preserves its shadow map in the shadow atlas.
51+
52+
## Additional resources
53+
54+
- [Realtime shadows](Realtime-Shadows.md)
55+
- [Contact Shadows](Override-Contact-Shadows.md)

Packages/com.unity.render-pipelines.universal/Documentation~/2d-customlit.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

Packages/com.unity.render-pipelines.universal/Documentation~/TableOfContents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
* [Fullscreen Master Stack in Shader Graph reference for URP](urp-shaders/fullscreen-master-stack-reference.md)
110110
* [Shaders and Materials](shaders-in-universalrp.md)
111111
* [Shading Models](shading-model.md)
112+
* [Assign a channel-packed texture to a material](shaders-in-universalrp-channel-packed-texture.md)
112113
* [Material Variants](materialvariant-URP.md)
113114
* [Complex Lit](shader-complex-lit.md)
114115
* [Lit](lit-shader.md)

Packages/com.unity.render-pipelines.universal/Documentation~/features/rendering-layers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ This section contains information related to the impact of Rendering Layers on p
140140

141141
* When using Rendering Layers only for Lights in the Forward Rendering Path, the performance impact is insignificant.
142142

143-
* Performance impact grows more significantly when the Rendering Layer count exceeds a multiple of 8. For example: increasing the layer count from 8 to 9 layers has a bigger relative impact than increasing the layer count from 9 to 10 layers. The same consideration applies to increasing the count from 16 to 17, from 24 to 25 and so on.
143+
* Performance impact increases more significantly when the number of Rendering Layers reaches 9, 17, 25, and so on. This is because when the Rendering Layers exceed a multiple of 8, URP adds an extra texture channel the GPU must access.
144144

145145
## Additional resources
146146

Packages/com.unity.render-pipelines.universal/Documentation~/lit-shader.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ The __Surface Options__ control how URP renders the Material on a screen.
4747

4848
The __Surface Inputs__ describe the surface itself. For example, you can use these properties to make your surface look wet, dry, rough, or smooth.
4949

50+
You can use a single RGBA texture for the metallic, smoothness, and occlusion properties. For more information, refer to [Assign a channel-packed texture to a material in URP](shaders-in-universalrp-channel-packed-texture.md).
51+
5052
**Note:** If you are used to the [Standard Shader](https://docs.unity3d.com/Manual/Shader-StandardShader.html) in the built-in Unity render pipeline, these options are similar to the Main Maps settings in the [Material Editor](https://docs.unity3d.com/Manual/StandardShaderContextAndContent.html).
5153

5254

Packages/com.unity.render-pipelines.universal/Documentation~/shader-complex-lit.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ The __Surface Options__ control how URP renders the Material on a screen.
4949

5050
The __Surface Inputs__ describe the surface itself. For example, you can use these properties to make your surface look wet, dry, rough, or smooth.
5151

52+
You can use a single RGBA texture for the metallic, smoothness, and occlusion properties. For more information, refer to [Assign a channel-packed texture to a material in URP](shaders-in-universalrp-channel-packed-texture.md).
53+
5254
**Note:** If you are used to the [Standard Shader](https://docs.unity3d.com/Manual/Shader-StandardShader.html) in the built-in Unity render pipeline, these options are similar to the Main Maps settings in the [Material Editor](https://docs.unity3d.com/Manual/StandardShaderContextAndContent.html).
5355

5456

0 commit comments

Comments
 (0)