Skip to content

Commit 5a11e97

Browse files
markg-unityEvergreen
authored andcommitted
DOCG-5305 Add URP 2023.3 APV features
Adds the following URP APV 2023.3 features: - Lighting scenarios (ported from existing HDRP documentation) - Disk streaming (ported from existing HDRP documentation) - Sky occlusion (edited version of existing HDRP documentation) - Replacement URP-specific to show per-object vs per-pixel lighting Jira ticket: https://jira.unity3d.com/browse/DOCG-5305
1 parent 54c7c45 commit 5a11e97

16 files changed

+335
-15
lines changed
69.2 KB
Loading

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@
6666
* [Display Adaptive Probe Volumes](probevolumes-showandadjust.md)
6767
* [Configure the size and density of Adaptive Probe Volumes](probevolumes-changedensity.md)
6868
* [Bake multiple scenes together with Baking Sets](probevolumes-usebakingsets.md)
69+
* [Changing lighting at runtime](probe-volumes-change-lighting-at-runtime.md)
70+
* [Choose how to change lighting at runtime](probevolumes-understand-changing-lighting-at-runtime.md)
71+
* [Bake different lighting setups with Lighting Scenarios](probevolumes-bakedifferentlightingsetups.md)
72+
* [Update light from the sky at runtime with sky occlusion](probevolumes-skyocclusion.md)
6973
* [Streaming](probevolumes-streaming.md)
7074
* [Fix issues with Adaptive Probe Volumes](probevolumes-fixissues.md)
7175
* [Adaptive Probe Volume Inspector window reference](probevolumes-inspector-reference.md)

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ The properties in this section let you change how the [render graph system](../r
215215

216216
## Probe Volume panel
217217

218-
These settings make it possible for you to visualize [Adaptive Probe Volumes](probevolumes.md) in your Scene, and configure the visualization.
218+
These settings make it possible for you to visualize [Adaptive Probe Volumes](../probevolumes.md) in your Scene, and configure the visualization.
219219

220220
### Subdivision Visualization
221221

@@ -233,7 +233,7 @@ These settings make it possible for you to visualize [Adaptive Probe Volumes](pr
233233
| **Property** | **Sub-property** | **Description** |
234234
|-|-|-|
235235
| **Display Probes** || Display probes. |
236-
|| **Probe Shading Mode** | Set what the Rendering Debugger displays. The options are:<ul><li><strong>SH</strong>: Display the [spherical harmonics (SH) lighting data](https://docs.unity3d.com/Manual/LightProbes-TechnicalInformation.html) for the final color calculation. The number of bands depends on the **SH Bands** setting in the active [URP Asset](../universalrp-asset.md).</li><li><strong>SHL0</strong>: Display the spherical harmonics (SH) lighting data with only the first band.</li><li><strong>SHL0L1</strong>: Display the spherical Harmonics (SH) lighting data with the first two bands.</li><li><strong>Validity</strong>: Display whether probes are valid, based on the number of backfaces the probe samples. Refer to [Fix issues with Adaptive Probe Volumes](../probevolumes-fixissues.md) for more information about probe validity.</li><li><strong>Probe Validity Over Dilation Threshold</strong>: Display red if a probe samples too many backfaces, based on the **Validity Threshold** set in the [Adaptive Probe Volumes panel](../probevolumes-lighting-panel-reference.md). This means the probe can't be baked or sampled.</li><li><strong>Invalidated By Touchup Volumes</strong>: Display probes that a [Probe Adjustment Volume component](../probevolumes-adjustment-volume-component-reference.md) has made invalid.</li><li><strong>Size</strong>: Display a different color for each size of [brick](../probevolumes-concept.md).</li></ul>|
236+
|| **Probe Shading Mode** | Set what the Rendering Debugger displays. The options are:<ul><li><strong>SH</strong>: Display the [spherical harmonics (SH) lighting data](https://docs.unity3d.com/Manual/LightProbes-TechnicalInformation.html) for the final color calculation. The number of bands depends on the **SH Bands** setting in the active [URP Asset](../universalrp-asset.md).</li><li><strong>SHL0</strong>: Display the spherical harmonics (SH) lighting data with only the first band.</li><li><strong>SHL0L1</strong>: Display the spherical Harmonics (SH) lighting data with the first two bands.</li><li><strong>Validity</strong>: Display whether probes are valid, based on the number of backfaces the probe samples. Refer to [Fix issues with Adaptive Probe Volumes](../probevolumes-fixissues.md) for more information about probe validity.</li><li><strong>Probe Validity Over Dilation Threshold</strong>: Display red if a probe samples too many backfaces, based on the **Validity Threshold** set in the [Adaptive Probe Volumes panel](../probevolumes-lighting-panel-reference.md). This means the probe can't be baked or sampled.</li><li><strong>Invalidated By Touchup Volumes</strong>: Display probes that a [Probe Adjustment Volume component](../probevolumes-adjustment-volume-component-reference.md) has made invalid.</li><li><strong>Size</strong>: Display a different color for each size of [brick](../probevolumes-concept.md).</li><li><strong>Sky Occlusion SH</strong>: If you enable [sky occlusion](../probevolumes-skyocclusion.md), this setting displays the amount of indirect light the probe receives from the sky that bounced off static GameObjects. The value is a scalar, so it displays as a shade of gray.</li><li><strong>Sky Direction</strong>: Display a green circle that represents the direction from the probe to the sky. This setting displays a red circle if Unity can't calculate the direction, or **Sky Direction** in the [Adaptive Probe Volumes panel](../probevolumes-lighting-panel-reference.md) is disabled.</li></ul>|
237237
|| **Debug Size** | Set the size of the displayed probes. The default is 0.3. |
238238
|| **Exposure Compensation** | Set the brightness of the displayed probes. Decrease the value to increase brightness. The default is 0. This property appears only if you set **Probe Shading Mode** to **SH**, **SHL0**, or **SHL0L1**. |
239239
|| **Max Subdivisions Displayed** | Set the lowest probe density to display. For example, set this to 0 to display only the highest probe density. |
@@ -258,6 +258,17 @@ Use the following properties to control how URP streams Adaptive Probe Volumes.
258258
| **Index Fragmentation Rate** | Displays the amount of fragmentation as a numerical value, where 0 is no fragmentation. |
259259
| **Verbose Log** | Log information about streaming. |
260260

261+
### Scenario Blending
262+
263+
Use the following properties to control how URP blends Lighting Scenarios. Refer to [Bake different lighting setups with Lighting Scenarios](../probevolumes-bakedifferentlightingsetups.md) for more information.
264+
265+
| **Property** | **Description** |
266+
| - | - |
267+
| **Number of Cells Blended Per Frame** | Determines the maximum number of cells Unity blends per frame. The default is 10,000. |
268+
| **Turnover Rate** | Set the blending priority of cells close to the camera. The range is 0 to 1, where 0 sets the cells close to the camera with high priority, and 1 sets all cells with equal priority. Increase **Turnover Rate** to avoid cells close to the camera blending too frequently. |
269+
| **Scenario To Blend With** | Select a Lighting Scenario to blend with the active Lighting Scenario. |
270+
| **Scenario Blending Factor** | Set how far to blend from the active Lighting Scenario to the **Scenario To Blend With**. The range is 0 to 1, where 0 is fully the active Lighting Scenario, and 1 is fully the **Scenario To Blend With**. |
271+
261272
## Navigation at runtime
262273

263274
This section describes how to navigate the **Rendering Debugger** interface at runtime.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changing lighting at runtime
2+
3+
You can change how objects use the baked data in Adaptive Probe Volumes, to create lighting that changes at runtime. For example, you can turn the lights on and off in a scene, or change the time of day.
4+
5+
| Page | Description |
6+
|-|-|
7+
| [Choose how to change lighting at runtime](probevolumes-understand-changing-lighting-at-runtime.md) | Choose whether to use Lighting Scenarios or sky occlusion. |
8+
| [Bake different lighting setups with Lighting Scenarios](probevolumes-bakedifferentlightingsetups.md) | Use multiple Lighting Scenarios to store baking results for different scene setups, and switch or blend between them at runtime. |
9+
| [Update light from the sky at runtime with sky occlusion](probevolumes-skyocclusion.md) | Sky occlusion means that when a GameObject samples a color from the sky, Unity dims the color if the light can't reach the GameObject. |

Packages/com.unity.render-pipelines.universal/Documentation~/probevolumes-adjustment-volume-component-reference.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,29 @@ Refer to the following for more information about using the Probe Adjustment Vol
3535
<td colspan="2">
3636
<p>Select how to override probes inside the Adjustment Volume.</p>
3737
<ul>
38-
<li><strong>Invalidate Probes:</strong> Mark selected probes as invalid. Refer to <a href="probevolumes-fixissues.md#how-light-probe-validity-works">How light probe validity works</a> for more information.</li>
39-
<li><strong>Override Validity Threshold:</strong> Override the threshold URP uses to determine whether Light Probes are marked as invalid. Refer to <a href="probevolumes-fixissues.md#adjust-dilation">Adjust Dilation</a> for more information.</li>
40-
<li><strong>Apply Virtual Offset:</strong> Change the position Light Probes use when sampling the lighting in the scene during baking. Refer to <a href="probevolumes-fixissues.md#adjust-virtual-offset">Adjust Virtual Offset</a> for more information.</li>
41-
<li><strong>Override Virtual Offset Settings:</strong> Override the biases URP uses during baking to determine when Light Probes use Virtual Offset, and calculate sampling positions. Refer to <a href="probevolumes-fixissues.md#adjust-virtual-offset">Adjust Virtual Offset</a> for more information</li>
42-
<li><strong>Intensity Scale:</strong> Override the intensity of probes to brighten or darken affected areas.</li>
38+
<li><strong>Invalidate Probes</strong> Mark selected probes as invalid. Refer to <a href="probevolumes-fixissues.md#how-light-probe-validity-works">How light probe validity works</a> for more information.</li>
39+
<li><strong>Override Validity Threshold</strong> Override the threshold URP uses to determine whether Light Probes are marked as invalid. Refer to <a href="probevolumes-fixissues.md#adjust-dilation">Adjust Dilation</a> for more information.</li>
40+
<li><strong>Apply Virtual Offset</strong> Change the position Light Probes use when sampling the lighting in the scene during baking. Refer to <a href="probevolumes-fixissues.md#adjust-virtual-offset">Adjust Virtual Offset</a> for more information.</li>
41+
<li><strong>Override Virtual Offset Settings</strong> Override the biases URP uses during baking to determine when Light Probes use Virtual Offset, and calculate sampling positions. Refer to <a href="probevolumes-fixissues.md#adjust-virtual-offset">Adjust Virtual Offset</a> for more information</li>
42+
<li><strong>Intensity Scale</strong> Override the intensity of probes to brighten or darken affected areas.</li>
43+
<li><strong>Override Sky Direction</strong> Override the directions Unity uses to sample the ambient probe, if you enable <a href="probevolumes-skyocclusion.md">sky occlusion</a>.</li>
44+
<li><strong>Override Sample Count:</strong> Override the number of samples Unity uses for Adaptive Probe Volumes.</li>
4345
</ul>
4446
</td>
4547
</tr>
48+
</tbody>
49+
</table>
50+
51+
### Mode settings
52+
53+
<table>
54+
<thead>
55+
<tr>
56+
<th><strong>Property</strong></th>
57+
<th colspan="2"><strong>Description</strong></th>
58+
</tr>
59+
</thead>
60+
<tbody>
4661
<tr>
4762
<td><strong>Dilation Validity Threshold</strong></td>
4863
<td colspan="2">
@@ -78,5 +93,41 @@ Refer to the following for more information about using the Probe Adjustment Vol
7893
<p>Change the brightness of all probes covered by the Probe Volumes Adjustment Volume component. Use this sparingly, because changing the intensity of probe data can lead to inconsistencies in the lighting. This option only appears if you set <strong>Mode</strong> to <strong>Intensity Scale</strong>.</p>
7994
</td>
8095
</tr>
96+
<tr>
97+
<td><strong>Sky Direction</strong></td>
98+
<td colspan="2">
99+
<p>Set the direction Unity uses to sample the ambient probe. This option only appears if you set <strong>Mode</strong> to <strong>Override Sky Direction</strong>.</p>
100+
</td>
101+
</tr>
102+
<tr>
103+
<td rowspan="5"><strong>Probes</strong></td>
104+
</tr>
105+
<tr>
106+
<td><strong>Direct Sample Count</strong></td>
107+
<td>Set the number of samples Unity uses to calculate the direct light each probe stores. This option only appears if you set <strong>Mode</strong> to <strong>Override Sample Count</strong>.</td>
108+
</tr>
109+
<tr>
110+
<td><strong>Indirect Sample Count</strong></td>
111+
<td>Set the number of samples Unity uses to calculate the indirect light each probe stores, including environment samples. This option only appears if you set <strong>Mode</strong> to <strong>Override Sample Count</strong>.</td>
112+
</tr>
113+
<tr>
114+
<td><strong>Sample Count Multiplier</strong></td>
115+
<td>Set the value Unity multiplies <strong>Direct Sample Count</strong> and <strong>Indirect Sample Count</strong> by. This option only appears if you set <strong>Mode</strong> to <strong>Override Sample Count</strong>.</td>
116+
</tr>
117+
<tr>
118+
<td><strong>Max Bounces</strong></td>
119+
<td>Set the number of times Unity bounces light off objects. This option only appears if you set <strong>Mode</strong> to <strong>Override Sample Count</strong>.</td>
120+
</tr>
121+
<tr>
122+
<td colspan="1" rowspan="10"><strong>Sky Occlusion</strong></td>
123+
</tr>
124+
<tr>
125+
<td><strong>Sample Count</strong></td>
126+
<td>Set the number of samples Unity uses to calculate the amount of light each probe receives from the sky, if you enable <a href="probevolumes-skyocclusion.md">sky occlusion</a>. This option only appears if you set <strong>Mode</strong> to <strong>Override Sample Count</strong>.</td>
127+
</tr>
128+
<tr>
129+
<td><strong>Max Bounces</strong></td>
130+
<td>Set the number of times Unity bounces light from the sky off objects to calculate the sky occlusion data, if you enable <a href="probevolumes-skyocclusion.md">sky occlusion</a>. This option only appears if you set <strong>Mode</strong> to <strong>Override Sample Count</strong>.</td>
131+
</tr>
81132
</tbody>
82133
</table>
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# Bake different lighting setups with Lighting Scenarios
2+
3+
A Lighting Scenario contains the baked lighting data for a scene or Baking Set. You can bake different lighting setups into different Lighting Scenario assets, and change which one the Universal Render Pipeline (URP) uses at runtime.
4+
5+
For example, you can create one Lighting Scenario with the lights on, and another Lighting Scenario with the lights off. At runtime, you can enable the second Lighting Scenario when the player turns the lights off.
6+
7+
## Enable Lighting Scenarios
8+
9+
To use Lighting Scenarios, go to the active [URP Asset](universalrp-asset.md) and enable **Lighting** > **Light Probe Lighting** > **Lighting Scenarios**.
10+
11+
## Add a Lighting Scenario
12+
13+
To create a new Lighting Scenario so you can store baking results inside, do the following:
14+
15+
1. Open the [Adaptive Probe Volumes panel](probevolumes-lighting-panel-reference.md) in the Lighting window.
16+
2. In the **Lighting Scenarios** section, select the **Add** (**+**) button to add a Lighting Scenario.
17+
18+
## Bake into a Lighting Scenario
19+
20+
To bake into a Lighting Scenario, follow these steps:
21+
22+
1. In the **Lighting Scenarios** section, select a Lighting Scenario to make it active.
23+
2. Select **Generate Lighting**. URP stores the baking results in the active Lighting Scenario.
24+
25+
You can set which Lighting Scenario URP uses at runtime using the [ProbeReferenceVolume API](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Rendering.ProbeReferenceVolume.html).
26+
27+
If you change the active Lighting Scenarios at runtime, URP changes only the indirect lighting data in the Light Probes. You might still need to use scripts to move geometry, modify lights or change direct lighting.
28+
29+
## Blend between Lighting Scenarios
30+
31+
To enable blending between Lighting Scenarios, go to the active [URP Asset](universalrp-asset.md) and enable **Light Probe Lighting** > **Scenario Blending**.
32+
33+
You can blend between Lighting Scenarios at runtime using the [BlendLightingScenario API](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Rendering.ProbeReferenceVolume.html#UnityEngine_Rendering_ProbeReferenceVolume_BlendLightingScenario_System_String_System_Single_).
34+
35+
For example, the following script does the following:
36+
37+
1. Sets `scenario01` as the active Lighting Scenario.
38+
2. Sets up the number of cells to blend per frame, which can be useful for optimization purposes.
39+
3. Updates the Adaptive Probe Volume blending factor every frame to blend between `scenario01` and `scenario02`.
40+
41+
```
42+
using System.Collections;
43+
using System.Collections.Generic;
44+
using UnityEngine;
45+
46+
public class BlendLightingScenarios : MonoBehaviour
47+
{
48+
UnityEngine.Rendering.ProbeReferenceVolume probeRefVolume;
49+
public string scenario01 = "Scenario01Name";
50+
public string scenario02 = "Scenario02Name";
51+
[Range(0, 1)] public float blendingFactor = 0.5f;
52+
[Min(1)] public int numberOfCellsBlendedPerFrame = 10;
53+
54+
void Start()
55+
{
56+
probeRefVolume = UnityEngine.Rendering.ProbeReferenceVolume.instance;
57+
probeRefVolume.lightingScenario = scenario01;
58+
probeRefVolume.numberOfCellsBlendedPerFrame = numberOfCellsBlendedPerFrame;
59+
}
60+
61+
void Update()
62+
{
63+
probeRefVolume.BlendLightingScenario(scenario02, blendingFactor);
64+
}
65+
}
66+
```
67+
68+
### Preview blending between Lighting Scenarios
69+
70+
You can use the [Rendering Debugger](features/rendering-debugger.md#probe-volume-panel) to preview transitions between Lighting Scenarios. Follow these steps:
71+
72+
1. Go to **Window** > **Analysis** > **Rendering Debugger** to open the Rendering Debugger.
73+
2. Set **Scenario Blend Target** to a Lighting Scenario.
74+
3. Use **Scenario Blending Factor** to check the effect of blending between the Lighting Scenarios in the Scene view.
75+
76+
### Keep Light Probes the same in different Lighting Scenarios
77+
78+
If you move static geometry between bakes, Light Probe positions might be different. This means you can't blend between Lighting Scenarios, because the number of Light Probes and their positions must be the same in each Lighting Scenario you blend between.
79+
80+
To avoid this, you can prevent URP recomputing probe positions when you bake. Follow these steps:
81+
82+
1. Bake one Lighting Scenario.
83+
2. Set another Lighting Scenario as the active Lighting Scenario.
84+
3. Change your scene lighting or geometry.
85+
4. In the **Probe Placement** section, set **Probe Positions** to **Don't Recalculate**.
86+
5. Select **Generate Lighting** to recompute only the indirect lighting, and skip the probe placement computations.
87+
88+
## Additional resources
89+
90+
- [ProbeReferenceVolume API](https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.Rendering.ProbeReferenceVolume.html)
91+
- [Bake multiple scenes together with Baking Sets](probevolumes-usebakingsets.md)

0 commit comments

Comments
 (0)