diff --git a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2501_LightLayers/2505_LightLayers_RT.renderTexture b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2501_LightLayers/2505_LightLayers_RT.renderTexture
index 9f63a52008b..3c46fcc8480 100644
--- a/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2501_LightLayers/2505_LightLayers_RT.renderTexture
+++ b/TestProjects/HDRP_Tests/Assets/GraphicTests/Scenes/2x_Lighting/2501_LightLayers/2505_LightLayers_RT.renderTexture
@@ -12,13 +12,14 @@ RenderTexture:
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
+ m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 512
m_Height: 512
m_AntiAliasing: 1
m_MipCount: -1
m_DepthFormat: 0
- m_ColorFormat: 40
+ m_ColorFormat: 52
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2501_LightLayers.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2501_LightLayers.png
index e7ec1952d52..fa1eaa2d2fd 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2501_LightLayers.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/LinuxEditor/Vulkan/None/2501_LightLayers.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:d662de9130358f72eabbaa9c26e2840f3fc52f2305510812cfe2b329e1a7fd59
-size 110587
+oid sha256:5ac2fa0e186663b4b273f2f0f10ec844a30f09612ee95e12588c13ae952e3715
+size 119887
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1219_Lit_Light_on_Tesselation.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1219_Lit_Light_on_Tesselation.png
index bb374607740..daf5eb8e320 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1219_Lit_Light_on_Tesselation.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1219_Lit_Light_on_Tesselation.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:dd312b3a7e05b3a2ce76d93ca7e5609a922475a693fe915faedaf200a4f1565d
-size 178866
+oid sha256:d8a75b24c673cb7fb494d7563d77eb21168d5d71299c1d85c62e9e0b43474f84
+size 179023
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1550_3dsMax.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1550_3dsMax.png
index 009b9582e2b..2540947290a 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1550_3dsMax.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1550_3dsMax.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:20deceb4023a54291028dac962d2569f84bf3b974d0ed0ab010d5ac81c4cbcd8
-size 168638
+oid sha256:f782e5a9bb710dcbf2d078e983b9e2baff4817537e155ad3de355ae7f3401dda
+size 150550
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_a.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_a.png
index d8237edb267..abe7039b434 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_a.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_a.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:a1c2e432a1a9c07375c31c03f6f49d897dbb5a46c5172e233d0f0a93a7813a44
-size 299544
+oid sha256:9afae5f6ce938096afb3c2ae77935a01002c823fd2a7ebe84eaa5093d2f1b69e
+size 258203
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_b.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_b.png
index af88333cd6d..b2a3e2f4b5b 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_b.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/1900_AlphaTest_SG_b.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:8ba80736ac18be9a978452c18044f8e31a9fd729e4f94b6043d6309f2dff2f74
-size 4270
+oid sha256:521b6fc608d37c31a9a6e42091a900bb7f2da11f4b2434ef880368cce75a8044
+size 258776
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2010_IES_Cookies.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2010_IES_Cookies.png
index 2cb4a3303cb..2a1f5a52fc2 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2010_IES_Cookies.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2010_IES_Cookies.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:8bfdeb6df0436f99533f01e4ea5878bd7f3ca03009e08d667d8f1883abda2807
-size 184623
+oid sha256:086d8796219ad0624f6a2e67388c5b8846b882b04a0ab3cfebfcd36369b54c8b
+size 200097
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2501_LightLayers.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2501_LightLayers.png
index 0eb841d3201..ad173572fd5 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2501_LightLayers.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/OSXEditor/Metal/None/2501_LightLayers.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:c9bbf8f4ba6662e31863773a092788127220a9c810eea35e4262398909eadf2f
-size 10498
+oid sha256:1e689a7764ea548e3bbe3364e2a1dcd4bcffe471ffe69cec6b66f95f7c944632
+size 118324
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2501_LightLayers.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2501_LightLayers.png
index 57cfba12d6d..53ed2fb401d 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2501_LightLayers.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2501_LightLayers.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:2ffce1e57c5ecd041af5843f811ec7e5b32fbaa62fcddc138fd70df0eb453757
-size 120071
+oid sha256:f497330fc7d649a618f6dd48bbdcf843de6e5be3a615dfe911f5a9f9ec71e795
+size 120123
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2501_LightLayers.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2501_LightLayers.png
index d895ae94ef0..f13bac9cda0 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2501_LightLayers.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D12/None/2501_LightLayers.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:f14f7974f2d7de4920a01fa11ceb5cbfe709dedfc436395938c702133af232f8
-size 119834
+oid sha256:455e7a078f043bc9badabe420838aa311a461e115361478d00dde48c3091285e
+size 119915
diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2501_LightLayers.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2501_LightLayers.png
index b2ad0835538..e5c36c82e07 100644
--- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2501_LightLayers.png
+++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Vulkan/None/2501_LightLayers.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:0d177591f1ab29dee34633b433d96daf800a8b60a16aa23fdb905cd32c3128b5
-size 110407
+oid sha256:4c3412f12e2143c4eeb36b954fb5ed351c79b522032856461ac400262084ae5a
+size 120124
diff --git a/TestProjects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset b/TestProjects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset
index 1a3071e41f6..00dedc03daf 100644
--- a/TestProjects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset
+++ b/TestProjects/HDRP_Tests/Assets/Tests/TestFilters/TestCaseFilters.asset
@@ -22,15 +22,6 @@ MonoBehaviour:
XrSdk:
StereoModes: 0
Reason: Fail on DX12 XR but not DX12...
- - FilteredScene: {fileID: 0}
- FilteredScenes:
- - {fileID: 102900000, guid: 3f6529c22f7d2ca46814b2e7afd04ef9, type: 3}
- ColorSpace: 1
- BuildPlatform: -2
- GraphicsDevice: 16
- XrSdk:
- StereoModes: 0
- Reason: unstable on yamato
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: a43874f539bb5494e86fdea5ac9df469, type: 3}
@@ -76,25 +67,6 @@ MonoBehaviour:
XrSdk:
StereoModes: 0
Reason: Disable this test as we disable the feature for Yamto on Mac
- - FilteredScene: {fileID: 0}
- FilteredScenes:
- - {fileID: 102900000, guid: c566b460a3674184da6c102196a1a888, type: 3}
- ColorSpace: 1
- BuildPlatform: -2
- GraphicsDevice: 16
- XrSdk:
- StereoModes: 0
- Reason: '[Error] Metal: Error creating pipeline state (Hidden/HDRP/Blit): output
- of type float4 is not compatible with a MTLPixelFormatRGBA32Uint color attachement.'
- - FilteredScene: {fileID: 0}
- FilteredScenes:
- - {fileID: 102900000, guid: 2486b40270d6e524d8762a9d2a0c1e78, type: 3}
- ColorSpace: 1
- BuildPlatform: -2
- GraphicsDevice: 16
- XrSdk:
- StereoModes: 0
- Reason: Memory allocation test failed, 5 allocations detected.
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: ac9787fadf0b4ed4391bee6ba1d8e213, type: 3}
@@ -176,15 +148,6 @@ MonoBehaviour:
XrSdk:
StereoModes: 0
Reason: unstable on yamato
- - FilteredScene: {fileID: 0}
- FilteredScenes:
- - {fileID: 102900000, guid: 100c0e304d8aba84186dcd9bf48e5b85, type: 3}
- ColorSpace: 1
- BuildPlatform: -2
- GraphicsDevice: 16
- XrSdk:
- StereoModes: 0
- Reason: Memory allocation test failed, 2 allocations detected.
- FilteredScene: {fileID: 0}
FilteredScenes:
- {fileID: 102900000, guid: 95280217564a80c45916bbb33c3159fb, type: 3}
diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md
index 4f42e3b0dc6..4b307855adf 100644
--- a/com.unity.render-pipelines.high-definition/CHANGELOG.md
+++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md
@@ -24,6 +24,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added support for the PlayStation 5 platform.
- Added support the XboxSeries platform.
- Added the default quality settings to the HDRP asset for RTAO, RTR and RTGI (case 1304370).
+- Added a history rejection criterion based on if the pixel was moving in world space (case 1302392).
+- Added new API in CachedShadowManager
### Fixed
- Fixed probe volumes debug views.
@@ -89,6 +91,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed lightmaps not working properly with shader graphs in ray traced reflections (case 1305335).
- Fixed skybox for ortho cameras.
- Fixed issue when debug full screen 'Transparent Screen Space Reflection' do not take in consideration debug exposure
+- Fixed sub-shadow rendering for cached shadow maps.
+- Fixed PCSS filtering issues with cached shadow maps.
+- Fix screen being over-exposed when changing very different skies.
### Changed
- Removed the material pass probe volumes evaluation mode.
@@ -112,6 +117,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Change some light unit slider value ranges to better reflect the lighting scenario.
- Transparent materials created by the Model Importer are set to not cast shadows. ( case 1295747)
- Updated the tooltip for the Decal Angle Fade property (requires to enable Decal Layers in both HDRP asset and Frame settings) (case 1308048).
+- The RTAO's history is now discarded if the occlusion caster was moving (case 1303418).
+- Unifying the history validation pass so that it is only done once for the whole frame and not per effect.
+- Tidy up of platform abstraction code for shader optimization.
## [10.3.0] - 2020-12-01
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Customizing-HDRP-materials-with-Shader-Graph.md b/com.unity.render-pipelines.high-definition/Documentation~/Customizing-HDRP-materials-with-Shader-Graph.md
index bff2aca766e..59f03a4458a 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Customizing-HDRP-materials-with-Shader-Graph.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Customizing-HDRP-materials-with-Shader-Graph.md
@@ -24,7 +24,7 @@ The [Lit](Lit-Shader.md), [LayeredLit](Layered-Lit-Shader.md), and [Unlit](Unlit
To create a Material that uses a Shader Graph (for example, a StackLit Graph), follow these steps:
1. Create a Shader with the Shader Graph that you want the Material to use.
- 1. Go to **Assets > Create > Shader > HDRP** to find the list of HDRP Shader Graphs. For this example, click **StackLit Graph**.
+ 1. Go to **Assets > Create > Shader Graph > HDRP** to find the list of HDRP Shader Graphs. For this example, click **StackLit Graph**.
1. Give the Shader Graph a unique name. This is important, because you need to reference this Shader Graph in the Material.
1. Create a Material from the Shader.
1. In your Project window, find the Shader that you just created and right-click it.
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md b/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md
index 65b6e212e09..9efc4059c27 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Decal-Projector.md
@@ -1,6 +1,6 @@
# Decal Projector
-The High Definition Render Pipeline (HDRP) includes the Decal Projector component, which allows you to project specific Materials (decals) into the Scene. Decals are Materials that use the [Decal Shader](Decal-Shader.md) or [Decal master node](Master-Node-Decal.md). When the Decal Projector component projects decals into the Scene, they interact with the Scene’s lighting and wrap around Meshes. You can use thousands of decals in your Scene simultaneously because HDRP instances them. This means that the rendering process is not resource intensive as long as the decals use the same Material.
+The High Definition Render Pipeline (HDRP) includes the Decal Projector component, which allows you to project specific Materials (decals) into the Scene. Decals are Materials that use the [Decal Shader](Decal-Shader.md) or [Decal Master Stack](master-stack-decal.md). When the Decal Projector component projects decals into the Scene, they interact with the Scene’s lighting and wrap around Meshes. You can use thousands of decals in your Scene simultaneously because HDRP instances them. This means that the rendering process is not resource intensive as long as the decals use the same Material.
The Decal Projector also supports [Decal Layers](Decal.md) which means you can control which Materials receive decals on a Layer by Layer basis.
@@ -54,7 +54,7 @@ Using the Inspector allows you to change all of the Decal Projector properties,
## Limitations
-- The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal master node](Master-Node-Decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md).
+- The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md).
- Decal Emissive isn't supported on Transparent Material.
- The **Receive Decals** property of Materials in HDRP does not affect emissive decals. HDRP always renders emissive decals unless you use Decal Layers, which can disable emissive decals on a Layer by Layer basis.
- If you project a decal onto a transparent surface, HDRP ignores the decal's Texture tiling.
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Decal.md b/com.unity.render-pipelines.high-definition/Documentation~/Decal.md
index 73163074088..91d4e1bf3e9 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Decal.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Decal.md
@@ -1,13 +1,13 @@
# Decal
-The High Definition Render Pipeline (HDRP) includes two ways to create decals in a Scene. You can either use a decal Mesh and manually position the decal or use the [Decal Projector](Decal-Projector.md) component to project the decal. Both of these methods require that you create a decal Material, which is a Material that uses either the [Decal Shader](Decal-Shader.md) or [Decal master node](Master-Node-Decal.md). You can use either to create decal Materials that you can place or project into a Scene.
+The High Definition Render Pipeline (HDRP) includes two ways to create decals in a Scene. You can either use a decal Mesh and manually position the decal or use the [Decal Projector](Decal-Projector.md) component to project the decal. Both of these methods require that you create a decal Material, which is a Material that uses either the [Decal Shader](Decal-Shader.md) or [Decal Master Stack](master-stack-decal.md). You can use either to create decal Materials that you can place or project into a Scene.

**Limitation and compatibility**
-The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal master node](Master-Node-Decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md). It does not support emissive on Transparent Materials and does support Decal Layers.
-Decal Meshes can only affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal master node](Master-Node-Decal.md). They also do not support Decal Layers.
+The Decal Projector can affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). However, it can only affect transparent Materials with the [Decal Shader](Decal-Shader.md). It does not support emissive on Transparent Materials and does support Decal Layers.
+Decal Meshes can only affect opaque Materials with either a [Decal Shader](Decal-Shader.md) or a [Decal Master Stack](master-stack-decal.md). They also do not support Decal Layers.
# Decal Layers
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md b/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md
index 2703bab25ed..f4a1caab453 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Features.md
@@ -91,13 +91,13 @@ The StackLit Shader improves on the Lit Shader in favor of quality over performa

-The Hair Shader is purpose-built to accurately render realistic hair in your Unity Project. It uses an improved Kajiya Kay lighting model which features better energy conservation and provides you with more flexibility. For more information, including a full list of Shader properties, see the [Hair Shader documentation](Master-Node-Hair.md).
+The Hair Shader is purpose-built to accurately render realistic hair in your Unity Project. It uses an improved Kajiya Kay lighting model which features better energy conservation and provides you with more flexibility. For more information, including a full list of Shader properties, see the [Hair Shader](hair-shader.md) and [Hair Master Stack](master-stack-hair.md) documentation.
### Fabric Shader

-The Fabric Shader allows you to render realistic fabric Materials in HDRP. You can use the cotton wool or silk lighting model to create a wide variety of fabrics. For more information, including a full list of Shader properties, see the [Fabric Shader documentation](Master-Node-Fabric.md).
+The Fabric Shader allows you to render realistic fabric Materials in HDRP. You can use the cotton wool or silk lighting model to create a wide variety of fabrics. For more information, including a full list of Shader properties, see the [Cotton/Wool Shader](cotton-wool-shader.md), [Silk Shader](silk-shader.md), and [Fabric Master Stack](master-stack-fabric.md) documentation.
### AxF Shader
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md b/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md
index 9e435ac016f..2d487171786 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/HDRP-Sample-Content.md
@@ -30,7 +30,7 @@ This Sample includes various examples of lit and unlit particle effects.

-This Sample includes various examples of Materials. It includes Materials that use the [Lit Shader](Lit-Shader.md), [Fabric Master Node](Master-Node-Fabric.md), [Hair Master Node](Master-Node-Hair.md), [Eye Shader](eye-shader.md) and [Decal Master Node](Master-Node-Decal.md). The included Materials use effects such as subsurface scattering, displacement, and anisotropy. The **MaterialSamples** Scene requires Text Mesh Pro to display the text explanations.
+This Sample includes various examples of Materials. It includes Materials that use the [Lit Shader](Lit-Shader.md), [Fabric Master Stack](master-stack-fabric.md), [Hair Master Stack](master-stack-hair.md), [Eye Shader](eye-shader.md) and [Decal Master Stack](master-stack-decal.md). The included Materials use effects such as subsurface scattering, displacement, and anisotropy. The **MaterialSamples** Scene requires Text Mesh Pro to display the text explanations.
The Fabric, Hair and Eye Master Nodes usually require various work from artists inside the Shader Graph and the Samples are a good head start.
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Shadows.md b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Shadows.md
index a2ec2de6caa..13bac8a3757 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Shadows.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Shadows.md
@@ -65,7 +65,7 @@ Ray-traced shadows allow for transparent and transmissive GameObjects, lit by Di
| --------------------- | ------------------------------------------------------------ |
| **Sun Angle** | Sets the size of the Sun in the sky, in degrees. For example, the value for the Sun on Earth is 0.53°. |
| **Sample Count** | Controls the number of rays that HDRP uses per pixel, per frame. Higher values produce more accurate shadows. Increasing this value increases execution time linearly. |
-| **Color Shadow** | Allows transparent and transmissive GameObjects to cast colored shadows. |
+| **Color Shadow** | Allows transparent and transmissive GameObjects to cast colored shadows. A Material can only cast colored shadows when its [**Refraction Model**](Surface-Type.md#transparency-inputs) is set to **Thin**, **Box** or **Sphere**. |
| **Denoise** | Enables the spatio-temporal filter that HDRP uses to remove noise from the ray-traced shadows; making them smoother. |
| - **Denoiser Radius** | Controls the radius of the spatio-temporal filter. |
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Shadows-in-HDRP.md b/com.unity.render-pipelines.high-definition/Documentation~/Shadows-in-HDRP.md
index b3276df5e2e..420dfca1a11 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Shadows-in-HDRP.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Shadows-in-HDRP.md
@@ -132,6 +132,8 @@ If the shadow atlas is full when a Light requests a spot, the cached shadow mana
After a Scene loads with all the already placed Lights, if you add a new Light with cached shadows to the Scene, HDRP tries to place it in order to fill the holes in the atlas. However, depending on the order of insertion, the atlas may be fragmented and the holes available are not enough to place the Light's shadow map in. In this case, you can defragment the atlas to allow for additional Lights. To do this, pass the target atlas into the following function: `HDCachedShadowManager.instance.DefragAtlas`
Note that this causes HDRP to mark all the shadow maps in the atlas as dirty which means HDRP renders them the moment their parent Light becomes visible.
+It is possible to check if a light has its shadow maps has a placement in the cached shadow atlas `HDCachedShadowManager.instance.LightHasBeenPlacedInAtlas` and if it has been placed and rendered at least once with `HDCachedShadowManager.instance.LightHasBeenPlaceAndRenderedAtLeastOnce`.
+
### Preserving shadow atlas placement
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.
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md
index 1a0ba68b5e6..a3d39cd5ba1 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/TableOfContents.md
@@ -1,8 +1,8 @@
* [High Definition Render Pipeline](index.md)
* [Requirements](System-Requirements.md)
* [What's new](whats-new.md)
- * [10](whats-new-10.md)
- * [11](whats-new-11.md)
+ * [10 / Unity 2020.2](whats-new-10.md)
+ * [11 / Unity 2021.1](whats-new-11.md)
* Features
* [Features List](HDRP-Features.md)
* [Comparison with the Built-in Render Pipeline](Feature-Comparison.md)
@@ -95,7 +95,7 @@
* [Autodesk Interactive Transparent Shader](Autodesk-Interactive-Shader-Transparent.md)
* [AxF Shader](AxF-Shader.md)
* [Decal Shader](Decal-Shader.md)
- * [Cottom/Wool Shader](cotton-wool-shader.md)
+ * [Cotton/Wool Shader](cotton-wool-shader.md)
* [Eye Shader](eye-shader.md)
* [Hair Shader](hair-shader.md)
* [Layered Lit Shader](Layered-Lit-Shader.md)
@@ -104,13 +104,17 @@
* [Silk Shader](silk-shader.md)
* [Terrain Lit Shader](Terrain-Lit-Shader.md)
* [Unlit Shader](Unlit-Shader.md)
- * Shader Graph Master Nodes
- * [Customizing Materials Using Master Nodes](Customizing-HDRP-materials-with-Shader-Graph.md)
- * [Decal](Master-Node-Decal.md)
- * [Fabric](Master-Node-Fabric.md)
- * [Hair](Master-Node-Hair.md)
- * [Lit](Master-Node-Lit.md)
- * [Unlit](Master-Node-Unlit.md)
+ * [Master Stacks in HDRP](master-stack-hdrp.md)
+ * [Contexts and Blocks](ss-contexts-and-blocks.md)
+ * [Vertex](ss-context-vertex.md)
+ * [Fragment](ss-context-fragment.md)
+ * [Decal Master Stack](master-stack-decal.md)
+ * [Eye Master Stack](master-stack-eye.md)
+ * [Fabric Master Stack](master-stack-fabric.md)
+ * [Hair Master Stack](master-stack-hair.md)
+ * [Lit Master Stack](master-stack-lit.md)
+ * [StackLit Master Stack](master-stack-stacklit.md)
+ * [Unlit Master Stack](master-stack-unlit.md)
* [Shader Graph Nodes](Shader-Graph-Nodes.md)
* Lighting
* [Reflection in HDRP](Reflection-in-HDRP.md)
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/cotton-wool-shader.md b/com.unity.render-pipelines.high-definition/Documentation~/cotton-wool-shader.md
index b96cf56d438..6a76884a079 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/cotton-wool-shader.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/cotton-wool-shader.md
@@ -6,7 +6,7 @@ The type of fibers that make up the fabric, as well as the fabric's knit or weav

-Under the hood, the Cotton/Wool shader is a pre-configured Shader Graph. To learn more about the Cotton/Wool shader implementation, or to create your own Fabric shader variant, see the Shader Graph documentation about the [Fabric Master Node](Master-Node-Fabric.md).
+Under the hood, the Cotton/Wool shader is a pre-configured Shader Graph. To learn more about the Cotton/Wool shader implementation, or to create your own Fabric shader variant, see the Shader Graph documentation about the [Fabric Master Stack](master-stack-fabric.md).
## Importing the Cotton/Wool Fabric Sample
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/eye-shader.md b/com.unity.render-pipelines.high-definition/Documentation~/eye-shader.md
index f0d976ff34c..57f9a9f6679 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/eye-shader.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/eye-shader.md
@@ -3,7 +3,7 @@ The Eye Shader is your starting point for rendering eyes in the High Definition

-Under the hood, the Eye shader is a pre-configured Shader Graph. To learn more about the Eye shader implementation, or to create your own Eye shader variant, see the Shader Graph documentation about the [Eye Master Node](Master-Node-Eye.md).
+Under the hood, the Eye shader is a pre-configured Shader Graph. To learn more about the Eye shader implementation, or to create your own Eye shader variant, see the Shader Graph documentation about the [Eye Master Stack](master-stack-eye.md).
## Eye anatomy
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-decal.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-decal.md
new file mode 100644
index 00000000000..9b2b63b0737
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-decal.md
@@ -0,0 +1,84 @@
+# Decal
+
+The Decal Master Stack material type enables you to author decals that you can [project](Decal-Projector.md) or place into your Scene. The Decal Master Stack material type is similar to the standard [Decal Shader](Decal-Shader.md), except that you cannot use this version to author decals projected on transparent materials.
+
+
+
+
+
+## Creating a Decal Shader Graph
+
+To create a Decal material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button, and select **HDRP**.
+ 3. In the **Material** drop-down, select **Decal**.
+
+* Create a new Shader Graph.
+ 1. Go to **Assets > Create >Shader Graph > HDRP** and click **Decal Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Decal Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-alpha.md)]
+[!include[](snippets/shader-graph-blocks/metallic.md)]
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/maos-alpha.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Fragment Blocks to the Fragment Context by default and has no extra relevant Blocks.
+
+## Graph Settings
+
+### Surface Options
+
+| **Setting** | **Description** |
+| ---------------------------- | ------------------------------------------------------------ |
+| **Affect BaseColor** | Indicates whether the decal shader affects the base color of materials it is projected or placed on. |
+| **Affect Normal** | Indicates whether the decal shader affects the normals of GameObjects it is projected or placed on. When enabled, the shader uses the **Normal** Block to override the receiving Material's normals. |
+| **Affect Metal** | Indicates whether the decal shader affects the metallic property of materials it is projected or placed on. When enabled, the shader uses the **Metallic** Block to override the receiving Material's metallic property. |
+| **Affect Ambient Occlusion** | Indicates whether the decal shader affects the ambient occlusion property of materials it is projected or placed on. When enabled, the shader uses the **Ambient Occlusion** Block to override the receiving Material's ambient occlusion. |
+| **Affect Smoothness** | Indicates whether the decal shader affects the smoothness property of materials it is projected or placed on. When enabled, the shader uses the **Smoothness** Block to override the receiving Material's smoothness property. |
+| **Affect Emissive** | Indicates whether the decal shader affects the emission property of materials it is projected or placed on. When enabled, the shader uses the **Emission** Block to override the receiving Material's emission property. Emissive Materials appear self-illuminated and act as a visible source of light. This property does not work with receiving Materials that are transparent. |
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-eye.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-eye.md
new file mode 100644
index 00000000000..fc3e36013ad
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-eye.md
@@ -0,0 +1,148 @@
+# Eye
+
+The Eye Master Stack enables you to render custom physically-based eye materials in the High Definition Render Pipeline (HDRP). It models a two-layer material, in which the first layer describes the cornea and fluids on the surface, and the second layer describes the sclera and the iris, visible through the first layer. It supports various effects, such as cornea refraction, caustics, pupil dilation, limbal darkening, and subsurface scattering.
+
+
+
+## Creating an Eye Shader Graph
+
+To create an Eye material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button, and select **HDRP**.
+ 3. In the **Material** drop-down, select **Eye**.
+
+* Create a new Shader Graph.
+ 1. Go to **Assets > Create > Shader Graph > HDRP** and click **Eye Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+When you create a new Eye Master Stack, the Vertex Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Eye Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/bent-normal.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/ior.md)]
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/mask.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+
+
+#### Relevant
+
+Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add the following Blocks to the Fragment Context:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/baked-back-gi.md)]
+[!include[](snippets/shader-graph-blocks/baked-gi.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/diffusion-profile.md)]
+[!include[](snippets/shader-graph-blocks/iris-normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/iris-normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/iris-normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-screen-space-variance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/subsurface-mask.md)]
+
+
+## Graph Settings
+
+### Surface Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/surface-options/eye-material-type.md)]
+[!include[](snippets/shader-properties/surface-options/recursive-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/surface-type.md)]
+[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
+[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
+[!include[](snippets/shader-properties/surface-options/receive-fog.md)]
+[!include[](snippets/shader-properties/surface-options/depth-test.md)]
+[!include[](snippets/shader-properties/surface-options/depth-write.md)]
+[!include[](snippets/shader-properties/surface-options/cull-mode.md)]
+[!include[](snippets/shader-properties/surface-options/sorting-priority.md)]
+[!include[](snippets/shader-properties/surface-options/back-then-front-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-prepass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-postpass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-writes-motion-vectors.md)]
+[!include[](snippets/shader-properties/surface-options/preserve-specular-lighting.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-clipping.md)]
+[!include[](snippets/shader-properties/surface-options/use-shadow-threshold.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-to-mask.md)]
+[!include[](snippets/shader-properties/surface-options/double-sided-mode.md)]
+[!include[](snippets/shader-properties/surface-options/fragment-normal-space.md)]
+[!include[](snippets/shader-properties/surface-options/receive-decals.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr-transparent.md)]
+[!include[](snippets/shader-properties/surface-options/geometric-specular-aa.md)]
+[!include[](snippets/shader-properties/surface-options/ss-depth-offset.md)]
+[!include[](snippets/shader-properties/surface-options/subsurface-scattering.md)]
+[!include[](snippets/shader-properties/surface-options/iris-normal.md)]
+
+
+### Advanced Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/advanced-options/specular-occlusion-mode.md)]
+[!include[](snippets/shader-properties/advanced-options/override-baked-gi.md)]
+[!include[](snippets/shader-properties/advanced-options/support-lod-crossfade.md)]
+[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-fabric.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-fabric.md
new file mode 100644
index 00000000000..3252e987cf3
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-fabric.md
@@ -0,0 +1,153 @@
+# Fabric
+
+The Fabric Master Stack enables you to render various types of fabric in the High Definition Render Pipeline (HDRP). It uses either cotton wool or anisotropic silk as its base, and supports various additional effects such as [Subsurface Scattering](Subsurface-Scattering.md) to create realistic looking fabrics.
+
+
+
+## Creating a Fabric Shader Graph
+
+To create a Fabric material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button, and select **HDRP**.
+ 3. In the **Material** drop-down, select **Fabric**.
+
+* Create a new Shader Graph.
+ 1. Go to **Assets > Create > Shader Graph > HDRP** and click **Fabric Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+When you create a new Fabric Master Stack, the Vertex Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Fabric Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/bent-normal.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/specular-color.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+
+
+#### Relevant
+
+Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add the following Blocks to the Fragment Context:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/anisotropy.md)]
+[!include[](snippets/shader-graph-blocks/baked-back-gi.md)]
+[!include[](snippets/shader-graph-blocks/baked-gi.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/diffusion-profile.md)]
+[!include[](snippets/shader-graph-blocks/normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-screen-space-variance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-color.md)]
+[!include[](snippets/shader-graph-blocks/specular-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/subsurface-mask.md)]
+[!include[](snippets/shader-graph-blocks/tangent-object-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-world-space.md)]
+[!include[](snippets/shader-graph-blocks/thickness.md)]
+
+
+## Graph Settings
+
+### Surface Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/surface-options/fabric-material-type.md)]
+[!include[](snippets/shader-properties/surface-options/surface-type.md)]
+[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
+[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
+[!include[](snippets/shader-properties/surface-options/receive-fog.md)]
+[!include[](snippets/shader-properties/surface-options/depth-test.md)]
+[!include[](snippets/shader-properties/surface-options/depth-write.md)]
+[!include[](snippets/shader-properties/surface-options/cull-mode.md)]
+[!include[](snippets/shader-properties/surface-options/sorting-priority.md)]
+[!include[](snippets/shader-properties/surface-options/back-then-front-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-prepass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-postpass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-writes-motion-vectors.md)]
+[!include[](snippets/shader-properties/surface-options/preserve-specular-lighting.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-clipping.md)]
+[!include[](snippets/shader-properties/surface-options/use-shadow-threshold.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-to-mask.md)]
+[!include[](snippets/shader-properties/surface-options/double-sided-mode.md)]
+[!include[](snippets/shader-properties/surface-options/fragment-normal-space.md)]
+[!include[](snippets/shader-properties/surface-options/receive-decals.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr-transparent.md)]
+[!include[](snippets/shader-properties/surface-options/geometric-specular-aa.md)]
+[!include[](snippets/shader-properties/surface-options/ss-depth-offset.md)]
+[!include[](snippets/shader-properties/surface-options/subsurface-scattering.md)]
+[!include[](snippets/shader-properties/surface-options/transmission.md)]
+
+
+### Advanced Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/advanced-options/specular-occlusion-mode.md)]
+[!include[](snippets/shader-properties/advanced-options/override-baked-gi.md)]
+[!include[](snippets/shader-properties/advanced-options/support-lod-crossfade.md)]
+[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
+
+
+## Limitations
+
+[!include[](snippets/area-light-material-support-disclaimer.md)]
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-hair.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-hair.md
new file mode 100644
index 00000000000..aed484b3313
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-hair.md
@@ -0,0 +1,147 @@
+# Hair
+
+The Hair Master Stack enables you to render hair and fur in the High Definition Render Pipeline (HDRP). To create a realistic looking hair effect, it uses layers called hair cards. Each hair card represents a different section of hair. If you use semi-transparent hair cards, you must manually sort them so that they are in back-to-front order from every viewing direction.
+
+
+
+## Creating a Hair Shader Graph
+
+To create a Hair material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button, and select **HDRP**.
+ 3. In the **Material** drop-down, select **Hair**.
+
+* Create a new Shader Graph.
+ 1. Go to **Assets > Create >Shader Graph > HDRP** and click **Hair Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+When you create a new Hair Master Stack, the Vertex Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Hair Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/bent-normal.md)]
+[!include[](snippets/shader-graph-blocks/hair-strand-direction.md)]
+[!include[](snippets/shader-graph-blocks/transmittance.md)]
+[!include[](snippets/shader-graph-blocks/rim-transmission-intensity.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+[!include[](snippets/shader-graph-blocks/specular-tint.md)]
+[!include[](snippets/shader-graph-blocks/specular-shift.md)]
+[!include[](snippets/shader-graph-blocks/secondary-specular-tint.md)]
+[!include[](snippets/shader-graph-blocks/secondary-specular-shift.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+
+
+#### Relevant
+
+Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add the following locks to the Fragment Context:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/baked-back-gi.md)]
+[!include[](snippets/shader-graph-blocks/baked-gi.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-screen-space-variance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-occlusion.md)]
+
+
+## Graph Settings
+
+### Surface Options
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/surface-options/surface-type.md)]
+[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
+[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
+[!include[](snippets/shader-properties/surface-options/receive-fog.md)]
+[!include[](snippets/shader-properties/surface-options/depth-test.md)]
+[!include[](snippets/shader-properties/surface-options/depth-write.md)]
+[!include[](snippets/shader-properties/surface-options/cull-mode.md)]
+[!include[](snippets/shader-properties/surface-options/sorting-priority.md)]
+[!include[](snippets/shader-properties/surface-options/back-then-front-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-prepass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-postpass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-writes-motion-vectors.md)]
+[!include[](snippets/shader-properties/surface-options/preserve-specular-lighting.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-clipping.md)]
+[!include[](snippets/shader-properties/surface-options/use-shadow-threshold.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-to-mask.md)]
+[!include[](snippets/shader-properties/surface-options/double-sided-mode.md)]
+[!include[](snippets/shader-properties/surface-options/fragment-normal-space.md)]
+[!include[](snippets/shader-properties/surface-options/receive-decals.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr-transparent.md)]
+[!include[](snippets/shader-properties/surface-options/geometric-specular-aa.md)]
+[!include[](snippets/shader-properties/surface-options/ss-depth-offset.md)]
+
+
+### Advanced Options
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/advanced-options/specular-occlusion-mode.md)]
+[!include[](snippets/shader-properties/advanced-options/override-baked-gi.md)]
+[!include[](snippets/shader-properties/advanced-options/support-lod-crossfade.md)]
+[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
+[!include[](snippets/shader-properties/advanced-options/use-light-facing-normal.md)]
+
+
+## Limitations
+
+[!include[](snippets/area-light-material-support-disclaimer.md)]
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-hdrp.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-hdrp.md
new file mode 100644
index 00000000000..e4d1b30d8d1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-hdrp.md
@@ -0,0 +1,17 @@
+# Master Stacks in HDRP
+
+Shader Graphs in the High Definition Render Pipelines (HDRP) have an HDRP-specific section in the [Graph Settings menu](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Graph-Settings-Menu.html). In the **HDRP** section, you can edit settings relevant for building the final HDRP shader. The **Material** property specifies the type of shader to build, and the settings available in the Graph Settings menu change depending on the option you select. When the available settings change, Shader Graph adds relevant [Blocks](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Block-Node.html) to the [Contexts](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Master-Stack.html%23contexts) in the graph.
+
+This documentation begins with an introduction to the Shader Graph Contexts and Blocks available in HDRP:
+
+* [Contexts and Blocks](ss-contexts-and-blocks.md)
+
+It then describes the HDRP-specific material types you can create with Shader Graph. Each material type page contains information on which settings the material type adds to the Graph Settings menu, and which Blocks the material type adds to the Master Stack by default. The list of material type pages is as follows:
+
+* [Decal Master Stack](master-stack-decal.md)
+* [Eye Master Stack](master-stack-eye.md)
+* [Fabric Master Stack](master-stack-fabric.md)
+* [Hair Master Stack](master-stack-hair.md)
+* [Lit Master Stack](master-stack-lit.md)
+* [StackLit Master Stack](master-stack-stacklit.md)
+* [Unlit Master Stack](master-stack-unlit.md)
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-lit.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-lit.md
new file mode 100644
index 00000000000..a59ba3c8202
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-lit.md
@@ -0,0 +1,174 @@
+# Lit
+
+The Lit Master Stack enables you to render custom physically-based materials in the High Definition Render Pipeline (HDRP). It supports various effects, such as subsurface scattering, anisotropy, iridescence, specular color and translucency.
+
+
+
+## Creating a Lit Shader Graph
+
+To create a Lit material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button, and select **HDRP**.
+ 3. In the **Material** drop-down, select **Lit**.
+
+* Create a new Shader Graph.
+ 1. Go to **Assets > Create >Shader Graph > HDRP** and click **Lit Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+When you create a new Lit Master Stack, the Vertex Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Lit Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/bent-normal.md)]
+[!include[](snippets/shader-graph-blocks/metallic.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+
+
+#### Relevant
+
+Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add the following Blocks to the Fragment Context:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/anisotropy.md)]
+[!include[](snippets/shader-graph-blocks/baked-back-gi.md)]
+[!include[](snippets/shader-graph-blocks/baked-gi.md)]
+[!include[](snippets/shader-graph-blocks/coat-mask.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/diffusion-profile.md)]
+[!include[](snippets/shader-graph-blocks/distortion.md)]
+[!include[](snippets/shader-graph-blocks/distortion-blur.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-mask.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-thickness.md)]
+[!include[](snippets/shader-graph-blocks/normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/refraction-index.md)]
+[!include[](snippets/shader-graph-blocks/refraction-color.md)]
+[!include[](snippets/shader-graph-blocks/refraction-distance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-screen-space-variance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-color.md)]
+[!include[](snippets/shader-graph-blocks/specular-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/subsurface-mask.md)]
+[!include[](snippets/shader-graph-blocks/tangent-object-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-world-space.md)]
+[!include[](snippets/shader-graph-blocks/thickness.md)]
+
+
+## Graph Settings
+
+### Surface Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/surface-options/material-type.md)]
+[!include[](snippets/shader-properties/surface-options/recursive-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/surface-type.md)]
+[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
+[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
+[!include[](snippets/shader-properties/surface-options/receive-fog.md)]
+[!include[](snippets/shader-properties/surface-options/depth-test.md)]
+[!include[](snippets/shader-properties/surface-options/depth-write.md)]
+[!include[](snippets/shader-properties/surface-options/cull-mode.md)]
+[!include[](snippets/shader-properties/surface-options/sorting-priority.md)]
+[!include[](snippets/shader-properties/surface-options/back-then-front-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-prepass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-postpass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-writes-motion-vectors.md)]
+[!include[](snippets/shader-properties/surface-options/preserve-specular-lighting.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-clipping.md)]
+[!include[](snippets/shader-properties/surface-options/use-shadow-threshold.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-to-mask.md)]
+[!include[](snippets/shader-properties/surface-options/double-sided-mode.md)]
+[!include[](snippets/shader-properties/surface-options/fragment-normal-space.md)]
+[!include[](snippets/shader-properties/surface-options/receive-decals.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr-transparent.md)]
+[!include[](snippets/shader-properties/surface-options/geometric-specular-aa.md)]
+[!include[](snippets/shader-properties/surface-options/ss-depth-offset.md)]
+[!include[](snippets/shader-properties/surface-options/clear-coat.md)]
+[!include[](snippets/shader-properties/surface-options/transmission.md)]
+[!include[](snippets/shader-properties/transparency-inputs/refraction-model.md)]
+[!include[](snippets/shader-properties/surface-options/energy-conserving-specular-color.md)]
+
+
+### Distortion
+
+This set of settings only appears if you set **Surface Type** to **Transparent**.
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/distortion/distortion.md)]
+[!include[](snippets/shader-properties/distortion/distortion-blend-mode.md)]
+[!include[](snippets/shader-properties/distortion/distortion-depth-test.md)]
+
+
+### Advanced Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/advanced-options/specular-occlusion-mode.md)]
+[!include[](snippets/shader-properties/advanced-options/override-baked-gi.md)]
+[!include[](snippets/shader-properties/advanced-options/support-lod-crossfade.md)]
+[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-stacklit.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-stacklit.md
new file mode 100644
index 00000000000..f604ce8b3f9
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-stacklit.md
@@ -0,0 +1,192 @@
+# StackLit
+
+The StackLit Master Stack can render materials that are more complex than the [Lit Master Stack](master-stack-lit.md). It includes all the features available in the Lit shader and, in some cases, provides more advanced or higher quality versions. For example, it uses a more advanced form of specular occlusion and also calculates anisotropic reflections for area lights in the same way the Lit shader does for other light types. It also takes into account light interactions between two vertically stacked physical layers, along with a more complex looking general base layer.
+
+
+
+## Creating a StackLit Shader Graph
+
+To create a StackLit material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button, and select **HDRP**.
+ 3. In the **Material** drop-down, select **StackLit**.
+
+* Create a new Shader Graph.
+ 1. Go to **Assets > Create >Shader Graph > HDRP** and click **StackLit Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+When you create a new Hair Master Stack, the Vertex Context contains the following Blocks by default:
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Hair Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/bent-normal.md)]
+[!include[](snippets/shader-graph-blocks/tangent-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/metallic.md)]
+[!include[](snippets/shader-graph-blocks/dielectric-ior.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+
+
+#### Relevant
+
+Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add the following Blocks to the Fragment Context:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/anisotropy.md)]
+[!include[](snippets/shader-graph-blocks/baked-back-gi.md)]
+[!include[](snippets/shader-graph-blocks/baked-gi.md)]
+[!include[](snippets/shader-graph-blocks/coat-extinction.md)]
+[!include[](snippets/shader-graph-blocks/coat-ior.md)]
+[!include[](snippets/shader-graph-blocks/coat-smoothness.md)]
+[!include[](snippets/shader-graph-blocks/coat-thickness.md)]
+[!include[](snippets/shader-graph-blocks/coat-mask.md)]
+[!include[](snippets/shader-graph-blocks/coat-normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/coat-normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/coat-normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/diffusion-profile.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-coat-fixup-tir.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-coat-fixup-tir-clamp.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-thickness.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-mask.md)]
+[!include[](snippets/shader-graph-blocks/haze-extents.md)]
+[!include[](snippets/shader-graph-blocks/haziness.md)]
+[!include[](snippets/shader-graph-blocks/hazy-gloss-max-dielectric-f0.md)]
+[!include[](snippets/shader-graph-blocks/lobe-mix.md)]
+[!include[](snippets/shader-graph-blocks/normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/smoothness-b.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-screen-space-variance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-color.md)]
+[!include[](snippets/shader-graph-blocks/specular-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/subsurface-mask.md)]
+[!include[](snippets/shader-graph-blocks/tangent-object-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-world-space.md)]
+[!include[](snippets/shader-graph-blocks/thickness.md)]
+
+
+## Graph Settings
+
+### Surface Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/surface-options/surface-type.md)]
+[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
+[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
+[!include[](snippets/shader-properties/surface-options/receive-fog.md)]
+[!include[](snippets/shader-properties/surface-options/depth-test.md)]
+[!include[](snippets/shader-properties/surface-options/depth-write.md)]
+[!include[](snippets/shader-properties/surface-options/cull-mode.md)]
+[!include[](snippets/shader-properties/surface-options/sorting-priority.md)]
+[!include[](snippets/shader-properties/surface-options/back-then-front-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-prepass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-postpass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-writes-motion-vectors.md)]
+[!include[](snippets/shader-properties/surface-options/preserve-specular-lighting.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-clipping.md)]
+[!include[](snippets/shader-properties/surface-options/use-shadow-threshold.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-to-mask.md)]
+[!include[](snippets/shader-properties/surface-options/double-sided-mode.md)]
+[!include[](snippets/shader-properties/surface-options/fragment-normal-space.md)]
+[!include[](snippets/shader-properties/surface-options/receive-decals.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr.md)]
+[!include[](snippets/shader-properties/surface-options/receive-ssr-transparent.md)]
+[!include[](snippets/shader-properties/surface-options/geometric-specular-aa.md)]
+[!include[](snippets/shader-properties/surface-options/ss-depth-offset.md)]
+[!include[](snippets/shader-properties/surface-options/base-color-parametrization.md)]
+[!include[](snippets/shader-properties/surface-options/energy-conserving-specular.md)]
+[!include[](snippets/shader-properties/surface-options/anisotropy.md)]
+[!include[](snippets/shader-properties/surface-options/coat.md)]
+[!include[](snippets/shader-properties/surface-options/coat-normal.md)]
+[!include[](snippets/shader-properties/surface-options/dual-specular-lobe.md)]
+[!include[](snippets/shader-properties/surface-options/dual-specular-lobe-parametrization.md)]
+[!include[](snippets/shader-properties/surface-options/cap-haziness-for-non-metallic.md)]
+[!include[](snippets/shader-properties/surface-options/iridescence.md)]
+[!include[](snippets/shader-properties/surface-options/transmission.md)]
+[!include[](snippets/shader-properties/surface-options/specular-occlusion-mode-stacklit.md)]
+[!include[](snippets/shader-properties/surface-options/anisotropy-for-area-lights.md)]
+[!include[](snippets/shader-properties/surface-options/base-layer-uses-refracted-angles.md)]
+[!include[](snippets/shader-properties/surface-options/recompute-stack-and-iridescence.md
+[!include[](snippets/shader-properties/surface-options/honor-per-light-max-smoothness.md
+
+
+### Distortion
+
+This set of settings only appears if you set **Surface Type** to **Transparent**.
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/distortion/distortion.md)]
+[!include[](snippets/shader-properties/distortion/distortion-blend-mode.md)]
+[!include[](snippets/shader-properties/distortion/distortion-depth-test.md)]
+
+
+### Advanced Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/advanced-options/specular-occlusion-mode.md)]
+[!include[](snippets/shader-properties/advanced-options/override-baked-gi.md)]
+[!include[](snippets/shader-properties/advanced-options/support-lod-crossfade.md)]
+[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/master-stack-unlit.md b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-unlit.md
new file mode 100644
index 00000000000..66a7702a978
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/master-stack-unlit.md
@@ -0,0 +1,141 @@
+# Unlit
+
+The Unlit Master Stack lets you create shaders that are not affected by lighting.
+
+
+
+
+
+## Creating an Unlit Shader Graph
+
+To create an Unlit material in Shader Graph, you can either:
+
+* Modify an existing Shader Graph.
+
+ 1. Open the Shader Graph in the Shader Editor.
+ 2. In **Graph Settings**, select the **HDRP** Target. If there isn't one, go to **Active Targets,** click the **Plus** button and select **HDRP**.
+ 3. In the **Material** drop-down, select **Unlit**.
+
+* Create a new Shader Graph.
+
+ 1. Go to **Assets > Create >Shader Graph > HDRP** and click **Unlit Shader Graph**.
+
+## Contexts
+
+[!include[](snippets/master-stacks-contexts-intro.md)]
+
+### Vertex Context
+
+#### Default
+
+When you create a new Unlit Master Stack, the Vertex Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
+
+#### Relevant
+
+This Master Stack material type adds all its Vertex Blocks to the Vertex Context by default and has no extra relevant Blocks.
+
+### Fragment Context
+
+#### Default
+
+When you create a new Unlit Master Stack, the Fragment Context contains the following Blocks by default:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+
+
+#### Relevant
+
+Depending on the [Graph Settings](#graph-settings) you use, Shader Graph can add the following Blocks to the Fragment Context:
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/distortion.md)]
+[!include[](snippets/shader-graph-blocks/distortion-blur.md)]
+[!include[](snippets/shader-graph-blocks/shadow-tint.md)]
+
+
+## Graph Settings
+
+### Surface Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/surface-options/surface-type.md)]
+[!include[](snippets/shader-properties/surface-options/rendering-pass.md)]
+[!include[](snippets/shader-properties/surface-options/blending-mode.md)]
+[!include[](snippets/shader-properties/surface-options/receive-fog.md)]
+[!include[](snippets/shader-properties/surface-options/depth-test.md)]
+[!include[](snippets/shader-properties/surface-options/depth-write.md)]
+[!include[](snippets/shader-properties/surface-options/cull-mode.md)]
+[!include[](snippets/shader-properties/surface-options/sorting-priority.md)]
+[!include[](snippets/shader-properties/surface-options/back-then-front-rendering.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-prepass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-depth-postpass.md)]
+[!include[](snippets/shader-properties/surface-options/transparent-writes-motion-vectors.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-clipping.md)]
+[!include[](snippets/shader-properties/surface-options/use-shadow-threshold.md)]
+[!include[](snippets/shader-properties/surface-options/alpha-to-mask.md)]
+[!include[](snippets/shader-properties/surface-options/double-sided.md)]
+[!include[](snippets/shader-properties/surface-options/ss-depth-offset.md)]
+[!include[](snippets/shader-properties/surface-options/shadow-matte.md)]
+
+
+### Distortion
+
+This set of settings only appears if you set **Surface Type** to **Transparent**.
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/distortion/distortion.md)]
+[!include[](snippets/shader-properties/distortion/distortion-blend-mode.md)]
+[!include[](snippets/shader-properties/distortion/distortion-depth-test.md)]
+[!include[](snippets/shader-properties/distortion/distortion-only.md)]
+
+
+### Advanced Options
+
+
+
+Property |
+Description |
+
+[!include[](snippets/shader-properties/advanced-options/support-lod-crossfade.md)]
+[!include[](snippets/shader-properties/advanced-options/add-precomputed-velocity.md)]
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/silk-shader.md b/com.unity.render-pipelines.high-definition/Documentation~/silk-shader.md
index fc4d3656cc6..23580138b14 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/silk-shader.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/silk-shader.md
@@ -4,7 +4,7 @@ The Silk shader is your starting point for rendering anisotropic fabrics in the
In general, silk and other synthetic fibers are smoother because they are produced as a single smooth filament. When this is weaved, it produces a fabric with anisotropic specular highlights.

-Under the hood, the Silk shader is a pre-configured Shader Graph. To learn more about the Silk shader implementation, or to create your own Silk shader variant, see the Shader Graph documentation about the [Fabric Master Node](Master-Node-Fabric.md).
+Under the hood, the Silk shader is a pre-configured Shader Graph. To learn more about the Silk shader implementation, or to create your own Silk shader variant, see the Shader Graph documentation about the [Fabric Master Stack](master-stack-fabric.md).
## Importing the Silk Fabric Sample
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/area-light-material-support-disclaimer.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/area-light-material-support-disclaimer.md
index 4b650ce817d..94911b3da61 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/snippets/area-light-material-support-disclaimer.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/area-light-material-support-disclaimer.md
@@ -3,5 +3,5 @@ Area [Lights](../Light-Component.md) do not currently support Fabric or Hair Mat
* [Cotton/Wool Shader](../cotton-wool-shader.md)
* [Silk Shader](../silk-shader.md)
* [Hair Shader](../hair-shader.md)
-* [Fabric Master Stack](../Master-Node-Fabric.md)
-* [Hair Master Stack](../Master-Node-Hair.md)
+* [Fabric Master Stack](../master-stack-fabric.md)
+* [Hair Master Stack](../master-stack-hair.md)
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/master-stacks-contexts-intro.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/master-stacks-contexts-intro.md
new file mode 100644
index 00000000000..9530a74c3ba
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/master-stacks-contexts-intro.md
@@ -0,0 +1,3 @@
+This Master Stack material type has its own set of Graph Settings. Because of the relationship between settings and Blocks, this has consequences on which Blocks are relevant to the Graph. This section contains information on the Blocks this Master Stack material type adds by default, and which Blocks set properties for this Master Stack material type's Graph Settings.
+
+For more information about the relationship between Graph Settings and Blocks, see [Contexts and Blocks](../ss-contexts-and-blocks.md).
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md
new file mode 100644
index 00000000000..53b1357b882
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md
@@ -0,0 +1,6 @@
+
+**Alpha Clip Threshold Depth Postpass** |
+The alpha value limit that HDRP uses for the transparent depth postpass. If the alpha value of the pixel is equal to or higher than this limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. |
+• **Alpha Clipping** enabled • **Transparent Depth Postpass** enabled |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md
new file mode 100644
index 00000000000..117a920c7a1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md
@@ -0,0 +1,6 @@
+
+**Alpha Clip Threshold Depth Prepass** |
+The alpha value limit that HDRP uses for the transparent depth prepass. If the alpha value of the pixel is equal to or higher than this limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. |
+• **Alpha Clipping** enabled • **Transparent Depth Prepass** enabled |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md
new file mode 100644
index 00000000000..231fc80ef6a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md
@@ -0,0 +1,6 @@
+
+**Alpha Clip Threshold Shadow** |
+The alpha value limit that HDRP uses to determine whether it should render shadows for a pixel. If the alpha value of the pixel is equal to or higher than this limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. |
+• **Use Shadow Threshold** enabled |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold.md
new file mode 100644
index 00000000000..1f0dc306deb
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha-clip-threshold.md
@@ -0,0 +1,6 @@
+
+**Alpha Clip Threshold** |
+The alpha value limit that HDRP uses to determine whether to render each pixel. If the alpha value of the pixel is equal to or higher than the limit, HDRP renders the pixel. If the value is lower than the limit, HDRP does not render the pixel. The default value is 0.5. |
+• **Alpha Clipping** enabled |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha.md
new file mode 100644
index 00000000000..0a4b0bf6cb1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/alpha.md
@@ -0,0 +1,6 @@
+
+**Alpha** |
+The Material's alpha value. This determines how transparent the material is. The expected range is 0 - 1. |
+None |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/ambient-occlusion.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/ambient-occlusion.md
new file mode 100644
index 00000000000..70471243e4d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/ambient-occlusion.md
@@ -0,0 +1,6 @@
+
+**Ambient Occlusion** |
+The material's ambient occlusion. This approximates occlusion for a fragment on a GameObject’s surface that has been cast by details present in the Material but not the mesh geometry. A value of 0 means the fragment is completely occluded and appears black. A value of 1 means the fragment is not occluded at all, and the ambient color does not change. |
+None |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/anisotropy-b.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/anisotropy-b.md
new file mode 100644
index 00000000000..588bcdfe58d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/anisotropy-b.md
@@ -0,0 +1,6 @@
+
+**Anisotropy B** |
+The direction of the anisotropy effect for the secondary lobe. Negative values make the effect vertical, and positive values make the effect horizontal. |
+• **Anisotropy** enabled • **Dual Specular lobe** enabled |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/anisotropy.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/anisotropy.md
new file mode 100644
index 00000000000..9eb2c32155d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/anisotropy.md
@@ -0,0 +1,6 @@
+
+**Anisotropy** |
+The direction of the anisotropy effect. Negative values make the effect vertical, and positive values make the effect horizontal. |
+• **Anisotropy** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/baked-back-gi.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/baked-back-gi.md
new file mode 100644
index 00000000000..e6c6c847008
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/baked-back-gi.md
@@ -0,0 +1,6 @@
+
+**Baked Back GI** |
+The global illumination (GI) value to apply to the back [face](../../Glossary.md#face) of the Mesh only. This replaces the built-in diffuse GI solution. This port only appears when you enable the **Override Baked GI** setting. |
+• **Override Baked GI** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/baked-gi.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/baked-gi.md
new file mode 100644
index 00000000000..678c0d242e0
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/baked-gi.md
@@ -0,0 +1,6 @@
+
+**Baked GI** |
+The global illumination (GI) value to apply to the front [face](../../Glossary.md#face) of the Mesh only. This replaces the built-in diffuse GI solution. |
+• **Override Baked GI** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/base-color.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/base-color.md
new file mode 100644
index 00000000000..12817ff884a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/base-color.md
@@ -0,0 +1,6 @@
+
+**Base Color** |
+The base color of the material. |
+None |
+Color.grey |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/bent-normal.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/bent-normal.md
new file mode 100644
index 00000000000..52071ae96bb
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/bent-normal.md
@@ -0,0 +1,6 @@
+
+**Bent Normal** |
+The bent normal of the fragment. HDRP uses bent normal maps to simulate more accurate ambient occlusion. Bent normals only work with diffuse lighting. |
+• **Material** set to **Eye**, **Fabric**, **Hair**, **Lit**, or **StackLit** |
+CoordinateSpace.Tangent |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-extinction.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-extinction.md
new file mode 100644
index 00000000000..55342b43349
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-extinction.md
@@ -0,0 +1,6 @@
+
+**Coat Extinction** |
+The HDR color that determines which color the coat absorbs the most. This property works with **Coat Thickness** to calculate an absorption coefficient. |
+• **Material** set to **StackLit** • **Coat** enabled |
+Color.white |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-ior.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-ior.md
new file mode 100644
index 00000000000..9e527179472
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-ior.md
@@ -0,0 +1,6 @@
+
+**Coat IOR** |
+The index of refraction to use for the coating layer. |
+• **Material** set to **StackLit** • **Coat** enabled |
+1.4 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-mask.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-mask.md
new file mode 100644
index 00000000000..c7dbb944dce
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-mask.md
@@ -0,0 +1,6 @@
+
+**Coat Mask** |
+The mask that simulates a clear coat effect on the Material to mimic materials like car paint or plastics. |
+• **Material** set to **StackLit** • **Coat** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-object-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-object-space.md
new file mode 100644
index 00000000000..ca212095178
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-object-space.md
@@ -0,0 +1,6 @@
+
+**Coat Normal Object Space** |
+The normal, in object space, for the coat. |
+• **Material** set to **StackLit** • **Coat** enabled • **Coat Normal** enabled • **Fragment Normal Space** set to **Object** |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-tangent-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-tangent-space.md
new file mode 100644
index 00000000000..87cd22bde74
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-tangent-space.md
@@ -0,0 +1,6 @@
+
+**Coat Normal Tangent Space** |
+The normal, in tangent space, for the coat. |
+• **Material** set to **StackLit** • **Coat** enabled • **Coat Normal** enabled • **Fragment Normal Space** set to **Tangent** |
+CoordinateSpace.Tangent |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-world-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-world-space.md
new file mode 100644
index 00000000000..99d42086795
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-normal-world-space.md
@@ -0,0 +1,6 @@
+
+**Coat Normal World Space** |
+The normal, in world space, for the coat. |
+• **Material** set to **StackLit** • **Coat** enabled • **Coat Normal** enabled • **Fragment Normal Space** set to **World** |
+CoordinateSpace.World |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-smoothness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-smoothness.md
new file mode 100644
index 00000000000..8c3656f95db
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-smoothness.md
@@ -0,0 +1,6 @@
+
+**Coat Smoothness** |
+The smoothness of the coat's specular lobe. The coat has no diffuse component, but this property affects the base layer's diffuse color. Decreasing this value also makes the base layer seem less smooth. |
+• **Material** set to **StackLit** • **Coat** enabled |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-thickness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-thickness.md
new file mode 100644
index 00000000000..df19a021aa0
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/coat-thickness.md
@@ -0,0 +1,6 @@
+
+**Coat Thickness** |
+The intensity of the coat's absorption effect. This property works with **Coat Extinction** to calculate an absorption coefficient. A value of 0 produces no absorption and a value of 1 produces full absorption. |
+• **Material** set to **StackLit** • **Coat** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/depth-offset.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/depth-offset.md
new file mode 100644
index 00000000000..ba1c91b84e7
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/depth-offset.md
@@ -0,0 +1,6 @@
+
+**Depth Offset** |
+The value that the Shader uses to increase the depth of the fragment by. This Block requires you to input the result of the [Parallax Occlusion Mapping](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest?subfolder=/manual/Parallax-Occlusion-Mapping-Node.html) Node to produce a realistic result. |
+• **Depth Offset** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/dielectric-ior.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/dielectric-ior.md
new file mode 100644
index 00000000000..c3bcf217a4f
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/dielectric-ior.md
@@ -0,0 +1,6 @@
+
+**Dielectric IOR** |
+The index of refraction that determines the specular color of the material when the metallic value is 0. |
+• **Material** set to **StackLit** • **Base Color Parametrization** set to **Base Metallic** |
+1.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/diffusion-profile.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/diffusion-profile.md
new file mode 100644
index 00000000000..6e0fab73a1b
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/diffusion-profile.md
@@ -0,0 +1,6 @@
+
+**Diffusion Profile** |
+The [Diffusion Profile](../../Diffusion-Profile.md) to use for subsurface scattering and transmission. |
+• **Material Type** set to **Subsurface Scattering** or **Translucent** |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/distortion-blur.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/distortion-blur.md
new file mode 100644
index 00000000000..0c6235e7e32
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/distortion-blur.md
@@ -0,0 +1,6 @@
+
+**Distortion Blur** |
+The blur intensity of the distortion effect. |
+• **Distortion** enabled |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/distortion.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/distortion.md
new file mode 100644
index 00000000000..7507ea77a9a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/distortion.md
@@ -0,0 +1,6 @@
+
+**Distortion** |
+The per-direction amount that HDRP distorts light that passes through the material. |
+• **Distortion** enabled |
+Vector2(0, 0) |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/emission.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/emission.md
new file mode 100644
index 00000000000..738ab8c5a3a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/emission.md
@@ -0,0 +1,6 @@
+
+**Emission** |
+The color of light to emit from this material's surface. Emissive materials appear as a source of light in your scene. |
+None |
+Color.black |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/hair-strand-direction.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/hair-strand-direction.md
new file mode 100644
index 00000000000..09c8ccfde01
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/hair-strand-direction.md
@@ -0,0 +1,6 @@
+
+**Hair Strand Direction** |
+The direction that hair flows, from root to tip, when modelling with hair cards. |
+• **Material** set to **Hair** |
+Vector3(0, -1, 0) |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/haze-extent.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/haze-extent.md
new file mode 100644
index 00000000000..bea1c43b895
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/haze-extent.md
@@ -0,0 +1,6 @@
+
+**Haze Extent** |
+The range of the haze or halo effect around the central specular highlight. |
+• **Material** set to **StackLit** • **Duel Specular Lobe Parametrization** set to **Hazy Gloss** |
+3.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/haziness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/haziness.md
new file mode 100644
index 00000000000..d1fac5a1c61
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/haziness.md
@@ -0,0 +1,6 @@
+
+**Haziness** |
+The intensity of the haze or halo effect. A value of 0 produces no haziness. A value of 1 produces the full haze effect. |
+• **Material** set to **StackLit** • **Duel Specular Lobe Parametrization** set to **Hazy Gloss** |
+0.2 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/hazy-gloss-max-dielectric-f0.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/hazy-gloss-max-dielectric-f0.md
new file mode 100644
index 00000000000..181ffb3888e
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/hazy-gloss-max-dielectric-f0.md
@@ -0,0 +1,6 @@
+
+**Hazy Gloss Max Dielectric F0** |
+The maximum intensity the specular highlight can be when **Metallic** is 0. As the metallic value increases, the maximum intensity relaxes towards 1. |
+• **Material** set to **StackLit** • **Base Color Parametrization** set to **Base Metallic** • **Duel Specular Lobe Parametrization** set to **Hazy Gloss** |
+0.25 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/ior.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/ior.md
new file mode 100644
index 00000000000..5f301d73c30
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/ior.md
@@ -0,0 +1,6 @@
+
+**IOR** |
+The index of refraction for this Material. The index of refraction defines the ratio between the speed of light in a vacuum and the speed of light in the medium of the Material. Higher values produce more intense refraction. |
+• **Material Type** set to **Eye** |
+1.4 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-coat-fixup-tir-clamp.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-coat-fixup-tir-clamp.md
new file mode 100644
index 00000000000..a67e8de25cd
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-coat-fixup-tir-clamp.md
@@ -0,0 +1,6 @@
+
+**Iridescence Coat Fixup TIR Clamp** |
+The value to clamp the color flip phase to. This is at the grazing angle endpoint of the angular range. This makes it so that the oscillations only “elongate” towards the 0 degree viewing angle, which makes a lowered thickness more apparent. |
+• **Material Type** set to **StackLit** • **Iridescence** enabled • **Coat** enabled. |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-coat-fixup-tir.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-coat-fixup-tir.md
new file mode 100644
index 00000000000..bcb2bee1b20
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-coat-fixup-tir.md
@@ -0,0 +1,6 @@
+
+**Iridescence Coat Fixup TIR** |
+Sets the amount to adjust the internal iridescence model by so that the total internal reflection (TIR) angle is always the grazing angle. This means that the TIR region is always out of view, regardless of the overall coat and iridescence thickness. |
+• **Material Type** set to **StackLit** • **Iridescence** enabled • **Coat** enabled. |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-mask.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-mask.md
new file mode 100644
index 00000000000..7d57930a8b2
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-mask.md
@@ -0,0 +1,6 @@
+
+**Iridescence Mask** |
+The strength of the iridescence effect. |
+• **Material Type** set to **StackLit** • **Iridescence** enabled. |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-thickness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-thickness.md
new file mode 100644
index 00000000000..c03422d5f79
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iridescence-thickness.md
@@ -0,0 +1,6 @@
+
+**Iridescence Thickness** |
+The thickness of the iridescence. This changes the gradient of color that the iridescence effect produces. |
+• **Material Type** set to **StackLit** • **Iridescence** enabled. |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-object-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-object-space.md
new file mode 100644
index 00000000000..09386494c7a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-object-space.md
@@ -0,0 +1,6 @@
+
+**Iris Normal Object Space** |
+The normal of the eye's iris in object space. |
+• **Material Type** set to **Eye** • **Iris Normal** enabled • **Fragment Normal Space** set to **Object** |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-tangent-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-tangent-space.md
new file mode 100644
index 00000000000..303b4c79a69
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-tangent-space.md
@@ -0,0 +1,6 @@
+
+**Iris Normal Tangent Space** |
+The normal of the eye's iris in tangent space. |
+• **Material Type** set to **Eye** • **Iris Normal** enabled • **Fragment Normal Space** set to **Tangent** |
+CoordinateSpace.Tangent |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-world-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-world-space.md
new file mode 100644
index 00000000000..d0e7d18f93d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/iris-normal-world-space.md
@@ -0,0 +1,6 @@
+
+**Iris Normal World Space** |
+The normal of the eye's iris in world space. |
+• **Material Type** set to **Eye** • **Iris Normal** enabled • **Fragment Normal Space** set to **World** |
+CoordinateSpace.World |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/lobe-mix.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/lobe-mix.md
new file mode 100644
index 00000000000..2d5c52123ad
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/lobe-mix.md
@@ -0,0 +1,6 @@
+
+**Lobe Mix** |
+The amount of mixing between the primary and secondary specular lobes. |
+• **Duel Specular Lobe** enabled • **Duel SpecularLobe Parametrization** set to **Direct**. |
+0.3 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/maos-alpha.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/maos-alpha.md
new file mode 100644
index 00000000000..f94aaa2f939
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/maos-alpha.md
@@ -0,0 +1,6 @@
+
+**MAOS Alpha** |
+The opacity of the **Metallic**, **Ambient Occlusion**, and **Smoothness** values. |
+• **Material Type** set to **Decal** |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/mask.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/mask.md
new file mode 100644
index 00000000000..712b8ae5af1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/mask.md
@@ -0,0 +1,6 @@
+
+**Mask** |
+Specifies whether the current fragment represents the iris or the sclera. The Shader Graph only uses the x component of this Vector2. A value of 0 means the fragment represents the sclera, and a value of 1 means the fragment represents the iris. A value between 0 and 1 results in a linear blend between sclera and iris. |
+• **Material** set to **Eye** |
+Vector2(1.0, 0) |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/metallic.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/metallic.md
new file mode 100644
index 00000000000..eb79c5361db
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/metallic.md
@@ -0,0 +1,6 @@
+
+**Metallic** |
+The material's metallic value. This defines how "metal-like" the surface of your Material is (between 0 and 1). When a surface is more metallic, it reflects the environment more and its albedo color becomes less visible. At full metallic level, the surface color is entirely driven by reflections from the environment. When a surface is less metallic, its albedo color is clearer and any surface reflections are visible on top of the surface color, rather than obscuring it. |
+None |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-alpha.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-alpha.md
new file mode 100644
index 00000000000..aa6e506215d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-alpha.md
@@ -0,0 +1,6 @@
+
+**Normal Alpha** |
+The blend factor for the Material’s normals. A decal modifies the normals of the Material the decal projects onto. A value of 0 means that the decal does not affect the normals of the surface it projects onto. A value of 1 means that the decal fully overrides the normals of the surface. |
+• **Material** set to **Decal** |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-object-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-object-space.md
new file mode 100644
index 00000000000..6565819cfda
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-object-space.md
@@ -0,0 +1,6 @@
+
+**Normal Object Space** |
+The normal, in object space, for the material. |
+• **Fragment Normal Space** set to **Object** |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-tangent-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-tangent-space.md
new file mode 100644
index 00000000000..eacf505f62b
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-tangent-space.md
@@ -0,0 +1,6 @@
+
+**Normal Tangent Space** |
+The normal, in tangent space, for the material. |
+• **Fragment Normal Space** set to **Tangent** |
+CoordinateSpace.Tangent |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-world-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-world-space.md
new file mode 100644
index 00000000000..add258f006d
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/normal-world-space.md
@@ -0,0 +1,6 @@
+
+**Normal World Space** |
+The normal, in world space, for the material. |
+• **Fragment Normal Space** set to **World** |
+CoordinateSpace.World |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-color.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-color.md
new file mode 100644
index 00000000000..6654a622926
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-color.md
@@ -0,0 +1,6 @@
+
+**Refraction Color** |
+The color that this refractive material tints light which passes through it. |
+• **Refraction Model** not set to **None** |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-distance.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-distance.md
new file mode 100644
index 00000000000..70e8ba33b86
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-distance.md
@@ -0,0 +1,6 @@
+
+**Refraction Distance** |
+The thickness of the object at which the **Refraction Color** affects incident light at full strength. |
+• **Refraction Model** not set to **None** |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-index.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-index.md
new file mode 100644
index 00000000000..7db2aeca9b3
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/refraction-index.md
@@ -0,0 +1,6 @@
+
+**Refraction Index** |
+The ratio between the speed of light in a vacuum and the speed of light in the medium of the material. Higher values produce more intense refraction. |
+• **Refraction Model** not set to **None** |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/rim-transmission-intensity.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/rim-transmission-intensity.md
new file mode 100644
index 00000000000..b5502e1a6ee
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/rim-transmission-intensity.md
@@ -0,0 +1,6 @@
+
+**Rim Transmission Intensity** |
+The intensity of back lit hair around the edge of the hair. Set this to 0 to completely remove the transmission effect. |
+• **Material** set to **Hair** |
+0.2 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-smoothness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-smoothness.md
new file mode 100644
index 00000000000..c5198df9350
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-smoothness.md
@@ -0,0 +1,6 @@
+
+**Secondary Smoothness** |
+The appearance of the secondary specular highlight. Increase this value to make the highlight smaller. |
+• **Material** set to **Hair** |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-specular-shift.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-specular-shift.md
new file mode 100644
index 00000000000..57934088a30
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-specular-shift.md
@@ -0,0 +1,6 @@
+
+**Secondary Specular Shift** |
+The position of the secondary specular highlight. |
+• **Material** set to **Hair** |
+-0.1 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-specular-tint.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-specular-tint.md
new file mode 100644
index 00000000000..a16d9cd10b6
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/secondary-specular-tint.md
@@ -0,0 +1,6 @@
+
+**Secondary Specular Tint** |
+The color of the secondary specular highlight. |
+• **Material** set to **Hair** |
+Color.grey |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/shadow-tint.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/shadow-tint.md
new file mode 100644
index 00000000000..cea8b6154d1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/shadow-tint.md
@@ -0,0 +1,6 @@
+
+**Shadow Tint** |
+The shadow color and opacity. |
+• **Material** set to **Unlit** • **Shadow Matte** enabled |
+Color.black |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/smoothness-b.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/smoothness-b.md
new file mode 100644
index 00000000000..dc38c57a600
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/smoothness-b.md
@@ -0,0 +1,6 @@
+
+**Smoothness B** |
+The smoothness of the second specular lobe. |
+• **Material** set to **StackLit** • **Dual Specular Lobe** enabled • **Dual SpecularLobe Parametrization** set to **Direct**. |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/smoothness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/smoothness.md
new file mode 100644
index 00000000000..59a348b09df
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/smoothness.md
@@ -0,0 +1,6 @@
+
+**Smoothness** |
+The material's smoothness. Every light ray that hits a smooth surface bounces off at predictable and consistent angles. For a perfectly smooth surface that reflects light like a mirror, set this to a value of 1. Less smooth surfaces reflect light over a wider range of angles (because the light hits the bumps in the microsurface), so the reflections have less detail and spread across the surface in a more diffused pattern. |
+None |
+0.5 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-max-added-roughness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-max-added-roughness.md
new file mode 100644
index 00000000000..72b13479158
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-max-added-roughness.md
@@ -0,0 +1,6 @@
+
+**SO Fixup Max Added Roughness** |
+The maximum roughness that the bent normal fixup process can add to reduce artifacts. |
+• **Material** set to **StackLit** • **Specular Occlusion (from input AO)** set to **SPTD Integration Of Bent AO** |
+0.2 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-strength-factor.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-strength-factor.md
new file mode 100644
index 00000000000..60524c4c700
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-strength-factor.md
@@ -0,0 +1,6 @@
+
+**SO Fixup Strength Factor** |
+The strength of the fixup process HDRP uses to reduce noise from bent normals. |
+• **Material** set to **StackLit** • **Specular Occlusion (from input AO)** set to **SPTD Integration Of Bent AO** |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-visibility-ratio-threshold.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-visibility-ratio-threshold.md
new file mode 100644
index 00000000000..641606c00e2
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/so-fixup-visibility-ratio-threshold.md
@@ -0,0 +1,6 @@
+
+**SO Fixup Visibility Ratio Threshold** |
+The occlusion threshold value below which HDRP modifies the bent normal. This helps to remove noise in the bent normals. If the occlusion input is above this value, HDRP does not modify the bent normals. |
+• **Material** set to **StackLit** • **Specular Occlusion (from input AO)** set to **SPTD Integration Of Bent AO** |
+0.2 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-aa-screen-space-variance.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-aa-screen-space-variance.md
new file mode 100644
index 00000000000..8ec607ce473
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-aa-screen-space-variance.md
@@ -0,0 +1,6 @@
+
+**Specular AA Screen Space Variance** |
+The strength of the [geometric specular anti-aliasing](../../Geometric-Specular-Anti-Aliasing.md) effect between 0 and 1. Higher values produce a blurrier result with less aliasing. |
+• **Specular AA** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-aa-threshold.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-aa-threshold.md
new file mode 100644
index 00000000000..7a1718300c8
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-aa-threshold.md
@@ -0,0 +1,6 @@
+
+**Specular AA Threshold** |
+The maximum value that HDRP subtracts from the smoothness value to reduce artifacts. |
+• **Specular AA** enabled |
+0.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-color.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-color.md
new file mode 100644
index 00000000000..e6eb1a89916
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-color.md
@@ -0,0 +1,6 @@
+
+**Specular Color** |
+The material's specular color value. This defines the brightness and tint colour of specular highlights. |
+None |
+Color.grey |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-occlusion.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-occlusion.md
new file mode 100644
index 00000000000..5ddfccc38a3
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-occlusion.md
@@ -0,0 +1,6 @@
+
+**Specular Occlusion** |
+A multiplier for the intensity of specular global illumination. |
+• **Specular Occlusion Mode** set to **Custom** |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-shift.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-shift.md
new file mode 100644
index 00000000000..b6cde106550
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-shift.md
@@ -0,0 +1,6 @@
+
+**Specular Shift** |
+The position of the primary specular highlight. |
+• **Material** set to **Hair** |
+0.1 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-tint.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-tint.md
new file mode 100644
index 00000000000..a07a75457cb
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/specular-tint.md
@@ -0,0 +1,6 @@
+
+**Specular Tint** |
+The color of the primary specular highlight. |
+• **Material** set to **Hair** |
+Color.white |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/subsurface-mask.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/subsurface-mask.md
new file mode 100644
index 00000000000..d76a6e0229e
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/subsurface-mask.md
@@ -0,0 +1,6 @@
+
+**Subsurface Mask** |
+The strength of the screen-space blur effect across the Material. |
+• **Material** set to **Lit** • **Material Type** set to **Subsurface Scattering**. |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-object-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-object-space.md
new file mode 100644
index 00000000000..fac484a2fd2
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-object-space.md
@@ -0,0 +1,6 @@
+
+**Tangent Object Space** |
+The direction of anisotropy in object space. This stretches the specular highlights in the given direction. |
+• **Material** set to **Lit** • **Material Type** set to **Anisotropy** • **Fragment Normal Space** set to **Object** Or • **Material** set to **StackLit** • **Fragment Normal Space** set to **Object** Or • **Material** set to Fabric and **Material Type** set to **Silk** • **Fragment Normal Space** set to **Object** |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-tangent-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-tangent-space.md
new file mode 100644
index 00000000000..6bee6fd52ff
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-tangent-space.md
@@ -0,0 +1,6 @@
+
+**Tangent Tangent Space** |
+The direction of anisotropy in tangent space. This stretches the specular highlights in the given direction. |
+• **Material** set to **Lit** • **Material Type** set to **Anisotropy** • **Fragment Normal Space** set to **Tangent** Or • **Material** set to **StackLit** • **Fragment Normal Space** set to **Tangent** Or • **Material** set to Fabric and **Material Type** set to **Silk** • **Fragment Normal Space** set to **Tangent** |
+CoordinateSpace.Tangent |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-world-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-world-space.md
new file mode 100644
index 00000000000..73fc91e9c81
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/tangent-world-space.md
@@ -0,0 +1,6 @@
+
+**Tangent World Space** |
+The direction of anisotropy in world space. This stretches the specular highlights in the given direction. |
+• **Material** set to **Lit** • **Material Type** set to **Anisotropy** • **Fragment Normal Space** set to **World** Or • **Material** set to **StackLit** • **Fragment Normal Space** set to **World** Or • **Material** set to Fabric and **Material Type** set to **Silk** • **Fragment Normal Space** set to **World** |
+CoordinateSpace.World |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/thickness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/thickness.md
new file mode 100644
index 00000000000..08da8577c8b
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/thickness.md
@@ -0,0 +1,6 @@
+
+**Thickness** |
+The thickness of the surface that HDRP uses to evaluate transmission. |
+• **Material Type** set to **Subsurface Scattering** and **Transmission** enabled. Or • **Material Type** set to **Transluscent**. Or • **Refraction Model** not set to **None** |
+1.0 |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/transmittance.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/transmittance.md
new file mode 100644
index 00000000000..46e4542ae40
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/transmittance.md
@@ -0,0 +1,6 @@
+
+**Transmittance** |
+The fraction of specular lighting that penetrates the hair from behind. This is on a per-color channel basis, so you can use this property to set the color of penetrating light. Set this to (0, 0, 0) to stop any light from penetrating through the hair. Set this to (1, 1, 1) to have a strong effect with a lot of white light transmitting through the hair. |
+• **Material** set to **Hair** |
+Vector3(0.3, 0.195, 0.09) |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-normal.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-normal.md
new file mode 100644
index 00000000000..6f0bb8599fc
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-normal.md
@@ -0,0 +1,6 @@
+
+**Normal** |
+The object space vertex normal per vertex. |
+None |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-position.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-position.md
new file mode 100644
index 00000000000..fd9bf0e4268
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-position.md
@@ -0,0 +1,6 @@
+
+**Position** |
+The object space vertex position per vertex. |
+None |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-tangent.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-tangent.md
new file mode 100644
index 00000000000..a9bbeb7fee7
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-graph-blocks/vertex-tangent.md
@@ -0,0 +1,6 @@
+
+**Tangent** |
+The object space vertex tangent per vertex. |
+None |
+CoordinateSpace.Object |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/override-baked-gi.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/override-baked-gi.md
new file mode 100644
index 00000000000..3a77ea11f0b
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/override-baked-gi.md
@@ -0,0 +1,4 @@
+
+**Override Baked GI** |
+Indicates whether this Material ignores global illumination (GI) in the Scene and instead uses custom GI values. Enable this setting to add two baked GI Blocks to the Fragment Context that control GI for the Material. Disable this setting to make the Material use the Scene's GI. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/specular-occlusion-mode.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/specular-occlusion-mode.md
new file mode 100644
index 00000000000..37547654ed1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/specular-occlusion-mode.md
@@ -0,0 +1,4 @@
+
+**Specular Occlusion Mode** |
+The mode that HDRP uses to calculate specular occlusion. The options are: • **Off**: Disables specular occlusion. • **From AO**: Calculates specular occlusion from the ambient occlusion map and the Camera's view vector. • **From AO and Bent Normal**: Calculates specular occlusion from the ambient occlusion map, the bent normal map, and the Camera's view vector. • **Custom**: Allows you to specify your own specular occlusion values. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/support-lod-crossfade.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/support-lod-crossfade.md
new file mode 100644
index 00000000000..b5242ad8bc0
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/support-lod-crossfade.md
@@ -0,0 +1,4 @@
+
+**Support Lod Crossfade** |
+Indicates whether HDRP processes dithering when a mesh moves moves from one LOD level to another. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/use-light-facing-normal.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/use-light-facing-normal.md
new file mode 100644
index 00000000000..64f04fdf17a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/advanced-options/use-light-facing-normal.md
@@ -0,0 +1,4 @@
+
+**Use Light Facing Normal** |
+Indicates whether or not hair normals always appear to face towards light sources in the Scene. This mimics the behavior of real-world hair. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-blend-mode.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-blend-mode.md
new file mode 100644
index 00000000000..a2ed61ed2ea
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-blend-mode.md
@@ -0,0 +1,4 @@
+
+**Distortion Blend Mode** |
+Specifies the mode that HDRP uses to blend overlaid distortion surfaces. The options are: • **Add**: Adds the output distortion value with the current distortion value in the pixel. This is the default mode. • **Multiply**: Multiplies the output distortion value with the current distortion value in the pixel. • **Replace**: Replaces the current distortion value in the pixel with the output distortion value. This setting only appears if you enable **Distortion**. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-depth-test.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-depth-test.md
new file mode 100644
index 00000000000..5939aa28257
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-depth-test.md
@@ -0,0 +1,4 @@
+
+**Distortion Depth Test** |
+Indicates whether GameObjects that are closer to the Camera hide the distortion effect. Disable this setting to make the distortion effect appear on top of the rendering. This setting only appears if you enable **Distortion**. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-only.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-only.md
new file mode 100644
index 00000000000..ca58bd5b7cf
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion-only.md
@@ -0,0 +1,4 @@
+
+**Distortion Only** |
+Indicates whether to disable the rendering of the GameObject and only render the distortion pass for it. This is useful if you want to distort something without changing its color (for example, hot air distortion). |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion.md
new file mode 100644
index 00000000000..c9733af25ce
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/distortion/distortion.md
@@ -0,0 +1,4 @@
+
+**Distortion** |
+Indicates whether to distort light that passes through this transparent Material. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/anisotropy-for-area-lights.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/anisotropy-for-area-lights.md
new file mode 100644
index 00000000000..ae3e63c2cf7
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/anisotropy-for-area-lights.md
@@ -0,0 +1,4 @@
+
+**Anisotropy For Area Lights** |
+Indicates whether to calculate anisotropic reflections for area lights. Note that enabling this option makes a StackLit material more resource intensive to process around area lights. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/anisotropy-stacklit.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/anisotropy-stacklit.md
new file mode 100644
index 00000000000..bbc2972d15c
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/anisotropy-stacklit.md
@@ -0,0 +1,4 @@
+
+**Anisotropy** |
+Indicates whether to apply anisotropy to the material. If you enable **Dual Specular Lobe** the two lobes have independent anisotropic intensity values (**Anisotropy** and **AnisotropyB**). |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md
new file mode 100644
index 00000000000..aaa0d06bda0
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-color-parametrization.md
@@ -0,0 +1,4 @@
+
+**Base Color Parametrization** |
+Specifies the method to set color and reflectance properties of the material. The options are: • **Base Metallic**: Applies the basic metallic Shader workflow to the material. In the StackLit shader, when **Metallic** is 0, **Dielectric Ior** determines the specular color of the base layer. • **Specular Color**: Applies the Specular Color workflow to the material. Use this to create Materials with a coloured specular highlight. This is similar to the [built-in Specular Shader](https://docs.unity3d.com/Manual/StandardShaderMaterialParameterSpecular.html). |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-layer-uses-refracted-angles.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-layer-uses-refracted-angles.md
new file mode 100644
index 00000000000..b3270c890db
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/base-layer-uses-refracted-angles.md
@@ -0,0 +1,4 @@
+
+**Base Layer Uses Refracted Angles** |
+Indicates whether to shade directional, punctual, and spot lights on the bottom layer with refraction from the top layer (the coat). This setting only appears if you enable Coat. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/cap-haziness-for-non-metallic.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/cap-haziness-for-non-metallic.md
new file mode 100644
index 00000000000..b9b927ab00e
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/cap-haziness-for-non-metallic.md
@@ -0,0 +1,4 @@
+
+**Cap Haziness For Non Metallic** |
+Indicates whether to cap the intensity of the specular highlight for materials that have a metallic value of 0. As the metallic value increases, the cap relaxes towards 1. This setting only appears if you set **Base Color Parametrization** to **Metallic** and **Dual Specular Lobe Parametrization** to **Hazy Gloss**. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/clear-coat.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/clear-coat.md
new file mode 100644
index 00000000000..eece6b10a0f
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/clear-coat.md
@@ -0,0 +1,4 @@
+
+**Clear Coat** |
+Indicates whether HDRP simulates a clear coat effect on the Material to mimic Materials like car paint or plastics. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/coat-normal.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/coat-normal.md
new file mode 100644
index 00000000000..f90f21e3357
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/coat-normal.md
@@ -0,0 +1,4 @@
+
+**Coat Normal** |
+Indicates whether to use an independent normal for the coat layer. When enabled, the **Coat Normal** property sets the normals specifically for the coat layer. When disabled, the **Normal** property sets the normals for both the coat layer and the base layer. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/coat.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/coat.md
new file mode 100644
index 00000000000..f5f0debe1fd
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/coat.md
@@ -0,0 +1,4 @@
+
+**Coat** |
+Indicates whether to apply a dielectric coating layer to the base layer. This is a complete covering that has no independent material lerping or mixing. The coat has an independent roughness, a configurable index of refraction, and an extinction/absorption effect with a configurable thickness. The coat layer is not anisotropic. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/double-sided-mode.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/double-sided-mode.md
new file mode 100644
index 00000000000..a697bcfb1fe
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/double-sided-mode.md
@@ -0,0 +1,4 @@
+
+**Double Sided Mode** |
+Specifies how HDRP renders the faces of polygons in the mesh geometry. The options are: • Disabled: Only renders one face of the polygons. • Enabled: Renders both faces of the polygons. In this mode, the normal of the back face is the same as the front face. • Flipped Normals: Renders both faces of the polygons. In this mode, the normal of the back face is 180° of the front-facing normal. This also applies to the material, which means that it looks the same on both sides of the geometry. • Mirrored Normals: Renders both faces of the polygons. In this mode, the normal of the back face mirrors the front-facing normal. This also applies to the material, which means that it inverts on the back face. This is useful when you want to keep the same shape on both sides of the geometry, for example, for leaves.
For more information about this feature, see [Double-sided](../../../Double-Sided.md). |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/dual-specular-lobe-parametrization.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/dual-specular-lobe-parametrization.md
new file mode 100644
index 00000000000..c87c29120a1
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/dual-specular-lobe-parametrization.md
@@ -0,0 +1,4 @@
+
+**Dual Specular Lobe Parametrization** |
+Specifies the method that controls the second specular lobe. The options are: • **Direct**: Gives you direct control of the second lobe. **SmoothnessB** controls the second lobe's smoothness, **LobeMix** controls the amount of mixing between the two lobes, and **Anisotropy** controls the second lobe's anisotropic smoothness. • **Hazy Gloss**: Adds a haze effect to the surface directly while keeping the primary lobe mostly unchanged. **Haziness** controls the intensity of the haze effect. **HazeExtent** controls the range of the haze around the central highlight. This option is the most intuitive and controllable way to use two lobes. Note that this mode implicitly modifies the specular color. If the material already has a high specular intensity (close to 1), there is no room to increase it in regions where haziness requires it to be boosted. In this case, haziness has little to no effect. This setting only has an effect if you enable **Dual Specular Lobe**. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/dual-specular-lobe.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/dual-specular-lobe.md
new file mode 100644
index 00000000000..5fe1e34b31f
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/dual-specular-lobe.md
@@ -0,0 +1,4 @@
+
+**Dual Specular Lobe** |
+Indicates whether to add a second specular lobe to the base layer to simulate hazy materials without using a coat. If you also enable anisotropy, each lobe has an independent, configurable, anisotropic smoothness. The two lobes that characterize the base surface layer use the same index of refraction, or specular color (depending on the **Base Color Parametrization**). The second lobe then further uses a different input configuration depending on the **Dual Specular Lobe Parametrization**. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/energy-conserving-specular-color.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/energy-conserving-specular-color.md
new file mode 100644
index 00000000000..38e79493aec
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/energy-conserving-specular-color.md
@@ -0,0 +1,4 @@
+
+**Energy Conserving Specular Color** |
+Indicates whether HDRP reduces the diffuse color of the Material if the specular effect is more intense. This makes the lighting of the Material more consistent and makes it look more physically-accurate. This property only appears when you set Material Type to Specular Color. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/energy-conserving-specular.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/energy-conserving-specular.md
new file mode 100644
index 00000000000..bc182e68672
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/energy-conserving-specular.md
@@ -0,0 +1,4 @@
+
+**Energy Conserving Specular** |
+Indicates whether HDRP reduces the diffuse color of the Material if the specular effect is more intense. This makes the lighting of the Material more consistent and makes it look more physically accurate. This setting only appears when you set Base Color Parametrization to Specular Color. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/eye-material-type.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/eye-material-type.md
new file mode 100644
index 00000000000..a05bd4c2f4c
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/eye-material-type.md
@@ -0,0 +1,4 @@
+
+**Material Type** |
+Specifies the method HDRP uses to calculate caustics in the eye's iris. Currently, the quality difference between the two methods is marginal and the best one for your project depends on the context. The options are: • Eye: A low resource-intensity caustic calculation method. • Eye Cinematic: Produces a more realistic caustic effect. This is the same caustic calculation algorithm as used in [The Heretic](https://blogs.unity3d.com/tag/the-heretic). This method is more resource-intensive than Eye. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/fragment-normal-space.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/fragment-normal-space.md
new file mode 100644
index 00000000000..6c865b6a542
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/fragment-normal-space.md
@@ -0,0 +1,4 @@
+
+**Fragment Normal Space** |
+Specifies the normal map space that this Material uses. • TangentSpace: Defines the normals in [tangent space](../../../Glossary.html#TangentSpaceNormalMap). Use this to tile a Texture on a Mesh. • ObjectSpace: Defines the normals in [object space](../../../Glossary.html#ObjectSpaceNormalMap). Use this for planar-mapping GameObjects like the terrain. • WorldSpace: Defines the normal maps in world space. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/honor-per-light-max-smoothness.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/honor-per-light-max-smoothness.md
new file mode 100644
index 00000000000..88d29e56b1c
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/honor-per-light-max-smoothness.md
@@ -0,0 +1,4 @@
+
+**Honor Per Light Max Smoothness** |
+Indicates whether the StackLit shader uses the shape of directional, [punctual](../../../Glossary.md#punctual-lights), and spot [Lights](../../../Light-Component.md) when it simulates the extent of the Lights. Depending on the smoothness values of the layers, enabling this option can produce unrealistic results for Lights that have large shapes. To fix this, enable Recompute Stack and Iridescence. These options are separate because recomputing the stack per Light instead of once for all Lights is significantly more resource intensive. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/iridescence.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/iridescence.md
new file mode 100644
index 00000000000..719720f9b9c
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/iridescence.md
@@ -0,0 +1,4 @@
+
+**Iridescence** |
+Indicates whether to apply iridescence to the base layer (and the coat layer if there is one). Iridescent surfaces appear to gradually change color as the angle of view or the angle of illumination changes. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/iris-normal.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/iris-normal.md
new file mode 100644
index 00000000000..19ef1a2d07b
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/iris-normal.md
@@ -0,0 +1,4 @@
+
+**Iris Normal** |
+Indicates whether to use custom normals for the iris. When enabled, the Iris Normal Block sets the normal of the iris for the current fragment. When disabled, it uses the Normal Block. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/recompute-stack-and-iridescence.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/recompute-stack-and-iridescence.md
new file mode 100644
index 00000000000..6f46de2f356
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/recompute-stack-and-iridescence.md
@@ -0,0 +1,4 @@
+
+**Recompute Stack And Iridescence** |
+Indicates whether the StackLit shader simulates its coat/layer effect for each [Light](../../../Light-Component.md) individually, rather than once for all Lights at the same time. Note this only applies to [punctual](../../../Glossary.md#punctual-lights), directional, and spot Lights. Enabling this option increases the resource intensity of the shader, so only use it when necessary (for example, when **Honor Per Light Max Smoothness** is enabled). |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/recursive-rendering.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/recursive-rendering.md
new file mode 100644
index 00000000000..a0a278c1c09
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/recursive-rendering.md
@@ -0,0 +1,4 @@
+
+**Recursive Rendering** |
+Indicates whether to include this material in the [recursive rendering pipeline](../../../Ray-Tracing-Recursive-Rendering.md). When enabled, if your project supports [ray tracing](../../../Ray-Tracing-Getting-Started.md) and a [Recursive Rendering](../../../Ray-Tracing-Recursive-Rendering.md) Volume Profile override is active, HDRP uses ray tracing to render this material. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md
new file mode 100644
index 00000000000..19b90df1989
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/shadow-matte.md
@@ -0,0 +1,4 @@
+
+**Shadow Matte** |
+Indicates whether or not the Shader receives shadows. Shadow matte only supports shadow maps. It does not support Screen Space Shadows, [Ray-Traced Shadows](../../../Ray-Traced-Shadows.md), or [Contact Shadows](../../../Override-Contact-Shadows.md). |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/specular-occlusion-mode-stacklit.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/specular-occlusion-mode-stacklit.md
new file mode 100644
index 00000000000..7faf32affc7
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/specular-occlusion-mode-stacklit.md
@@ -0,0 +1,4 @@
+
+**Specular Occlusion Mode** |
+The mode that HDRP uses to calculate specular occlusion. The options are: • **Off**: Disables specular occlusion. • **Direct From AO**: Calculates specular occlusion from the ambient occlusion map and the Camera's view vector. • **SPTD Integration of Bent AO**: First uses the bent normal with the ambient occlusion value to calculate a general visibility cone. Then, calculates the specular occlusion using a Spherical Pivot Transformed Distribution (SPTD) that is properly integrated against the bent visibility cone. • *Custom*: Allows you to specify your own specular occlusion values. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/ss-depth-offset.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/ss-depth-offset.md
new file mode 100644
index 00000000000..67d02623a18
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/ss-depth-offset.md
@@ -0,0 +1,4 @@
+
+**Depth Offset** |
+Indicates whether HDRP modifies the depth buffer according to the displacement. This allows effects that use the depth buffer ([Contact Shadows](../../../Override-Contact-Shadows.md) for example) to capture pixel displacement details. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/subsurface-scattering.md b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/subsurface-scattering.md
new file mode 100644
index 00000000000..f55f1dde80f
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/snippets/shader-properties/surface-options/subsurface-scattering.md
@@ -0,0 +1,4 @@
+
+**Subsurface Scattering** |
+Indicates whether the Material supports subsurface scattering. To disable subsurface scattering in specific regions of the Material, use the **Subsurface Mask**. |
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/ss-context-fragment.md b/com.unity.render-pipelines.high-definition/Documentation~/ss-context-fragment.md
new file mode 100644
index 00000000000..d67f1d49333
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/ss-context-fragment.md
@@ -0,0 +1,92 @@
+# Fragment Context
+
+This Context represents the fragment stage of a shader. You can add [compatible Blocks](#compatible-blocks) to this Context to set properties for the final shader. Any Node you connect to a Block becomes part of the final shader's fragment function.
+
+## Compatible Blocks
+
+This section lists the Blocks that are compatible with Fragment Contexts in the High Definition Render Pipeline (HDRP). Each entry includes:
+
+- The Block's name.
+- A description of what the Block does.
+- Settings in the [Graph Settings menu](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Graph-Settings-Menu.html) that the Block is relevant to. If you enable these settings, Shader Graph adds the Block to the Context; if you disable the setting, Shader Graph removes the Block from the Context. If you add the Block and do not enable the setting, Shader Graph ignores the Block and its connected Nodes when it builds the final shader.
+- The default value that Shader Graph uses if you enable the Block's **Setting Dependency** then remove the Block from the Context.
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/ambient-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/alpha.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-postpass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-depth-prepass.md)]
+[!include[](snippets/shader-graph-blocks/alpha-clip-threshold-shadow.md)]
+[!include[](snippets/shader-graph-blocks/anisotropy.md)]
+[!include[](snippets/shader-graph-blocks/anisotropy-b.md)]
+[!include[](snippets/shader-graph-blocks/baked-back-gi.md)]
+[!include[](snippets/shader-graph-blocks/baked-gi.md)]
+[!include[](snippets/shader-graph-blocks/bent-normal.md)]
+[!include[](snippets/shader-graph-blocks/base-color.md)]
+[!include[](snippets/shader-graph-blocks/coat-extinction.md)]
+[!include[](snippets/shader-graph-blocks/coat-ior.md)]
+[!include[](snippets/shader-graph-blocks/coat-mask.md)]
+[!include[](snippets/shader-graph-blocks/coat-normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/coat-normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/coat-normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/coat-smoothness.md)]
+[!include[](snippets/shader-graph-blocks/coat-thickness.md)]
+[!include[](snippets/shader-graph-blocks/depth-offset.md)]
+[!include[](snippets/shader-graph-blocks/dielectric-ior.md)]
+[!include[](snippets/shader-graph-blocks/diffusion-profile.md)]
+[!include[](snippets/shader-graph-blocks/distortion.md)]
+[!include[](snippets/shader-graph-blocks/distortion-blur.md)]
+[!include[](snippets/shader-graph-blocks/emission.md)]
+[!include[](snippets/shader-graph-blocks/hair-strand-direction.md)]
+[!include[](snippets/shader-graph-blocks/haze-extent.md)]
+[!include[](snippets/shader-graph-blocks/haziness.md)]
+[!include[](snippets/shader-graph-blocks/hazy-gloss-max-dielectric-f0.md)]
+[!include[](snippets/shader-graph-blocks/ior.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-coat-fixup-tir.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-coat-fixup-tir-clamp.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-mask.md)]
+[!include[](snippets/shader-graph-blocks/iridescence-thickness.md)]
+[!include[](snippets/shader-graph-blocks/iris-normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/iris-normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/iris-normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/lobe-mix.md)]
+[!include[](snippets/shader-graph-blocks/maos-alpha.md)]
+[!include[](snippets/shader-graph-blocks/mask.md)]
+[!include[](snippets/shader-graph-blocks/metallic.md)]
+[!include[](snippets/shader-graph-blocks/normal-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-object-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-world-space.md)]
+[!include[](snippets/shader-graph-blocks/normal-alpha.md)]
+[!include[](snippets/shader-graph-blocks/refraction-color.md)]
+[!include[](snippets/shader-graph-blocks/refraction-distance.md)]
+[!include[](snippets/shader-graph-blocks/refraction-index.md)]
+[!include[](snippets/shader-graph-blocks/rim-transmission-intensity.md)]
+[!include[](snippets/shader-graph-blocks/secondary-smoothness.md)]
+[!include[](snippets/shader-graph-blocks/secondary-specular-shift.md)]
+[!include[](snippets/shader-graph-blocks/secondary-specular-tint.md)]
+[!include[](snippets/shader-graph-blocks/shadow-tint.md)]
+[!include[](snippets/shader-graph-blocks/smoothness.md)]
+[!include[](snippets/shader-graph-blocks/smoothness-b.md)]
+[!include[](snippets/shader-graph-blocks/specular-color.md)]
+[!include[](snippets/shader-graph-blocks/so-fixup-max-added-roughness.md)]
+[!include[](snippets/shader-graph-blocks/so-fixup-strength-factor.md)]
+[!include[](snippets/shader-graph-blocks/so-fixup-visibility-ratio-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-screen-space-variance.md)]
+[!include[](snippets/shader-graph-blocks/specular-aa-threshold.md)]
+[!include[](snippets/shader-graph-blocks/specular-occlusion.md)]
+[!include[](snippets/shader-graph-blocks/specular-shift.md)]
+[!include[](snippets/shader-graph-blocks/specular-tint.md)]
+[!include[](snippets/shader-graph-blocks/subsurface-mask.md)]
+[!include[](snippets/shader-graph-blocks/tangent-object-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-tangent-space.md)]
+[!include[](snippets/shader-graph-blocks/tangent-world-space.md)]
+[!include[](snippets/shader-graph-blocks/thickness.md)]
+[!include[](snippets/shader-graph-blocks/transmittance.md)]
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/ss-context-vertex.md b/com.unity.render-pipelines.high-definition/Documentation~/ss-context-vertex.md
new file mode 100644
index 00000000000..ac33c4fec4a
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/ss-context-vertex.md
@@ -0,0 +1,24 @@
+# Vertex Context
+
+This Context represents the vertex stage of a shader. Any Node you connect to a Block in this Context becomes part of the final shader's vertex function.
+
+## Compatible Blocks
+
+This section lists the Blocks that are compatible with Vertex Contexts in the High Definition Render Pipeline (HDRP). Each entry includes:
+
+- The Block's name.
+- A description of what the Block does.
+- Settings in the [Graph Settings menu](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Graph-Settings-Menu.html) that the Block is relevant to. If you enable these settings, Shader Graph adds the Block to the Context; if you disable the setting, Shader Graph removes the Block from the Context. If you add the Block and do not enable the setting, Shader Graph ignores the Block and its connected Nodes when it builds the final shader.
+- The default value that Shader Graph uses if you enable the Block's **Setting Dependency** then remove the Block from the Context.
+
+
+
+Property |
+Description |
+Setting Dependency |
+Default Value |
+
+[!include[](snippets/shader-graph-blocks/vertex-position.md)]
+[!include[](snippets/shader-graph-blocks/vertex-normal.md)]
+[!include[](snippets/shader-graph-blocks/vertex-tangent.md)]
+
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/ss-contexts-and-blocks.md b/com.unity.render-pipelines.high-definition/Documentation~/ss-contexts-and-blocks.md
new file mode 100644
index 00000000000..6b469424585
--- /dev/null
+++ b/com.unity.render-pipelines.high-definition/Documentation~/ss-contexts-and-blocks.md
@@ -0,0 +1,15 @@
+# Contexts and Blocks
+
+This section contains reference documentation for the Shader Graph [Contexts](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Master-Stack.html%23contexts) available in the High Definition Render Pipeline (HDRP). Each page describes the Context itself, the shader stage the Context represents, and the list of compatible HDRP-specific [Blocks](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Block-Node.html).
+
+In HDRP, many Blocks exist solely to set properties relevant for particular settings in the [Graph Settings menu](https://docs.unity3d.com/Packages/com.unity.shadergraph@latest/index.html?subfolder=/manual/Graph-Settings-Menu.html). If you enable one of these settings, Shader Graph automatically adds any Block relevant for that setting to the Context. If you disable the setting, Shader Graph automatically removes the relevant Blocks from the Context.
+
+This relationship between settings and Blocks has the following consequences:
+
+- If you enable a setting and delete any of its relevant Blocks, the Context uses the deleted Block's **Default Value** when Shader Graph builds the final shader.
+- If you add a Block relevant to a particular setting and don't enable that setting, Shader Graph ignores the Block and any connected Nodes when it builds the final Shader.
+
+The list of Contexts is as follows:
+
+- [Vertex Context](ss-context-vertex.md)
+- [Fragment Context](ss-context-fragment.md)
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10.md
index adc0f809638..c2b75442424 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-10.md
@@ -239,7 +239,7 @@ In terms of performance, one of the most resource intensive operations for HDRP
### Decal improvement
-HDRP no longer forces a full depth pre-pass when you enable decals in Deferred Lit Mode. Only materials with the **Receive Decals** property enabled render in the pre-pass. Decal shader code has improved and now produces fewer shader variants and includes better UI to control which material attributes the decal affects. Finally, the [Decal Shader Graph](Master-Node-Decal.md) now exposes affects flags control on the Material.
+HDRP no longer forces a full depth pre-pass when you enable decals in Deferred Lit Mode. Only materials with the **Receive Decals** property enabled render in the pre-pass. Decal shader code has improved and now produces fewer shader variants and includes better UI to control which material attributes the decal affects. Finally, the [Decal Master Stack](master-stack-decal.md) now exposes affects flags control on the Material.
### Constant buffer setup optimization
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-11.md b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-11.md
index 81d4a307c3c..9b2851f43c9 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/whats-new-11.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/whats-new-11.md
@@ -1,10 +1,10 @@
-# What's new in version 11
+# What's new in HDRP version 11 / Unity 2021.1
-This page contains an overview of new features, improvements, and issues resolved in version 11 of the High Definition Render Pipeline (HDRP).
+This page contains an overview of new features, improvements, and issues resolved in version 11 of the High Definition Render Pipeline (HDRP), embedded in Unity 2021.1.
## Features
-The following is a list of features Unity added to version 11 of the High Definition Render Pipeline. Each entry includes a summary of the feature and a link to any relevant documentation.
+The following is a list of features Unity added to version 11 of the High Definition Render Pipeline, embedded in Unity 2021.1. Each entry includes a summary of the feature and a link to any relevant documentation.
### Mixed cached shadow maps
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs
index 1e49ab162e6..79d7f9ba006 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/CustomPass/DrawRenderersCustomPassDrawer.cs
@@ -29,7 +29,7 @@ private class Styles
//Headers
public static GUIContent filtersHeader = new GUIContent("Filters", "Filters.");
- public static GUIContent renderHeader = new GUIContent("Overrides", "Different parts fo the rendering that you can choose to override.");
+ public static GUIContent renderHeader = new GUIContent("Overrides", "Different parts of the rendering that you can choose to override.");
//Filters
public static GUIContent renderQueueFilter = new GUIContent("Queue", "Filter the render queue range you want to render.");
@@ -40,11 +40,11 @@ private class Styles
public static GUIContent overrideMaterial = new GUIContent("Material", "Chose an override material, every renderer will be rendered with this material.");
public static GUIContent overrideMaterialPass = new GUIContent("Pass Name", "The pass for the override material to use.");
public static GUIContent sortingCriteria = new GUIContent("Sorting", "Sorting settings used to render objects in a certain order.");
- public static GUIContent shaderPass = new GUIContent("Shader Pass", "Sets which pass will be used to render the materials. If the pass does not exists, the material will not be rendered.");
+ public static GUIContent shaderPass = new GUIContent("Shader Pass", "Sets which pass will be used to render the materials. If the pass does not exist, the material will not be rendered.");
//Depth Settings
public static GUIContent overrideDepth = new GUIContent("Override Depth", "Override depth state of the objects rendered.");
- public static GUIContent depthWrite = new GUIContent("Write Depth", "Chose to write depth to the screen.");
+ public static GUIContent depthWrite = new GUIContent("Write Depth", "Choose to write depth to the screen.");
public static GUIContent depthCompareFunction = new GUIContent("Depth Test", "Choose a new test setting for the depth.");
//Camera Settings
@@ -54,9 +54,9 @@ private class Styles
public static GUIContent restoreCamera = new GUIContent("Restore", "Restore to the original camera projection before this pass.");
public static string unlitShaderMessage = "HDRP Unlit shaders will force the shader passes to \"ForwardOnly\"";
- public static string hdrpLitShaderMessage = "HDRP Lit shaders are not supported in a custom pass";
- public static string opaqueObjectWithDeferred = "Your HDRP settings does not support ForwardOnly, some object might not render.";
- public static string objectRendererTwiceWithMSAA = "MSAA is enabled, re-rendering same object twice will cause depth test artifacts in Before/After Post Process injection points";
+ public static string hdrpLitShaderMessage = "HDRP Lit shaders are not supported in a Custom Pass";
+ public static string opaqueObjectWithDeferred = "Your HDRP settings do not support ForwardOnly, some objects might not render.";
+ public static string objectRendererTwiceWithMSAA = "MSAA is enabled, re-rendering the same object twice will cause depth test artifacts in Before/After Post Process injection points";
}
//Headers and layout
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs
index 99504017493..abc89436f37 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Light/HDAdditionalLightData.cs
@@ -1663,7 +1663,8 @@ internal int shadowPrecision
// Data for cached shadow maps
[System.NonSerialized]
internal int lightIdxForCachedShadows = -1;
- Vector3 m_CachedViewPos = new Vector3(0, 0, 0);
+
+ Vector3[] m_CachedViewPositions;
[System.NonSerialized]
@@ -1985,11 +1986,12 @@ internal void ReserveShadowMap(Camera camera, HDShadowManager shadowManager, HDS
return;
// Create shadow requests array using the light type
- if (shadowRequests == null || m_ShadowRequestIndices == null)
+ if (shadowRequests == null || m_ShadowRequestIndices == null || m_CachedViewPositions == null)
{
const int maxLightShadowRequestsCount = 6;
shadowRequests = new HDShadowRequest[maxLightShadowRequestsCount];
m_ShadowRequestIndices = new int[maxLightShadowRequestsCount];
+ m_CachedViewPositions = new Vector3[maxLightShadowRequestsCount];
for (int i = 0; i < maxLightShadowRequestsCount; i++)
{
@@ -2210,9 +2212,12 @@ internal int UpdateShadowRequest(HDCamera hdCamera, HDShadowManager manager, HDS
if (shadowRequestIndex == -1)
continue;
+ shadowRequest.dynamicAtlasViewport = resolutionRequest.dynamicAtlasViewport;
+ shadowRequest.cachedAtlasViewport = resolutionRequest.cachedAtlasViewport;
+
if (needToUpdateCachedContent)
{
- m_CachedViewPos = cameraPos;
+ m_CachedViewPositions[index] = cameraPos;
shadowRequest.cachedShadowData.cacheTranslationDelta = new Vector3(0.0f, 0.0f, 0.0f);
// Write per light type matrices, splitDatas and culling parameters
@@ -2224,7 +2229,7 @@ internal int UpdateShadowRequest(HDCamera hdCamera, HDShadowManager manager, HDS
}
else if (hasCachedComponent)
{
- shadowRequest.cachedShadowData.cacheTranslationDelta = cameraPos - m_CachedViewPos;
+ shadowRequest.cachedShadowData.cacheTranslationDelta = cameraPos - m_CachedViewPositions[index];
shadowRequest.shouldUseCachedShadowData = true;
shadowRequest.shouldRenderCachedComponent = false;
// If directional we still need to calculate the split data.
@@ -2241,8 +2246,6 @@ internal int UpdateShadowRequest(HDCamera hdCamera, HDShadowManager manager, HDS
UpdateShadowRequestData(hdCamera, manager, shadowSettings, visibleLight, cullResults, lightIndex, lightingDebugSettings, filteringQuality, viewportSize, lightType, index, ref shadowRequest);
}
- shadowRequest.dynamicAtlasViewport = resolutionRequest.dynamicAtlasViewport;
- shadowRequest.cachedAtlasViewport = resolutionRequest.cachedAtlasViewport;
manager.UpdateShadowRequest(shadowRequestIndex, shadowRequest, updateType);
if (needToUpdateCachedContent)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs
index 751a1061b1a..40967976b88 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs
@@ -132,10 +132,13 @@ struct LightData
public float iesCut; // Spot light
public GPULightType lightType; // TODO: move this up?
-
public Vector3 right; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeWidth)
+
+ public float penumbraTint;
[SurfaceDataAttributes(precision = FieldPrecision.Real)]
public float range;
+ public CookieMode cookieMode;
+ public int shadowIndex; // -1 if unused (TODO: 16 bit)
public Vector3 up; // If spot: rescaled by cot(outerHalfAngle); if projector: rescaled by (2 / shapeHeight)
public float rangeAttenuationScale;
@@ -143,12 +146,7 @@ struct LightData
public Vector3 color;
public float rangeAttenuationBias;
- public CookieMode cookieMode;
-
- public int shadowIndex; // -1 if unused (TODO: 16 bit)
-
public Vector4 cookieScaleOffset; // coordinates of the cookie texture in the atlas
- public int contactShadowMask; // negative if unused (TODO: 16 bit)
public Vector3 shadowTint; // Use to tint shadow color
public float shadowDimmer;
@@ -166,12 +164,13 @@ struct LightData
[SurfaceDataAttributes(precision = FieldPrecision.Real)]
public Vector4 size; // Used by area (X = length or width, Y = height, Z = CosBarnDoorAngle, W = BarnDoorLength) and punctual lights (X = radius)
+ public int contactShadowMask; // negative if unused (TODO: 16 bit)
public float diffuseDimmer;
public float specularDimmer;
- public float isRayTracedContactShadow;
- public float penumbraTint;
+ public float __unused__;
- public Vector3 padding;
+ public Vector2 padding;
+ public float isRayTracedContactShadow;
public float boxLightSafeExtent;
};
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl
index 1bba5923ff4..922e14189b8 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightDefinition.cs.hlsl
@@ -100,15 +100,15 @@ struct LightData
float iesCut;
int lightType;
float3 right;
+ float penumbraTint;
real range;
+ int cookieMode;
+ int shadowIndex;
float3 up;
float rangeAttenuationScale;
float3 color;
float rangeAttenuationBias;
- int cookieMode;
- int shadowIndex;
float4 cookieScaleOffset;
- int contactShadowMask;
float3 shadowTint;
float shadowDimmer;
float volumetricShadowDimmer;
@@ -117,11 +117,12 @@ struct LightData
int screenSpaceShadowIndex;
real4 shadowMaskSelector;
real4 size;
+ int contactShadowMask;
float diffuseDimmer;
float specularDimmer;
+ float __unused__;
+ float2 padding;
float isRayTracedContactShadow;
- float penumbraTint;
- float3 padding;
float boxLightSafeExtent;
};
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs
index 7250f39734e..ba120c65e99 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.RenderGraph.cs
@@ -10,7 +10,8 @@ TextureHandle CreateAmbientOcclusionTexture(RenderGraph renderGraph)
return renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true) { enableRandomWrite = true, colorFormat = GraphicsFormat.R8_UNorm, name = "Ambient Occlusion" });
}
- public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectors, in HDUtils.PackedMipChainInfo depthMipInfo, ShaderVariablesRaytracing shaderVariablesRaytracing, TextureHandle rayCountTexture)
+ public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle historyValidityBuffer,
+ in HDUtils.PackedMipChainInfo depthMipInfo, ShaderVariablesRaytracing shaderVariablesRaytracing, TextureHandle rayCountTexture)
{
var settings = hdCamera.volumeStack.GetComponent();
@@ -31,7 +32,8 @@ public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureH
hdCamera.AllocateAmbientOcclusionHistoryBuffer(scaleFactor);
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing) && settings.rayTracing.value)
- return m_RaytracingAmbientOcclusion.RenderRTAO(renderGraph, hdCamera, depthPyramid, normalBuffer, motionVectors, rayCountTexture, shaderVariablesRaytracing);
+ return m_RaytracingAmbientOcclusion.RenderRTAO(renderGraph, hdCamera, depthBuffer, normalBuffer, motionVectors, historyValidityBuffer,
+ rayCountTexture, shaderVariablesRaytracing);
else
{
var historyRT = hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.AmbientOcclusion);
@@ -44,9 +46,9 @@ public TextureHandle Render(RenderGraph renderGraph, HDCamera hdCamera, TextureH
var aoParameters = PrepareRenderAOParameters(hdCamera, historySize * rtScaleForHistory, depthMipInfo);
- var packedData = RenderAO(renderGraph, aoParameters, depthPyramid, normalBuffer);
- result = DenoiseAO(renderGraph, aoParameters, depthPyramid, motionVectors, packedData, currentHistory, outputHistory);
- result = UpsampleAO(renderGraph, aoParameters, result, depthPyramid);
+ var packedData = RenderAO(renderGraph, aoParameters, depthBuffer, normalBuffer);
+ result = DenoiseAO(renderGraph, aoParameters, depthBuffer, motionVectors, packedData, currentHistory, outputHistory);
+ result = UpsampleAO(renderGraph, aoParameters, result, depthBuffer);
}
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute
index 3117b954c1a..a663ae28e27 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ContactShadows.compute
@@ -2,10 +2,6 @@
#pragma multi_compile _ ENABLE_MSAA
-#ifdef SHADER_API_PSSL
-# pragma argument( scheduler=minpressure ) // instruct the shader compiler to prefer minimizing vgpr usage
-#endif
-
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/ShaderLibrary/ShaderVariables.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/NormalBuffer.hlsl"
@@ -16,6 +12,10 @@
#pragma only_renderers d3d11 playstation xboxone xboxseries vulkan metal switch
+#ifdef SHADER_API_PSSL
+#include SHADER_COMPILER_GLOBAL_OPTIMIZE_REGISTER_USAGE
+#endif
+
// #pragma enable_d3d11_debug_symbols
#ifdef ENABLE_MSAA
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs
index 6ad6d110b52..f34fec4d4fc 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowAtlas.cs
@@ -30,16 +30,24 @@ struct CachedTransform
internal Vector3 angles; // Only for area and spot
}
+ enum SlotValue : byte
+ {
+ Free,
+ Occupied,
+ TempOccupied // Used when checking if it will fit.
+ }
+
private int m_AtlasResolutionInSlots; // Atlas Resolution / m_MinSlotSize
private bool m_NeedOptimalPacking = true; // Whenever this is set to true, the pending lights are sorted before insertion.
- private List m_AtlasSlots; // One entry per slot (of size m_MinSlotSize) true if occupied, false if free.
+ private List m_AtlasSlots; // One entry per slot (of size m_MinSlotSize) true if occupied, false if free.
// Note: Some of these could be simple lists, but since we might need to search by index some of them and we want to avoid GC alloc, a dictionary is easier.
// This also mean slightly worse performance, however hopefully the number of cached shadow lights is not huge at any tie.
private Dictionary m_PlacedShadows;
private Dictionary m_ShadowsPendingRendering;
+ private Dictionary m_ShadowsWithValidData; // Shadows that have been placed and rendered at least once (OnDemand shadows are not rendered unless requested explicitly). It is a dictionary for fast access by shadow index.
private Dictionary m_RegisteredLightDataPendingPlacement;
private Dictionary m_RecordsPendingPlacement; // Note: this is different from m_RegisteredLightDataPendingPlacement because it contains records that were allocated in the system
// but they lost their spot (e.g. post defrag). They don't have a light associated anymore if not by index, so we keep a separate collection.
@@ -57,6 +65,7 @@ public HDCachedShadowAtlas(ShadowMapType type)
{
m_PlacedShadows = new Dictionary(s_InitialCapacity);
m_ShadowsPendingRendering = new Dictionary(s_InitialCapacity);
+ m_ShadowsWithValidData = new Dictionary(s_InitialCapacity);
m_TempListForPlacement = new List(s_InitialCapacity);
m_RegisteredLightDataPendingPlacement = new Dictionary(s_InitialCapacity);
@@ -73,10 +82,10 @@ public override void InitAtlas(RenderPipelineResources renderPipelineResources,
m_IsACacheForShadows = true;
m_AtlasResolutionInSlots = HDUtils.DivRoundUp(width, m_MinSlotSize);
- m_AtlasSlots = new List(m_AtlasResolutionInSlots * m_AtlasResolutionInSlots);
+ m_AtlasSlots = new List(m_AtlasResolutionInSlots * m_AtlasResolutionInSlots);
for (int i = 0; i < m_AtlasResolutionInSlots * m_AtlasResolutionInSlots; ++i)
{
- m_AtlasSlots.Add(false);
+ m_AtlasSlots.Add(SlotValue.Free);
}
// Note: If changing the characteristics of the atlas via HDRP asset, the lights OnEnable will not be called again so we are missing them, however we can explicitly
@@ -108,21 +117,26 @@ public void AddBlitRequestsForUpdatedShadows(HDDynamicShadowAtlas dynamicAtlas)
// ------------------------------------------------------------------------------------------
private bool IsEntryEmpty(int x, int y)
{
- return (m_AtlasSlots[y * m_AtlasResolutionInSlots + x] == false);
+ return (m_AtlasSlots[y * m_AtlasResolutionInSlots + x] == SlotValue.Free);
}
private bool IsEntryFull(int x, int y)
{
- return (m_AtlasSlots[y * m_AtlasResolutionInSlots + x]);
+ return (m_AtlasSlots[y * m_AtlasResolutionInSlots + x]) != SlotValue.Free;
+ }
+
+ private bool IsEntryTempOccupied(int x, int y)
+ {
+ return (m_AtlasSlots[y * m_AtlasResolutionInSlots + x]) == SlotValue.TempOccupied;
}
// Always fill slots in a square shape, for example : if x = 1 and y = 2, if numEntries = 2 it will fill {(1,2),(2,2),(1,3),(2,3)}
private void FillEntries(int x, int y, int numEntries)
{
- MarkEntries(x, y, numEntries, true);
+ MarkEntries(x, y, numEntries, SlotValue.Occupied);
}
- private void MarkEntries(int x, int y, int numEntries, bool value)
+ private void MarkEntries(int x, int y, int numEntries, SlotValue value)
{
for (int j = y; j < y + numEntries; ++j)
{
@@ -149,10 +163,9 @@ private bool CheckSlotAvailability(int x, int y, int numEntries)
return true;
}
- internal bool FindSlotInAtlas(int resolution, out int x, out int y)
+ internal bool FindSlotInAtlas(int resolution, bool tempFill, out int x, out int y)
{
int numEntries = HDUtils.DivRoundUp(resolution, m_MinSlotSize);
-
for (int j = 0; j < m_AtlasResolutionInSlots; ++j)
{
for (int i = 0; i < m_AtlasResolutionInSlots; ++i)
@@ -161,6 +174,10 @@ internal bool FindSlotInAtlas(int resolution, out int x, out int y)
{
x = i;
y = j;
+
+ if (tempFill)
+ MarkEntries(x, y, numEntries, SlotValue.TempOccupied);
+
return true;
}
}
@@ -171,6 +188,26 @@ internal bool FindSlotInAtlas(int resolution, out int x, out int y)
return false;
}
+ internal void FreeTempFilled(int x, int y, int resolution)
+ {
+ int numEntries = HDUtils.DivRoundUp(resolution, m_MinSlotSize);
+ for (int j = y; j < y + numEntries; ++j)
+ {
+ for (int i = x; i < x + numEntries; ++i)
+ {
+ if (m_AtlasSlots[j * m_AtlasResolutionInSlots + i] == SlotValue.TempOccupied)
+ {
+ m_AtlasSlots[j * m_AtlasResolutionInSlots + i] = SlotValue.Free;
+ }
+ }
+ }
+ }
+
+ internal bool FindSlotInAtlas(int resolution, out int x, out int y)
+ {
+ return FindSlotInAtlas(resolution, false, out x, out y);
+ }
+
internal bool GetSlotInAtlas(int resolution, out int x, out int y)
{
if (FindSlotInAtlas(resolution, out x, out y))
@@ -241,8 +278,9 @@ internal void EvictLight(HDAdditionalLightData lightData)
#endif
m_PlacedShadows.Remove(shadowIdx);
m_ShadowsPendingRendering.Remove(shadowIdx);
+ m_ShadowsWithValidData.Remove(shadowIdx);
- MarkEntries((int)recordToRemove.offsetInAtlas.z, (int)recordToRemove.offsetInAtlas.w, HDUtils.DivRoundUp(recordToRemove.viewportSize, m_MinSlotSize), false);
+ MarkEntries((int)recordToRemove.offsetInAtlas.z, (int)recordToRemove.offsetInAtlas.w, HDUtils.DivRoundUp(recordToRemove.viewportSize, m_MinSlotSize), SlotValue.Free);
m_CanTryPlacement = true;
}
}
@@ -362,7 +400,7 @@ private bool PlaceMultipleShadows(int startIdx, int numberOfShadows)
int numEntries = HDUtils.DivRoundUp(m_TempListForPlacement[startIdx].viewportSize, m_MinSlotSize);
for (int j = 0; j < successfullyPlaced; ++j)
{
- MarkEntries(placements[j].x, placements[j].y, numEntries, false);
+ MarkEntries(placements[j].x, placements[j].y, numEntries, SlotValue.Free);
}
}
@@ -446,12 +484,13 @@ internal void DefragmentAtlasAndReRender(HDShadowInitParameters initParams)
for (int i = 0; i < m_AtlasResolutionInSlots * m_AtlasResolutionInSlots; ++i)
{
- m_AtlasSlots[i] = false;
+ m_AtlasSlots[i] = SlotValue.Free;
}
// Clear the other state lists.
m_PlacedShadows.Clear();
m_ShadowsPendingRendering.Clear();
+ m_ShadowsWithValidData.Clear();
m_RecordsPendingPlacement.Clear(); // We'll reset what records are pending.
// Sort in order to obtain a more optimal packing.
@@ -495,6 +534,33 @@ internal bool ShadowIsPendingRendering(int shadowIdx)
return m_ShadowsPendingRendering.ContainsKey(shadowIdx);
}
+ internal bool ShadowHasRenderedAtLeastOnce(int shadowIdx)
+ {
+ return m_ShadowsWithValidData.ContainsKey(shadowIdx);
+ }
+
+ internal bool FullLightShadowHasRenderedAtLeastOnce(HDAdditionalLightData lightData)
+ {
+ int cachedShadowIdx = lightData.lightIdxForCachedShadows;
+ if (lightData.type == HDLightType.Point)
+ {
+ bool allRendered = true;
+ for (int i = 0; i < 6; ++i)
+ {
+ allRendered = allRendered && m_ShadowsWithValidData.ContainsKey(cachedShadowIdx + i);
+ }
+
+ return allRendered;
+ }
+ return m_ShadowsWithValidData.ContainsKey(cachedShadowIdx);
+ }
+
+ internal bool LightIsPlaced(HDAdditionalLightData lightData)
+ {
+ int cachedShadowIdx = lightData.lightIdxForCachedShadows;
+ return cachedShadowIdx >= 0 && m_PlacedShadows.ContainsKey(cachedShadowIdx);
+ }
+
internal void ScheduleShadowUpdate(HDAdditionalLightData lightData)
{
if (!lightData.isActiveAndEnabled) return;
@@ -542,6 +608,7 @@ internal void MarkAsRendered(int shadowIdx)
if (m_ShadowsPendingRendering.ContainsKey(shadowIdx))
{
m_ShadowsPendingRendering.Remove(shadowIdx);
+ m_ShadowsWithValidData.Add(shadowIdx, shadowIdx);
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowManager.cs
index d2736bd13ee..29fea17419d 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDCachedShadowManager.cs
@@ -19,9 +19,13 @@ public class HDCachedShadowManager
// Data for cached directional light shadows.
private const int m_MaxShadowCascades = 4;
private bool[] m_DirectionalShadowPendingUpdate = new bool[m_MaxShadowCascades];
+ private bool[] m_DirectionalShadowHasRendered = new bool[m_MaxShadowCascades];
private Vector3 m_CachedDirectionalForward;
private Vector3 m_CachedDirectionalAngles;
+ // Helper array used to check what has been tmp filled.
+ private (int, int)[] m_TempFilled = new(int, int)[6];
+
// Cached atlas
internal HDCachedShadowAtlas punctualShadowAtlas;
internal HDCachedShadowAtlas areaShadowAtlas;
@@ -76,13 +80,34 @@ internal void PrintLightStatusInCachedAtlas()
public bool WouldFitInAtlas(int shadowResolution, HDLightType lightType)
{
bool fits = true;
- int x, y;
+ int x = 0;
+ int y = 0;
if (lightType == HDLightType.Point)
{
+ int fitted = 0;
for (int i = 0; i < 6; ++i)
{
- fits = fits && HDShadowManager.cachedShadowManager.punctualShadowAtlas.FindSlotInAtlas(shadowResolution, out x, out y);
+ fits = fits && HDShadowManager.cachedShadowManager.punctualShadowAtlas.FindSlotInAtlas(shadowResolution, true, out x, out y);
+ if (fits)
+ {
+ m_TempFilled[fitted++] = (x, y);
+ }
+ else
+ {
+ // Free the temp filled ones.
+ for (int filled = 0; filled < fitted; ++filled)
+ {
+ HDShadowManager.cachedShadowManager.punctualShadowAtlas.FreeTempFilled(m_TempFilled[filled].Item1, m_TempFilled[filled].Item2, shadowResolution);
+ }
+ return false;
+ }
+ }
+
+ // Free the temp filled ones.
+ for (int filled = 0; filled < fitted; ++filled)
+ {
+ HDShadowManager.cachedShadowManager.punctualShadowAtlas.FreeTempFilled(m_TempFilled[filled].Item1, m_TempFilled[filled].Item2, shadowResolution);
}
}
@@ -95,6 +120,22 @@ public bool WouldFitInAtlas(int shadowResolution, HDLightType lightType)
return fits;
}
+ ///
+ /// This function verifies if the shadow map for the passed light would fit in the atlas when inserted.
+ ///
+ /// The light that we try to fit in the atlas.
+ /// True if the shadow map would fit in the atlas, false otherwise. If lightData does not cast shadows, false is returned.
+ public bool WouldFitInAtlas(HDAdditionalLightData lightData)
+ {
+ if (lightData.legacyLight.shadows != LightShadows.None)
+ {
+ var lightType = lightData.type;
+ var resolution = lightData.GetResolutionFromSettings(lightData.GetShadowMapType(lightType), m_InitParams);
+ return WouldFitInAtlas(resolution, lightType);
+ }
+ return false;
+ }
+
///
/// If a light is added after a scene is loaded, its placement in the atlas might be not optimal and the suboptimal placement might prevent a light to find a place in the atlas.
/// This function will force a defragmentation of the atlas containing lights of type lightType and redistributes the shadows inside so that the placement is optimal. Note however that this will also mark the shadow maps
@@ -133,6 +174,88 @@ public void ForceRegisterLight(HDAdditionalLightData lightData)
RegisterLight(lightData);
}
+ ///
+ /// This function verifies if the light has its shadow maps placed in the cached shadow atlas.
+ ///
+ /// The light that we want to check the placement of.
+ /// True if the shadow map is already placed in the atlas, false otherwise.
+ public bool LightHasBeenPlacedInAtlas(HDAdditionalLightData lightData)
+ {
+ var lightType = lightData.type;
+ if (lightType == HDLightType.Area)
+ return instance.areaShadowAtlas.LightIsPlaced(lightData);
+ if (lightType == HDLightType.Point || lightType == HDLightType.Spot)
+ return instance.punctualShadowAtlas.LightIsPlaced(lightData);
+ if (lightType == HDLightType.Directional)
+ return !lightData.ShadowIsUpdatedEveryFrame();
+
+ return false;
+ }
+
+ ///
+ /// This function verifies if the light has its shadow maps placed in the cached shadow atlas and if it was rendered at least once.
+ ///
+ /// The light that we want to check.
+ /// Optional parameter required only when querying data about a directional light. It needs to match the number of cascades used by the directional light.
+ /// True if the shadow map is already placed in the atlas and rendered at least once, false otherwise.
+ public bool LightHasBeenPlaceAndRenderedAtLeastOnce(HDAdditionalLightData lightData, int numberOfCascades = 0)
+ {
+ var lightType = lightData.type;
+ if (lightType == HDLightType.Area)
+ {
+ return instance.areaShadowAtlas.LightIsPlaced(lightData) && instance.areaShadowAtlas.FullLightShadowHasRenderedAtLeastOnce(lightData);
+ }
+ if (lightType == HDLightType.Point || lightType == HDLightType.Spot)
+ {
+ return instance.punctualShadowAtlas.LightIsPlaced(lightData) && instance.punctualShadowAtlas.FullLightShadowHasRenderedAtLeastOnce(lightData);
+ }
+ if (lightType == HDLightType.Directional)
+ {
+ Debug.Assert(numberOfCascades <= m_MaxShadowCascades, "numberOfCascades is bigger than the maximum cascades allowed");
+ bool hasRendered = true;
+ for (int i = 0; i < numberOfCascades; ++i)
+ {
+ hasRendered = hasRendered && m_DirectionalShadowHasRendered[i];
+ }
+ return !lightData.ShadowIsUpdatedEveryFrame() && hasRendered;
+ }
+
+ return false;
+ }
+
+ ///
+ /// This function verifies if the light if a specific sub-shadow maps is placed in the cached shadow atlas and if it was rendered at least once.
+ ///
+ /// The light that we want to check.
+ /// The sub-shadow index (e.g. cascade index or point light face). It is ignored when irrelevant to the light type.
+ /// True if the shadow map is already placed in the atlas and rendered at least once, false otherwise.
+ public bool ShadowHasBeenPlaceAndRenderedAtLeastOnce(HDAdditionalLightData lightData, int shadowIndex)
+ {
+ var lightType = lightData.type;
+ if (lightType == HDLightType.Area)
+ {
+ return instance.areaShadowAtlas.LightIsPlaced(lightData) && instance.areaShadowAtlas.ShadowHasRenderedAtLeastOnce(lightData.lightIdxForCachedShadows);
+ }
+ if (lightType == HDLightType.Spot)
+ {
+ return instance.punctualShadowAtlas.LightIsPlaced(lightData) && instance.punctualShadowAtlas.ShadowHasRenderedAtLeastOnce(lightData.lightIdxForCachedShadows);
+ }
+ if (lightType == HDLightType.Point || lightType == HDLightType.Spot)
+ {
+ if (lightType == HDLightType.Point)
+ Debug.Assert(shadowIndex < 6, "Shadow Index is bigger than the available sub-shadows");
+
+ return instance.punctualShadowAtlas.LightIsPlaced(lightData) && instance.punctualShadowAtlas.ShadowHasRenderedAtLeastOnce(lightData.lightIdxForCachedShadows + shadowIndex);
+ }
+ if (lightType == HDLightType.Directional)
+ {
+ Debug.Assert(shadowIndex < m_MaxShadowCascades, "Shadow Index is bigger than the maximum cascades allowed");
+ return !lightData.ShadowIsUpdatedEveryFrame() && m_DirectionalShadowHasRendered[shadowIndex];
+ }
+
+ return false;
+ }
+
// ------------------------------------------------------------------------------------------------------------------
private void MarkAllDirectionalShadowsForUpdate()
@@ -140,6 +263,7 @@ private void MarkAllDirectionalShadowsForUpdate()
for (int i = 0; i < m_MaxShadowCascades; ++i)
{
m_DirectionalShadowPendingUpdate[i] = true;
+ m_DirectionalShadowHasRendered[i] = false;
}
}
@@ -277,7 +401,10 @@ internal void MarkShadowAsRendered(int shadowIdx, ShadowMapType shadowMapType)
if (shadowMapType == ShadowMapType.AreaLightAtlas)
areaShadowAtlas.MarkAsRendered(shadowIdx);
if (shadowMapType == ShadowMapType.CascadedDirectional)
+ {
m_DirectionalShadowPendingUpdate[shadowIdx] = false;
+ m_DirectionalShadowHasRendered[shadowIdx] = true;
+ }
}
internal void UpdateResolutionRequest(ref HDShadowResolutionRequest request, int shadowIdx, ShadowMapType shadowMapType)
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAlgorithms.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAlgorithms.hlsl
index 42b10834b90..fa61fd46465 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAlgorithms.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/HDShadowAlgorithms.hlsl
@@ -228,6 +228,7 @@ void LoadDirectionalShadowDatas(inout HDShadowData sd, HDShadowContext shadowCon
sd.shadowFilterParams0.x = shadowContext.shadowDatas[index].shadowFilterParams0.x;
sd.zBufferParam = shadowContext.shadowDatas[index].zBufferParam;
#endif
+ sd.cacheTranslationDelta = shadowContext.shadowDatas[index].cacheTranslationDelta;
}
float EvalShadow_CascadedDepth_Blend_SplitIndex(HDShadowContext shadowContext, Texture2D tex, SamplerComparisonState samp, float2 positionSS, float3 positionWS, float3 normalWS, int index, float3 L, out int shadowSplitIndex)
@@ -237,11 +238,13 @@ float EvalShadow_CascadedDepth_Blend_SplitIndex(HDShadowContext shadowContext, T
float shadow = 1.0;
shadowSplitIndex = EvalShadow_GetSplitIndex(shadowContext, index, positionWS, alpha, cascadeCount);
+ float3 basePositionWS = positionWS;
+
if (shadowSplitIndex >= 0.0)
{
HDShadowData sd = shadowContext.shadowDatas[index];
LoadDirectionalShadowDatas(sd, shadowContext, index + shadowSplitIndex);
- positionWS = positionWS + sd.cacheTranslationDelta.xyz;
+ positionWS = basePositionWS + sd.cacheTranslationDelta.xyz;
/* normal based bias */
float3 orig_pos = positionWS;
@@ -262,8 +265,9 @@ float EvalShadow_CascadedDepth_Blend_SplitIndex(HDShadowContext shadowContext, T
if (alpha > 0.0)
{
LoadDirectionalShadowDatas(sd, shadowContext, index + shadowSplitIndex);
+ float3 evaluationPosWS = basePositionWS + sd.cacheTranslationDelta.xyz + normalBias;
float3 posNDC;
- posTC = EvalShadow_GetTexcoordsAtlas(sd, _CascadeShadowAtlasSize.zw, positionWS, posNDC, false);
+ posTC = EvalShadow_GetTexcoordsAtlas(sd, _CascadeShadowAtlasSize.zw, evaluationPosWS, posNDC, false);
/* sample the texture */
UNITY_BRANCH
if (all(abs(posNDC.xy) <= (1.0 - sd.shadowMapSize.zw * 0.5)))
@@ -289,11 +293,13 @@ float EvalShadow_CascadedDepth_Dither_SplitIndex(HDShadowContext shadowContext,
float shadow = 1.0;
shadowSplitIndex = EvalShadow_GetSplitIndex(shadowContext, index, positionWS, alpha, cascadeCount);
+ float3 basePositionWS = positionWS;
+
if (shadowSplitIndex >= 0.0)
{
HDShadowData sd = shadowContext.shadowDatas[index];
LoadDirectionalShadowDatas(sd, shadowContext, index + shadowSplitIndex);
- positionWS = positionWS + sd.cacheTranslationDelta.xyz;
+ positionWS = basePositionWS + sd.cacheTranslationDelta.xyz;
/* normal based bias */
float worldTexelSize = sd.worldTexelSize;
@@ -306,6 +312,7 @@ float EvalShadow_CascadedDepth_Dither_SplitIndex(HDShadowContext shadowContext,
if (evalNextCascade)
{
LoadDirectionalShadowDatas(sd, shadowContext, index + nextSplit);
+ positionWS = basePositionWS + sd.cacheTranslationDelta.xyz;
float biasModifier = (sd.worldTexelSize / worldTexelSize);
normalBias *= biasModifier;
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.RenderGraph.cs
index 7032c5b9ca2..74be442863e 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.RenderGraph.cs
@@ -81,7 +81,9 @@ void WriteScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera, TextureH
}
}
- bool RenderLightScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamera, PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
+ bool RenderLightScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamera,
+ PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle historyValidityBuffer,
+ TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
{
// Loop through all the potential screen space light shadows
for (int lightIdx = 0; lightIdx < m_ScreenSpaceShadowIndex; ++lightIdx)
@@ -106,7 +108,7 @@ bool RenderLightScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamera, P
case GPULightType.Spot:
{
RenderPunctualScreenSpaceShadow(renderGraph, hdCamera, currentLight, currentAdditionalLightData, m_CurrentScreenSpaceShadowData[lightIdx].lightDataIndex,
- prepassOutput, depthBuffer, normalBuffer, motionVectorsBuffer, rayCountTexture, screenSpaceShadowArray);
+ prepassOutput, depthBuffer, normalBuffer, motionVectorsBuffer, historyValidityBuffer, rayCountTexture, screenSpaceShadowArray);
}
break;
}
@@ -135,7 +137,8 @@ bool RequestedScreenSpaceShadows()
return screenSpaceShadowDirectionalRequired || pointOrAreaLightShadowRequired;
}
- TextureHandle RenderScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamera, PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle rayCountTexture)
+ TextureHandle RenderScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamera,
+ PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle historyValidityBuffer, TextureHandle rayCountTexture)
{
// If screen space shadows are not supported for this camera, we are done
if (!hdCamera.frameSettings.IsEnabled(FrameSettingsField.ScreenSpaceShadows) || !RequestedScreenSpaceShadows())
@@ -147,12 +150,12 @@ TextureHandle RenderScreenSpaceShadows(RenderGraph renderGraph, HDCamera hdCamer
TextureHandle screenSpaceShadowTexture = CreateScreenSpaceShadowTextureArray(renderGraph);
// First of all we handle the directional light
- RenderDirectionalLightScreenSpaceShadow(renderGraph, hdCamera, depthBuffer, normalBuffer, motionVectorsBuffer, rayCountTexture, screenSpaceShadowTexture);
+ RenderDirectionalLightScreenSpaceShadow(renderGraph, hdCamera, depthBuffer, normalBuffer, motionVectorsBuffer, historyValidityBuffer, rayCountTexture, screenSpaceShadowTexture);
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing))
{
// We handle the other light sources
- RenderLightScreenSpaceShadows(renderGraph, hdCamera, prepassOutput, depthBuffer, normalBuffer, motionVectorsBuffer, rayCountTexture, screenSpaceShadowTexture);
+ RenderLightScreenSpaceShadows(renderGraph, hdCamera, prepassOutput, depthBuffer, normalBuffer, motionVectorsBuffer, historyValidityBuffer, rayCountTexture, screenSpaceShadowTexture);
}
// We render the debug view, if the texture is not used, it is not evaluated anyway
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.RenderGraph.cs
index 128855d1895..09829db400c 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.RenderGraph.cs
@@ -7,7 +7,7 @@ namespace UnityEngine.Rendering.HighDefinition
public partial class HDRenderPipeline
{
TextureHandle DenoiseDirectionalScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera,
- TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVetorsBuffer,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVetorsBuffer, TextureHandle historyValidityBuffer,
TextureHandle noisyBuffer, TextureHandle velocityBuffer, TextureHandle distanceBuffer)
{
// Is the history still valid?
@@ -26,7 +26,7 @@ TextureHandle DenoiseDirectionalScreenSpaceShadow(RenderGraph renderGraph, HDCam
// Apply the temporal denoiser
HDTemporalFilter temporalFilter = GetTemporalFilter();
HDTemporalFilter.TemporalDenoiserArrayOutputData temporalFilterResult = temporalFilter.DenoiseBuffer(renderGraph, hdCamera,
- depthBuffer, normalBuffer, motionVetorsBuffer,
+ depthBuffer, normalBuffer, motionVetorsBuffer, historyValidityBuffer,
noisyBuffer, shadowHistoryArray,
distanceBuffer, shadowHistoryDistanceArray,
velocityBuffer,
@@ -59,7 +59,9 @@ class RTSDirectionalTracePassData
public TextureHandle outputShadowBuffer;
}
- void RenderRayTracedDirectionalScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVetorsBuffer, TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
+ void RenderRayTracedDirectionalScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVetorsBuffer, TextureHandle historyValidityBuffer,
+ TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
{
TextureHandle directionalShadow;
TextureHandle velocityBuffer;
@@ -107,7 +109,7 @@ void RenderRayTracedDirectionalScreenSpaceShadow(RenderGraph renderGraph, HDCame
if (m_CurrentSunLightAdditionalLightData.filterTracedShadow && rtsdtParams.softShadow)
{
directionalShadow = DenoiseDirectionalScreenSpaceShadow(renderGraph, hdCamera,
- depthBuffer, normalBuffer, motionVetorsBuffer,
+ depthBuffer, normalBuffer, motionVetorsBuffer, historyValidityBuffer,
directionalShadow, velocityBuffer, distanceBuffer);
}
@@ -125,7 +127,9 @@ class SSSDirectionalTracePassData
public TextureHandle screenSpaceShadowArray;
}
- void RenderDirectionalLightScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
+ void RenderDirectionalLightScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle historyValidityBuffer,
+ TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
{
// Should we be executing anything really?
bool screenSpaceShadowRequired = m_CurrentSunLightAdditionalLightData != null && m_CurrentSunLightAdditionalLightData.WillRenderScreenSpaceShadow();
@@ -136,7 +140,7 @@ void RenderDirectionalLightScreenSpaceShadow(RenderGraph renderGraph, HDCamera h
bool rayTracedDirectionalRequired = m_CurrentSunLightAdditionalLightData.WillRenderRayTracedShadow();
// If the shadow is flagged as ray traced, we need to evaluate it completely
if (rayTracedDirectionalRequired)
- RenderRayTracedDirectionalScreenSpaceShadow(renderGraph, hdCamera, depthBuffer, normalBuffer, motionVectorsBuffer, rayCountTexture, screenSpaceShadowArray);
+ RenderRayTracedDirectionalScreenSpaceShadow(renderGraph, hdCamera, depthBuffer, normalBuffer, motionVectorsBuffer, historyValidityBuffer, rayCountTexture, screenSpaceShadowArray);
else
{
using (var builder = renderGraph.AddRenderPass("Directional RT Shadow", out var passData, ProfilingSampler.Get(HDProfileId.RaytracingDirectionalLightShadow)))
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerPunctual.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerPunctual.RenderGraph.cs
index b7aa4ad985a..07c31caa6c7 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerPunctual.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerPunctual.RenderGraph.cs
@@ -8,7 +8,7 @@ public partial class HDRenderPipeline
{
TextureHandle DenoisePunctualScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera,
HDAdditionalLightData additionalLightData, in LightData lightData,
- TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVetorsBuffer,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVetorsBuffer, TextureHandle historyValidityBuffer,
TextureHandle noisyBuffer, TextureHandle velocityBuffer, TextureHandle distanceBufferI)
{
// Is the history still valid?
@@ -37,7 +37,7 @@ TextureHandle DenoisePunctualScreenSpaceShadow(RenderGraph renderGraph, HDCamera
RTHandle shadowHistoryValidityArray = RequestShadowHistoryValidityBuffer(hdCamera);
temporalFilterResult = temporalFilter.DenoiseBuffer(renderGraph, hdCamera,
- depthBuffer, normalBuffer, motionVetorsBuffer,
+ depthBuffer, normalBuffer, motionVetorsBuffer, historyValidityBuffer,
noisyBuffer, shadowHistoryArray,
distanceBuffer, shadowHistoryDistanceArray,
velocityBuffer,
@@ -91,7 +91,7 @@ class RTSPunctualTracePassData
void RenderPunctualScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera
, in LightData lightData, HDAdditionalLightData additionalLightData, int lightIndex,
- PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
+ PrepassOutput prepassOutput, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer, TextureHandle historyValidityBuffer, TextureHandle rayCountTexture, TextureHandle screenSpaceShadowArray)
{
TextureHandle pointShadowBuffer;
TextureHandle velocityBuffer;
@@ -142,7 +142,7 @@ void RenderPunctualScreenSpaceShadow(RenderGraph renderGraph, HDCamera hdCamera
{
pointShadowBuffer = DenoisePunctualScreenSpaceShadow(renderGraph, hdCamera,
additionalLightData, lightData,
- depthBuffer, normalBuffer, motionVectorsBuffer,
+ depthBuffer, normalBuffer, motionVectorsBuffer, historyValidityBuffer,
pointShadowBuffer, velocityBuffer, distanceBuffer);
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManagerRT.cs b/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManagerRT.cs
index 4be37c02e48..a88b899457f 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManagerRT.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Material/SubsurfaceScattering/SubsurfaceScatteringManagerRT.cs
@@ -314,7 +314,7 @@ TextureHandle TraceRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHand
}
}
- TextureHandle DenoiseRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle rayTracedSSS, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorBuffer)
+ TextureHandle DenoiseRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle rayTracedSSS, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorBuffer, TextureHandle historyValidationTexture)
{
// Evaluate the history's validity
float historyValidity = HDRenderPipeline.EvaluateHistoryValidity(hdCamera);
@@ -323,7 +323,7 @@ TextureHandle DenoiseRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHa
HDTemporalFilter temporalFilter = GetTemporalFilter();
TemporalFilterParameters tfParameters = temporalFilter.PrepareTemporalFilterParameters(hdCamera, false, historyValidity);
TextureHandle historyBuffer = renderGraph.ImportTexture(RequestRayTracedSSSHistoryTexture(hdCamera));
- return temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rayTracedSSS, historyBuffer, depthPyramid, normalBuffer, motionVectorBuffer);
+ return temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rayTracedSSS, renderGraph.defaultResources.blackTextureXR, historyBuffer, depthPyramid, normalBuffer, motionVectorBuffer, historyValidationTexture);
}
class ComposeRTSSSPassData
@@ -371,7 +371,7 @@ TextureHandle CombineRTSSS(RenderGraph renderGraph, HDCamera hdCamera, TextureHa
TextureHandle RenderSubsurfaceScatteringRT(RenderGraph renderGraph, HDCamera hdCamera,
TextureHandle depthStencilBuffer, TextureHandle normalBuffer, TextureHandle colorBuffer,
- TextureHandle sssColor, TextureHandle diffuseBuffer, TextureHandle motionVectorsBuffer, TextureHandle ssgiBuffer)
+ TextureHandle sssColor, TextureHandle diffuseBuffer, TextureHandle motionVectorsBuffer, TextureHandle historyValidationTexture, TextureHandle ssgiBuffer)
{
using (new RenderGraphProfilingScope(renderGraph, ProfilingSampler.Get(HDProfileId.RaytracingSSS)))
{
@@ -379,7 +379,7 @@ TextureHandle RenderSubsurfaceScatteringRT(RenderGraph renderGraph, HDCamera hdC
TextureHandle rtsssResult = TraceRTSSS(renderGraph, hdCamera, depthStencilBuffer, normalBuffer, sssColor, ssgiBuffer, diffuseBuffer, colorBuffer);
// Denoise the result
- rtsssResult = DenoiseRTSSS(renderGraph, hdCamera, rtsssResult, depthStencilBuffer, normalBuffer, motionVectorsBuffer);
+ rtsssResult = DenoiseRTSSS(renderGraph, hdCamera, rtsssResult, depthStencilBuffer, normalBuffer, motionVectorsBuffer, historyValidationTexture);
// Compose it
rtsssResult = CombineRTSSS(renderGraph, hdCamera, rtsssResult, depthStencilBuffer, sssColor, ssgiBuffer, diffuseBuffer, colorBuffer);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs
index 081dd4110e5..e318a780c5b 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDProfileId.cs
@@ -127,6 +127,7 @@ internal enum HDProfileId
// RT Deferred Lighting
RaytracingDeferredLighting,
// Denoisers
+ HistoryValidity,
TemporalFilter,
DiffuseFilter,
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
index e33220b0d3b..77fd9d148ae 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.RenderGraph.cs
@@ -104,7 +104,11 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
{
gpuLightListOutput = BuildGPULightList(m_RenderGraph, hdCamera, m_TileAndClusterData, m_TotalLightCount, ref m_ShaderVariablesLightListCB, prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.gbuffer);
- lightingBuffers.ambientOcclusionBuffer = m_AmbientOcclusionSystem.Render(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.resolvedNormalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_DepthBufferMipChainInfo, m_ShaderVariablesRayTracingCB, rayCountTexture);
+ // Evaluate the history validation buffer that may be required by temporal accumulation based effects
+ TextureHandle historyValidationTexture = EvaluateHistoryValidationBuffer(m_RenderGraph, hdCamera, prepassOutput.depthBuffer, prepassOutput.resolvedNormalBuffer, prepassOutput.resolvedMotionVectorsBuffer);
+
+ lightingBuffers.ambientOcclusionBuffer = m_AmbientOcclusionSystem.Render(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, prepassOutput.resolvedNormalBuffer, prepassOutput.resolvedMotionVectorsBuffer, historyValidationTexture, m_DepthBufferMipChainInfo, m_ShaderVariablesRayTracingCB, rayCountTexture);
+
// Should probably be inside the AO render function but since it's a separate class it's currently not super clean to do.
PushFullScreenDebugTexture(m_RenderGraph, lightingBuffers.ambientOcclusionBuffer, FullScreenDebugMode.ScreenSpaceAmbientOcclusion);
@@ -134,7 +138,8 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
case IndirectDiffuseMode.Raytrace:
lightingBuffers.ssgiLightingBuffer = RenderRayTracedIndirectDiffuse(m_RenderGraph, hdCamera,
- prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, m_SkyManager.GetSkyReflection(hdCamera), rayCountTexture,
+ prepassOutput.depthBuffer, prepassOutput.stencilBuffer, prepassOutput.normalBuffer, prepassOutput.resolvedMotionVectorsBuffer, historyValidationTexture,
+ m_SkyManager.GetSkyReflection(hdCamera), rayCountTexture,
m_ShaderVariablesRayTracingCB);
break;
default:
@@ -149,7 +154,7 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
lightCluster.EvaluateClusterDebugView(m_RenderGraph, hdCamera, prepassOutput.depthBuffer, prepassOutput.depthPyramidTexture);
}
- lightingBuffers.screenspaceShadowBuffer = RenderScreenSpaceShadows(m_RenderGraph, hdCamera, prepassOutput, prepassOutput.depthBuffer, prepassOutput.normalBuffer, prepassOutput.motionVectorsBuffer, rayCountTexture);
+ lightingBuffers.screenspaceShadowBuffer = RenderScreenSpaceShadows(m_RenderGraph, hdCamera, prepassOutput, prepassOutput.depthBuffer, prepassOutput.normalBuffer, prepassOutput.motionVectorsBuffer, historyValidationTexture, rayCountTexture);
var maxZMask = GenerateMaxZPass(m_RenderGraph, hdCamera, prepassOutput.depthPyramidTexture, m_DepthBufferMipChainInfo);
@@ -175,7 +180,7 @@ void ExecuteWithRenderGraph(RenderRequest renderRequest,
{
colorBuffer = RenderSubsurfaceScatteringRT(m_RenderGraph, hdCamera,
prepassOutput.depthBuffer, prepassOutput.normalBuffer, colorBuffer,
- lightingBuffers.sssBuffer, lightingBuffers.diffuseLightingBuffer, prepassOutput.motionVectorsBuffer, lightingBuffers.ssgiLightingBuffer);
+ lightingBuffers.sssBuffer, lightingBuffers.diffuseLightingBuffer, prepassOutput.motionVectorsBuffer, historyValidationTexture, lightingBuffers.ssgiLightingBuffer);
}
else
RenderSubsurfaceScattering(m_RenderGraph, hdCamera, colorBuffer, lightingBuffers, ref prepassOutput);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
index 76c42e4eaaa..c1ca2990d58 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
@@ -581,6 +581,7 @@ static class HDShaderIDs
public static readonly int _CurrentEffectResolution = Shader.PropertyToID("_CurrentEffectResolution");
public static readonly int _SampleCountTextureRW = Shader.PropertyToID("_SampleCountTextureRW");
public static readonly int _AffectSmoothSurfaces = Shader.PropertyToID("_AffectSmoothSurfaces");
+ public static readonly int _ObjectMotionStencilBit = Shader.PropertyToID("_ObjectMotionStencilBit");
// Reflections
public static readonly int _ReflectionHistorybufferRW = Shader.PropertyToID("_ReflectionHistorybufferRW");
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs
index 46c1776b61e..055ae07cc1d 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDDiffuseDenoiser.cs
@@ -145,7 +145,7 @@ class DiffuseDenoiserPassData
public TextureHandle outputBuffer;
}
- public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, DiffuseDenoiserParameters tfParameters, TextureHandle noisyBuffer, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle outputBuffer)
+ public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, DiffuseDenoiserParameters tfParameters, TextureHandle noisyBuffer, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle outputBuffer)
{
using (var builder = renderGraph.AddRenderPass("DiffuseDenoiser", out var passData, ProfilingSampler.Get(HDProfileId.DiffuseFilter)))
{
@@ -154,7 +154,7 @@ public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, Diffuse
// Fetch all the resources
passData.parameters = tfParameters;
- passData.depthStencilBuffer = builder.ReadTexture(depthPyramid);
+ passData.depthStencilBuffer = builder.ReadTexture(depthBuffer);
passData.normalBuffer = builder.ReadTexture(normalBuffer);
passData.noisyBuffer = builder.ReadTexture(noisyBuffer);
passData.intermediateBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one, true, true) { colorFormat = GraphicsFormat.R16G16B16A16_SFloat, enableRandomWrite = true, name = "DiffuseDenoiserIntermediate" });
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs
index 4253425e7e6..c635856d362 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.RenderGraph.cs
@@ -5,7 +5,15 @@ namespace UnityEngine.Rendering.HighDefinition
{
partial class HDRaytracingAmbientOcclusion
{
- public TextureHandle RenderRTAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, ShaderVariablesRaytracing shaderVariablesRaytracing)
+ struct TraceAmbientOcclusionResult
+ {
+ public TextureHandle signalBuffer;
+ public TextureHandle velocityBuffer;
+ }
+
+ public TextureHandle RenderRTAO(RenderGraph renderGraph, HDCamera hdCamera,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle historyValidationBuffer,
+ TextureHandle rayCountTexture, ShaderVariablesRaytracing shaderVariablesRaytracing)
{
var settings = hdCamera.volumeStack.GetComponent();
@@ -13,12 +21,14 @@ public TextureHandle RenderRTAO(RenderGraph renderGraph, HDCamera hdCamera, Text
if (m_RenderPipeline.GetRayTracingState())
{
- // Trace the signal
+ // Evaluate the parameters
AmbientOcclusionTraceParameters aoParameters = PrepareAmbientOcclusionTraceParameters(hdCamera, shaderVariablesRaytracing);
- result = TraceAO(renderGraph, aoParameters, depthPyramid, normalBuffer, rayCountTexture);
+
+ // Trace the signal
+ TraceAmbientOcclusionResult traceResult = TraceAO(renderGraph, aoParameters, depthBuffer, normalBuffer, rayCountTexture);
// Denoise if required
- result = DenoiseAO(renderGraph, hdCamera, result, depthPyramid, normalBuffer, motionVectors);
+ result = DenoiseAO(renderGraph, hdCamera, traceResult, depthBuffer, normalBuffer, motionVectors, historyValidationBuffer);
// Compose the result to be done
AmbientOcclusionComposeParameters aoComposeParameters = PrepareAmbientOcclusionComposeParameters(hdCamera, shaderVariablesRaytracing);
@@ -34,44 +44,54 @@ public TextureHandle RenderRTAO(RenderGraph renderGraph, HDCamera hdCamera, Text
class TraceRTAOPassData
{
public AmbientOcclusionTraceParameters parameters;
- public TextureHandle depthPyramid;
+ public TextureHandle depthBuffer;
public TextureHandle normalBuffer;
public TextureHandle rayCountTexture;
public TextureHandle outputTexture;
+ public TextureHandle velocityBuffer;
}
- TextureHandle TraceAO(RenderGraph renderGraph, in AmbientOcclusionTraceParameters parameters, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle rayCountTexture)
+ TraceAmbientOcclusionResult TraceAO(RenderGraph renderGraph, in AmbientOcclusionTraceParameters parameters, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle rayCountTexture)
{
using (var builder = renderGraph.AddRenderPass("Tracing the rays for RTAO", out var passData, ProfilingSampler.Get(HDProfileId.RaytracingAmbientOcclusion)))
{
+ TraceAmbientOcclusionResult traceOutput;
+
builder.EnableAsyncCompute(false);
passData.parameters = parameters;
- passData.depthPyramid = builder.ReadTexture(depthPyramid);
+ passData.depthBuffer = builder.ReadTexture(depthBuffer);
passData.normalBuffer = builder.ReadTexture(normalBuffer);
passData.rayCountTexture = builder.ReadWriteTexture(rayCountTexture);
// Depending of if we will have to denoise (or not), we need to allocate the final format, or a bigger texture
passData.outputTexture = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true)
{ colorFormat = GraphicsFormat.R8_UNorm, enableRandomWrite = true, name = "Ray Traced Ambient Occlusion" }));
+ passData.velocityBuffer = builder.ReadWriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true)
+ { colorFormat = GraphicsFormat.R8_SNorm, enableRandomWrite = true, name = "Velocity Buffer" }));
builder.SetRenderFunc(
(TraceRTAOPassData data, RenderGraphContext ctx) =>
{
// We need to fill the structure that holds the various resources
AmbientOcclusionTraceResources aotResources = new AmbientOcclusionTraceResources();
- aotResources.depthStencilBuffer = data.depthPyramid;
+ aotResources.depthStencilBuffer = data.depthBuffer;
aotResources.normalBuffer = data.normalBuffer;
aotResources.rayCountTexture = data.rayCountTexture;
aotResources.outputTexture = data.outputTexture;
+ aotResources.velocityBuffer = data.velocityBuffer;
TraceAO(ctx.cmd, data.parameters, aotResources);
});
- return passData.outputTexture;
+ traceOutput.signalBuffer = passData.outputTexture;
+ traceOutput.velocityBuffer = passData.velocityBuffer;
+ return traceOutput;
}
}
- TextureHandle DenoiseAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle rayTracedAO, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorBuffer)
+ TextureHandle DenoiseAO(RenderGraph renderGraph, HDCamera hdCamera,
+ TraceAmbientOcclusionResult traceAOResult,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorBuffer, TextureHandle historyValidationBuffer)
{
var aoSettings = hdCamera.volumeStack.GetComponent();
if (aoSettings.denoise)
@@ -83,17 +103,17 @@ TextureHandle DenoiseAO(RenderGraph renderGraph, HDCamera hdCamera, TextureHandl
HDTemporalFilter temporalFilter = m_RenderPipeline.GetTemporalFilter();
TemporalFilterParameters tfParameters = temporalFilter.PrepareTemporalFilterParameters(hdCamera, true, historyValidity);
TextureHandle historyBuffer = renderGraph.ImportTexture(RequestAmbientOcclusionHistoryTexture(hdCamera));
- TextureHandle denoisedRTAO = temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rayTracedAO, historyBuffer, depthPyramid, normalBuffer, motionVectorBuffer);
+ TextureHandle denoisedRTAO = temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, traceAOResult.signalBuffer, traceAOResult.velocityBuffer, historyBuffer, depthBuffer, normalBuffer, motionVectorBuffer, historyValidationBuffer);
// Apply the diffuse denoiser
HDDiffuseDenoiser diffuseDenoiser = m_RenderPipeline.GetDiffuseDenoiser();
DiffuseDenoiserParameters ddParams = diffuseDenoiser.PrepareDiffuseDenoiserParameters(hdCamera, true, aoSettings.denoiserRadius, false, false);
- rayTracedAO = diffuseDenoiser.Denoise(renderGraph, hdCamera, ddParams, denoisedRTAO, depthPyramid, normalBuffer, rayTracedAO);
+ traceAOResult.signalBuffer = diffuseDenoiser.Denoise(renderGraph, hdCamera, ddParams, denoisedRTAO, depthBuffer, normalBuffer, traceAOResult.signalBuffer);
- return rayTracedAO;
+ return traceAOResult.signalBuffer;
}
else
- return rayTracedAO;
+ return traceAOResult.signalBuffer;
}
class ComposeRTAOPassData
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs
index 84525a3125a..6629e540bf6 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingAmbientOcclusion.cs
@@ -72,6 +72,7 @@ public struct AmbientOcclusionTraceResources
// Output Buffer
public RTHandle outputTexture;
+ public RTHandle velocityBuffer;
}
AmbientOcclusionTraceParameters PrepareAmbientOcclusionTraceParameters(HDCamera hdCamera, ShaderVariablesRaytracing raytracingCB)
@@ -153,6 +154,7 @@ static public void TraceAO(CommandBuffer cmd, AmbientOcclusionTraceParameters ao
// Set the output textures
cmd.SetRayTracingTextureParam(aoTraceParameters.aoShaderRT, HDShaderIDs._RayCountTexture, aoTraceResources.rayCountTexture);
cmd.SetRayTracingTextureParam(aoTraceParameters.aoShaderRT, HDShaderIDs._AmbientOcclusionTextureRW, aoTraceResources.outputTexture);
+ cmd.SetRayTracingTextureParam(aoTraceParameters.aoShaderRT, HDShaderIDs._VelocityBuffer, aoTraceResources.velocityBuffer);
// Run the computation
cmd.DispatchRays(aoTraceParameters.aoShaderRT, m_RayGenShaderName, (uint)aoTraceParameters.actualWidth, (uint)aoTraceParameters.actualHeight, (uint)aoTraceParameters.viewCount);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs
index 90c2a9aea27..17abee3f05c 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingIndirectDiffuse.RenderGraph.cs
@@ -120,7 +120,8 @@ static RTHandle RequestRayTracedIndirectDiffuseHistoryTexture(HDCamera hdCamera)
}
TextureHandle RenderIndirectDiffusePerformance(RenderGraph renderGraph, HDCamera hdCamera,
- TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, Texture skyTexture,
+ TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle historyValidationTexture,
+ TextureHandle rayCountTexture, Texture skyTexture,
ShaderVariablesRaytracing shaderVariablesRaytracing)
{
// Pointer to the final result
@@ -139,7 +140,7 @@ TextureHandle RenderIndirectDiffusePerformance(RenderGraph renderGraph, HDCamera
rtgiResult = UpscaleRTGI(renderGraph, in rtgiUpscaleParameters,
depthPyramid, normalBuffer, lightingBuffer, directionBuffer);
// Denoise if required
- rtgiResult = DenoiseRTGI(renderGraph, hdCamera, rtgiResult, depthPyramid, normalBuffer, motionVectors);
+ rtgiResult = DenoiseRTGI(renderGraph, hdCamera, rtgiResult, depthPyramid, normalBuffer, motionVectors, historyValidationTexture);
// Adjust the weight
AdjustRTIDWeightParameters artidParamters = PrepareAdjustRTIDWeightParametersParameters(hdCamera);
@@ -187,7 +188,8 @@ TextureHandle QualityRTGI(RenderGraph renderGraph, in QualityRTIndirectDiffusePa
}
TextureHandle RenderIndirectDiffuseQuality(RenderGraph renderGraph, HDCamera hdCamera,
- TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle rayCountTexture, Texture skyTexture,
+ TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle historyValidationTexture,
+ TextureHandle rayCountTexture, Texture skyTexture,
ShaderVariablesRaytracing shaderVariablesRaytracing)
{
var settings = hdCamera.volumeStack.GetComponent();
@@ -197,7 +199,7 @@ TextureHandle RenderIndirectDiffuseQuality(RenderGraph renderGraph, HDCamera hdC
TextureHandle rtgiResult = QualityRTGI(renderGraph, in rtgiQRenderingParameters, depthPyramid, normalBuffer, rayCountTexture);
// Denoise if required
- rtgiResult = DenoiseRTGI(renderGraph, hdCamera, rtgiResult, depthPyramid, normalBuffer, motionVectors);
+ rtgiResult = DenoiseRTGI(renderGraph, hdCamera, rtgiResult, depthPyramid, normalBuffer, motionVectors, historyValidationTexture);
// Adjust the weight
AdjustRTIDWeightParameters artidParamters = PrepareAdjustRTIDWeightParametersParameters(hdCamera);
@@ -220,7 +222,7 @@ static RTHandle RequestIndirectDiffuseHistoryTextureLF(HDCamera hdCamera)
IndirectDiffuseHistoryBufferAllocatorFunction, 1);
}
- TextureHandle DenoiseRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle rtGIBuffer, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorBuffer)
+ TextureHandle DenoiseRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle rtGIBuffer, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorBuffer, TextureHandle historyValidationTexture)
{
var giSettings = hdCamera.volumeStack.GetComponent();
if (giSettings.denoise)
@@ -234,7 +236,7 @@ TextureHandle DenoiseRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHan
// Run the temporal denoiser
TemporalFilterParameters tfParameters = temporalFilter.PrepareTemporalFilterParameters(hdCamera, false, historyValidity0);
TextureHandle historyBufferHF = renderGraph.ImportTexture(RequestIndirectDiffuseHistoryTextureHF(hdCamera));
- TextureHandle denoisedRTGI = temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rtGIBuffer, historyBufferHF, depthPyramid, normalBuffer, motionVectorBuffer);
+ TextureHandle denoisedRTGI = temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rtGIBuffer, renderGraph.defaultResources.blackTextureXR, historyBufferHF, depthPyramid, normalBuffer, motionVectorBuffer, historyValidationTexture);
// Apply the diffuse denoiser
DiffuseDenoiserParameters ddParams = diffuseDenoiser.PrepareDiffuseDenoiserParameters(hdCamera, false, giSettings.denoiserRadius, giSettings.halfResolutionDenoiser, giSettings.secondDenoiserPass);
@@ -248,7 +250,7 @@ TextureHandle DenoiseRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHan
// Run the temporal denoiser
tfParameters = temporalFilter.PrepareTemporalFilterParameters(hdCamera, false, historyValidity1);
TextureHandle historyBufferLF = renderGraph.ImportTexture(RequestIndirectDiffuseHistoryTextureLF(hdCamera));
- denoisedRTGI = temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rtGIBuffer, historyBufferLF, depthPyramid, normalBuffer, motionVectorBuffer);
+ denoisedRTGI = temporalFilter.Denoise(renderGraph, hdCamera, tfParameters, rtGIBuffer, renderGraph.defaultResources.blackTextureXR, historyBufferLF, depthPyramid, normalBuffer, motionVectorBuffer, historyValidationTexture);
// Apply the diffuse denoiser
ddParams = diffuseDenoiser.PrepareDiffuseDenoiserParameters(hdCamera, false, giSettings.denoiserRadius * 0.5f, giSettings.halfResolutionDenoiser, false);
@@ -268,7 +270,8 @@ TextureHandle DenoiseRTGI(RenderGraph renderGraph, HDCamera hdCamera, TextureHan
}
TextureHandle RenderRayTracedIndirectDiffuse(RenderGraph renderGraph, HDCamera hdCamera,
- TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, Texture skyTexture, TextureHandle rayCountTexture,
+ TextureHandle depthPyramid, TextureHandle stencilBuffer, TextureHandle normalBuffer, TextureHandle motionVectors, TextureHandle historyValidationTexture,
+ Texture skyTexture, TextureHandle rayCountTexture,
ShaderVariablesRaytracing shaderVariablesRaytracing)
{
GlobalIllumination giSettings = hdCamera.volumeStack.GetComponent();
@@ -285,11 +288,13 @@ TextureHandle RenderRayTracedIndirectDiffuse(RenderGraph renderGraph, HDCamera h
if (qualityMode)
rtreflResult = RenderIndirectDiffuseQuality(renderGraph, hdCamera,
- depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, skyTexture,
+ depthPyramid, stencilBuffer, normalBuffer, motionVectors, historyValidationTexture,
+ rayCountTexture, skyTexture,
shaderVariablesRaytracing);
else
rtreflResult = RenderIndirectDiffusePerformance(renderGraph, hdCamera,
- depthPyramid, stencilBuffer, normalBuffer, motionVectors, rayCountTexture, skyTexture,
+ depthPyramid, stencilBuffer, normalBuffer, motionVectors, historyValidationTexture,
+ rayCountTexture, skyTexture,
shaderVariablesRaytracing);
return rtreflResult;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs
index a1ff1e86267..340d201e5ac 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDRaytracingManager.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using UnityEngine.Experimental.Rendering;
+using UnityEngine.Experimental.Rendering.RenderGraphModule;
namespace UnityEngine.Rendering.HighDefinition
{
@@ -648,7 +649,7 @@ internal BlueNoise GetBlueNoiseManager()
internal HDTemporalFilter GetTemporalFilter()
{
- if (m_TemporalFilter == null)
+ if (m_TemporalFilter == null && m_RayTracingSupported)
{
m_TemporalFilter = new HDTemporalFilter();
m_TemporalFilter.Init(m_Asset.renderPipelineRayTracingResources);
@@ -725,5 +726,21 @@ static internal float GetPixelSpreadAngle(float fov, int width, int height)
{
return Mathf.Atan(GetPixelSpreadTangent(fov, width, height));
}
+
+ internal TextureHandle EvaluateHistoryValidationBuffer(RenderGraph renderGraph, HDCamera hdCamera, TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorsBuffer)
+ {
+ // Grab the temporal filter
+ HDTemporalFilter temporalFilter = GetTemporalFilter();
+
+ // If the temporal filter is valid use it, otherwise return a white texture
+ if (temporalFilter != null)
+ {
+ float historyValidity = EvaluateHistoryValidity(hdCamera);
+ HistoryValidityParameters parameters = temporalFilter.PrepareHistoryValidityParameters(hdCamera, historyValidity);
+ return temporalFilter.HistoryValidity(renderGraph, hdCamera, parameters, depthBuffer, normalBuffer, motionVectorsBuffer);
+ }
+ else
+ return renderGraph.defaultResources.whiteTexture;
+ }
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.RenderGraph.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.RenderGraph.cs
index d331caf83eb..14d7d5cf3b5 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.RenderGraph.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.RenderGraph.cs
@@ -6,6 +6,55 @@ namespace UnityEngine.Rendering.HighDefinition
{
partial class HDTemporalFilter
{
+ class HistoryValidityPassData
+ {
+ public HistoryValidityParameters parameters;
+ public TextureHandle depthStencilBuffer;
+ public TextureHandle normalBuffer;
+ public TextureHandle motionVectorBuffer;
+ public TextureHandle historyDepthTexture;
+ public TextureHandle historyNormalTexture;
+ public TextureHandle validationBuffer;
+ }
+
+ public TextureHandle HistoryValidity(RenderGraph renderGraph, HDCamera hdCamera, HistoryValidityParameters parameters,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorBuffer)
+ {
+ using (var builder = renderGraph.AddRenderPass("History Validity Evaluation", out var passData, ProfilingSampler.Get(HDProfileId.HistoryValidity)))
+ {
+ // Cannot run in async
+ builder.EnableAsyncCompute(false);
+
+ // Fetch all the resources
+ passData.parameters = parameters;
+ // Input Buffers
+ passData.depthStencilBuffer = builder.ReadTexture(depthBuffer);
+ passData.normalBuffer = builder.ReadTexture(normalBuffer);
+ passData.motionVectorBuffer = builder.ReadTexture(motionVectorBuffer);
+
+ // History buffers
+ passData.historyDepthTexture = builder.ReadTexture(renderGraph.ImportTexture(hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Depth)));
+ passData.historyNormalTexture = builder.ReadTexture(renderGraph.ImportTexture(hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Normal)));
+
+ // Output buffers
+ passData.validationBuffer = builder.WriteTexture(renderGraph.CreateTexture(new TextureDesc(Vector2.one, true, true) { colorFormat = GraphicsFormat.R8_UNorm, enableRandomWrite = true, name = "ValidationTexture" }));
+
+ builder.SetRenderFunc(
+ (HistoryValidityPassData data, RenderGraphContext ctx) =>
+ {
+ HistoryValidityResources resources = new HistoryValidityResources();
+ resources.depthStencilBuffer = data.depthStencilBuffer;
+ resources.normalBuffer = data.normalBuffer;
+ resources.motionVectorBuffer = data.motionVectorBuffer;
+ resources.historyDepthTexture = data.historyDepthTexture;
+ resources.historyNormalTexture = data.historyNormalTexture;
+ resources.validationBuffer = data.validationBuffer;
+ ExecuteHistoryValidity(ctx.cmd, data.parameters, resources);
+ });
+ return passData.validationBuffer;
+ }
+ }
+
class TemporalFilterPassData
{
public TemporalFilterParameters parameters;
@@ -13,15 +62,16 @@ class TemporalFilterPassData
public TextureHandle normalBuffer;
public TextureHandle motionVectorBuffer;
public TextureHandle velocityBuffer;
- public TextureHandle historyDepthTexture;
- public TextureHandle historyNormalTexture;
public TextureHandle noisyBuffer;
public TextureHandle validationBuffer;
public TextureHandle historyBuffer;
public TextureHandle outputBuffer;
}
- public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, TemporalFilterParameters tfParameters, TextureHandle noisyBuffer, TextureHandle historyBuffer, TextureHandle depthPyramid, TextureHandle normalBuffer, TextureHandle motionVectorBuffer)
+ public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, TemporalFilterParameters tfParameters,
+ TextureHandle noisyBuffer, TextureHandle velocityBuffer,
+ TextureHandle historyBuffer,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorBuffer, TextureHandle historyValidationBuffer)
{
using (var builder = renderGraph.AddRenderPass("TemporalDenoiser", out var passData, ProfilingSampler.Get(HDProfileId.TemporalFilter)))
{
@@ -30,20 +80,18 @@ public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, Tempora
// Fetch all the resources
passData.parameters = tfParameters;
- // Input Buffers
- passData.depthStencilBuffer = builder.ReadTexture(depthPyramid);
+
+ // Prepass Buffers
+ passData.depthStencilBuffer = builder.ReadTexture(depthBuffer);
passData.normalBuffer = builder.ReadTexture(normalBuffer);
passData.motionVectorBuffer = builder.ReadTexture(motionVectorBuffer);
- passData.velocityBuffer = renderGraph.defaultResources.blackTextureXR;
+ // Effect buffers
+ passData.velocityBuffer = builder.ReadTexture(velocityBuffer);
passData.noisyBuffer = builder.ReadTexture(noisyBuffer);
+ passData.validationBuffer = builder.ReadTexture(historyValidationBuffer);
- // Temporary buffers
- passData.validationBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one, true, true) { colorFormat = GraphicsFormat.R8_UNorm, enableRandomWrite = true, name = "ValidationTexture" });
-
- // History buffers
- passData.historyDepthTexture = builder.ReadTexture(renderGraph.ImportTexture(hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Depth)));
- passData.historyNormalTexture = builder.ReadTexture(renderGraph.ImportTexture(hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Normal)));
+ // History buffer
passData.historyBuffer = builder.ReadWriteTexture(historyBuffer);
// Output buffers
@@ -58,8 +106,6 @@ public TextureHandle Denoise(RenderGraph renderGraph, HDCamera hdCamera, Tempora
tfResources.normalBuffer = data.normalBuffer;
tfResources.velocityBuffer = data.velocityBuffer;
tfResources.motionVectorBuffer = data.motionVectorBuffer;
- tfResources.historyDepthTexture = data.historyDepthTexture;
- tfResources.historyNormalTexture = data.historyNormalTexture;
tfResources.noisyBuffer = data.noisyBuffer;
tfResources.validationBuffer = data.validationBuffer;
tfResources.historyBuffer = data.historyBuffer;
@@ -79,20 +125,18 @@ internal struct TemporalDenoiserArrayOutputData
class TemporalFilterArrayPassData
{
public TemporalFilterArrayParameters parameters;
- // Input buffers
+ // Prepass buffers
public TextureHandle depthStencilBuffer;
public TextureHandle normalBuffer;
public TextureHandle motionVectorBuffer;
- public TextureHandle velocityBuffer;
+
+ // Effect Buffers
public TextureHandle noisyBuffer;
public TextureHandle distanceBuffer;
-
- // Intermediate buffers
public TextureHandle validationBuffer;
+ public TextureHandle velocityBuffer;
// History buffers
- public TextureHandle historyDepthTexture;
- public TextureHandle historyNormalTexture;
public TextureHandle historyBuffer;
public TextureHandle validationHistoryBuffer;
public TextureHandle distanceHistorySignal;
@@ -103,7 +147,7 @@ class TemporalFilterArrayPassData
}
public TemporalDenoiserArrayOutputData DenoiseBuffer(RenderGraph renderGraph, HDCamera hdCamera,
- TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorBuffer,
+ TextureHandle depthBuffer, TextureHandle normalBuffer, TextureHandle motionVectorBuffer, TextureHandle historyValidationBuffer,
TextureHandle noisyBuffer, RTHandle historyBuffer,
TextureHandle distanceBuffer, RTHandle distanceHistorySignal,
TextureHandle velocityBuffer,
@@ -128,13 +172,9 @@ public TemporalDenoiserArrayOutputData DenoiseBuffer(RenderGraph renderGraph, HD
passData.velocityBuffer = builder.ReadTexture(velocityBuffer);
passData.noisyBuffer = builder.ReadTexture(noisyBuffer);
passData.distanceBuffer = distanceBased ? builder.ReadTexture(distanceBuffer) : renderGraph.defaultResources.blackTextureXR;
-
- // Intermediate buffers
- passData.validationBuffer = builder.CreateTransientTexture(new TextureDesc(Vector2.one, true, true) { colorFormat = GraphicsFormat.R8_UNorm, enableRandomWrite = true, name = "ValidationTexture" });
+ passData.validationBuffer = builder.ReadTexture(historyValidationBuffer);
// History buffers
- passData.historyDepthTexture = builder.ReadTexture(renderGraph.ImportTexture(hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Depth)));
- passData.historyNormalTexture = builder.ReadTexture(renderGraph.ImportTexture(hdCamera.GetCurrentFrameRT((int)HDCameraFrameHistoryType.Normal)));
passData.historyBuffer = builder.ReadWriteTexture(renderGraph.ImportTexture(historyBuffer));
passData.validationHistoryBuffer = builder.ReadWriteTexture(renderGraph.ImportTexture(validationHistoryBuffer));
passData.distanceHistorySignal = distanceBased ? builder.ReadWriteTexture(renderGraph.ImportTexture(distanceHistorySignal)) : renderGraph.defaultResources.blackTextureXR;
@@ -153,8 +193,6 @@ public TemporalDenoiserArrayOutputData DenoiseBuffer(RenderGraph renderGraph, HD
resources.normalBuffer = data.normalBuffer;
resources.motionVectorBuffer = data.motionVectorBuffer;
resources.velocityBuffer = data.velocityBuffer;
- resources.historyDepthTexture = data.historyDepthTexture;
- resources.historyNormalTexture = data.historyNormalTexture;
resources.noisyBuffer = data.noisyBuffer;
resources.distanceBuffer = data.distanceBuffer;
resources.validationBuffer = data.validationBuffer;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs
index f4145b967e4..dac5d9c719c 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/HDTemporalFilter.cs
@@ -2,7 +2,7 @@
namespace UnityEngine.Rendering.HighDefinition
{
- struct TemporalFilterParameters
+ struct HistoryValidityParameters
{
// Camera parameters
public int texWidth;
@@ -15,26 +15,54 @@ struct TemporalFilterParameters
// Kernels
public int validateHistoryKernel;
- public int temporalAccKernel;
- public int copyHistoryKernel;
// Other parameters
public ComputeShader temporalFilterCS;
}
- struct TemporalFilterResources
+ struct HistoryValidityResources
{
// Input buffers
public RTHandle depthStencilBuffer;
public RTHandle normalBuffer;
- public RTHandle velocityBuffer;
public RTHandle motionVectorBuffer;
public RTHandle historyDepthTexture;
public RTHandle historyNormalTexture;
- public RTHandle noisyBuffer;
- // Temporary buffers
+ // Output buffer
+ public RTHandle validationBuffer;
+ }
+
+ struct TemporalFilterParameters
+ {
+ // Camera parameters
+ public int texWidth;
+ public int texHeight;
+ public int viewCount;
+
+ // Denoising parameters
+ public float historyValidity;
+ public float pixelSpreadTangent;
+
+ // Kernels
+ public int temporalAccKernel;
+ public int copyHistoryKernel;
+
+ // Other parameters
+ public ComputeShader temporalFilterCS;
+ }
+
+ struct TemporalFilterResources
+ {
+ // Prepass buffers
+ public RTHandle depthStencilBuffer;
+ public RTHandle normalBuffer;
+ public RTHandle motionVectorBuffer;
+
+ // Effect buffers
+ public RTHandle noisyBuffer;
public RTHandle validationBuffer;
+ public RTHandle velocityBuffer;
// Output buffers
public RTHandle historyBuffer;
@@ -87,6 +115,27 @@ public void Release()
{
}
+ public HistoryValidityParameters PrepareHistoryValidityParameters(HDCamera hdCamera, float historyValidity)
+ {
+ HistoryValidityParameters parameters = new HistoryValidityParameters();
+ // Camera parameters
+ parameters.texWidth = hdCamera.actualWidth;
+ parameters.texHeight = hdCamera.actualHeight;
+ parameters.viewCount = hdCamera.viewCount;
+
+ // Denoising parameters
+ parameters.pixelSpreadTangent = HDRenderPipeline.GetPixelSpreadTangent(hdCamera.camera.fieldOfView, hdCamera.actualWidth, hdCamera.actualHeight);
+ parameters.historyValidity = historyValidity;
+
+ // Kernels
+ parameters.validateHistoryKernel = m_ValidateHistoryKernel;
+
+ // Other parameters
+ parameters.temporalFilterCS = m_TemporalFilterCS;
+
+ return parameters;
+ }
+
public TemporalFilterParameters PrepareTemporalFilterParameters(HDCamera hdCamera, bool singleChannel, float historyValidity)
{
TemporalFilterParameters temporalFilterParameters = new TemporalFilterParameters();
@@ -100,7 +149,6 @@ public TemporalFilterParameters PrepareTemporalFilterParameters(HDCamera hdCamer
temporalFilterParameters.historyValidity = historyValidity;
// Kernels
- temporalFilterParameters.validateHistoryKernel = m_ValidateHistoryKernel;
temporalFilterParameters.temporalAccKernel = singleChannel ? m_TemporalAccumulationSingleKernel : m_TemporalAccumulationColorKernel;
temporalFilterParameters.copyHistoryKernel = singleChannel ? m_CopyHistorySingleKernel : m_CopyHistoryColorKernel;
@@ -110,40 +158,49 @@ public TemporalFilterParameters PrepareTemporalFilterParameters(HDCamera hdCamer
return temporalFilterParameters;
}
- // Denoiser variant for non history array
- static public void DenoiseBuffer(CommandBuffer cmd, TemporalFilterParameters tfParameters, TemporalFilterResources tfResources)
+ // Function that evaluates the history validation Buffer
+ static public void ExecuteHistoryValidity(CommandBuffer cmd, HistoryValidityParameters parameters, HistoryValidityResources resources)
{
// If we do not have a depth and normal history buffers, we can skip right away
- if (tfResources.historyDepthTexture == null || tfResources.historyNormalTexture == null)
+ if (resources.historyDepthTexture == null || resources.historyNormalTexture == null)
{
- HDUtils.BlitCameraTexture(cmd, tfResources.noisyBuffer, tfResources.historyBuffer);
- HDUtils.BlitCameraTexture(cmd, tfResources.noisyBuffer, tfResources.outputBuffer);
+ CoreUtils.SetRenderTarget(cmd, resources.validationBuffer, clearFlag: ClearFlag.Color, Color.black);
return;
}
// Evaluate the dispatch parameters
int areaTileSize = 8;
- int numTilesX = (tfParameters.texWidth + (areaTileSize - 1)) / areaTileSize;
- int numTilesY = (tfParameters.texHeight + (areaTileSize - 1)) / areaTileSize;
+ int numTilesX = (parameters.texWidth + (areaTileSize - 1)) / areaTileSize;
+ int numTilesY = (parameters.texHeight + (areaTileSize - 1)) / areaTileSize;
// First of all we need to validate the history to know where we can or cannot use the history signal
// Bind the input buffers
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._DepthTexture, tfResources.depthStencilBuffer);
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._HistoryDepthTexture, tfResources.historyDepthTexture);
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._NormalBufferTexture, tfResources.normalBuffer);
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._HistoryNormalTexture, tfResources.historyNormalTexture);
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._VelocityBuffer, tfResources.velocityBuffer);
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._CameraMotionVectorsTexture, tfResources.motionVectorBuffer);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._DepthTexture, resources.depthStencilBuffer);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._HistoryDepthTexture, resources.historyDepthTexture);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._NormalBufferTexture, resources.normalBuffer);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._HistoryNormalTexture, resources.historyNormalTexture);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._CameraMotionVectorsTexture, resources.motionVectorBuffer);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._StencilTexture, resources.depthStencilBuffer, 0, RenderTextureSubElement.Stencil);
// Bind the constants
- cmd.SetComputeFloatParam(tfParameters.temporalFilterCS, HDShaderIDs._HistoryValidity, tfParameters.historyValidity);
- cmd.SetComputeFloatParam(tfParameters.temporalFilterCS, HDShaderIDs._PixelSpreadAngleTangent, tfParameters.pixelSpreadTangent);
+ cmd.SetComputeFloatParam(parameters.temporalFilterCS, HDShaderIDs._HistoryValidity, parameters.historyValidity);
+ cmd.SetComputeFloatParam(parameters.temporalFilterCS, HDShaderIDs._PixelSpreadAngleTangent, parameters.pixelSpreadTangent);
+ cmd.SetComputeIntParam(parameters.temporalFilterCS, HDShaderIDs._ObjectMotionStencilBit, (int)StencilUsage.ObjectMotionVector);
// Bind the output buffer
- cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, HDShaderIDs._ValidationBufferRW, tfResources.validationBuffer);
+ cmd.SetComputeTextureParam(parameters.temporalFilterCS, parameters.validateHistoryKernel, HDShaderIDs._ValidationBufferRW, resources.validationBuffer);
// Evaluate the validity
- cmd.DispatchCompute(tfParameters.temporalFilterCS, tfParameters.validateHistoryKernel, numTilesX, numTilesY, tfParameters.viewCount);
+ cmd.DispatchCompute(parameters.temporalFilterCS, parameters.validateHistoryKernel, numTilesX, numTilesY, parameters.viewCount);
+ }
+
+ // Denoiser variant for non history array
+ static public void DenoiseBuffer(CommandBuffer cmd, TemporalFilterParameters tfParameters, TemporalFilterResources tfResources)
+ {
+ // Evaluate the dispatch parameters
+ int areaTileSize = 8;
+ int numTilesX = (tfParameters.texWidth + (areaTileSize - 1)) / areaTileSize;
+ int numTilesY = (tfParameters.texHeight + (areaTileSize - 1)) / areaTileSize;
// Now that we have validated our history, let's accumulate
// Bind the input buffers
@@ -153,6 +210,7 @@ static public void DenoiseBuffer(CommandBuffer cmd, TemporalFilterParameters tfP
cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.temporalAccKernel, HDShaderIDs._ValidationBuffer, tfResources.validationBuffer);
cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.temporalAccKernel, HDShaderIDs._VelocityBuffer, tfResources.velocityBuffer);
cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.temporalAccKernel, HDShaderIDs._CameraMotionVectorsTexture, tfResources.motionVectorBuffer);
+ cmd.SetComputeFloatParam(tfParameters.temporalFilterCS, HDShaderIDs._HistoryValidity, tfParameters.historyValidity);
// Bind the output buffer
cmd.SetComputeTextureParam(tfParameters.temporalFilterCS, tfParameters.temporalAccKernel, HDShaderIDs._DenoiseOutputTextureRW, tfResources.outputBuffer);
@@ -182,7 +240,6 @@ struct TemporalFilterArrayParameters
public Vector4 distanceChannelMask;
// Kernels
- public int validateHistoryKernel;
public int temporalAccKernel;
public int copyHistoryKernel;
public int temporalAccSingleKernel;
@@ -210,7 +267,6 @@ TemporalFilterArrayParameters PrepareTemporalFilterArrayParameters(HDCamera hdCa
tfaParams.distanceChannelMask = distanceChannelMask;
// Kernels
- tfaParams.validateHistoryKernel = m_ValidateHistoryKernel;
tfaParams.temporalAccKernel = singleChannel ? m_TemporalAccumulationSingleArrayKernel : m_TemporalAccumulationColorArrayKernel;
tfaParams.copyHistoryKernel = singleChannel ? m_CopyHistorySingleArrayKernel : m_CopyHistoryColorArrayKernel;
tfaParams.temporalAccSingleKernel = m_TemporalAccumulationSingleArrayKernel;
@@ -224,17 +280,15 @@ TemporalFilterArrayParameters PrepareTemporalFilterArrayParameters(HDCamera hdCa
struct TemporalFilterArrayResources
{
- // Input buffers
+ // Prepass buffers
public RTHandle depthStencilBuffer;
public RTHandle normalBuffer;
+ public RTHandle motionVectorBuffer;
+
+ // Effects buffer
public RTHandle velocityBuffer;
- public RTHandle historyDepthTexture;
- public RTHandle historyNormalTexture;
public RTHandle noisyBuffer;
public RTHandle distanceBuffer;
- public RTHandle motionVectorBuffer;
-
- // Temporary buffers
public RTHandle validationBuffer;
// InOutput buffers
@@ -249,42 +303,11 @@ struct TemporalFilterArrayResources
static void ExecuteTemporalFilterArray(CommandBuffer cmd, TemporalFilterArrayParameters tfaParams, TemporalFilterArrayResources tfaResources)
{
- if (tfaResources.historyDepthTexture == null || tfaResources.historyNormalTexture == null)
- {
- HDUtils.BlitCameraTexture(cmd, tfaResources.noisyBuffer, tfaResources.historyBuffer);
- HDUtils.BlitCameraTexture(cmd, tfaResources.noisyBuffer, tfaResources.outputBuffer);
- if (tfaParams.distanceBasedDenoiser)
- {
- HDUtils.BlitCameraTexture(cmd, tfaResources.distanceBuffer, tfaResources.distanceHistorySignal);
- HDUtils.BlitCameraTexture(cmd, tfaResources.distanceBuffer, tfaResources.outputDistanceSignal);
- }
- return;
- }
-
// Evaluate the dispatch parameters
int tfTileSize = 8;
int numTilesX = (tfaParams.texWidth + (tfTileSize - 1)) / tfTileSize;
int numTilesY = (tfaParams.texHeight + (tfTileSize - 1)) / tfTileSize;
- // First of all we need to validate the history to know where we can or cannot use the history signal
- // Bind all the input buffers
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._DepthTexture, tfaResources.depthStencilBuffer);
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._HistoryDepthTexture, tfaResources.historyDepthTexture);
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._NormalBufferTexture, tfaResources.normalBuffer);
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._HistoryNormalTexture, tfaResources.historyNormalTexture);
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._CameraMotionVectorsTexture, tfaResources.motionVectorBuffer);
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._VelocityBuffer, tfaResources.velocityBuffer);
-
- // Bind the constants
- cmd.SetComputeFloatParam(tfaParams.temporalFilterCS, HDShaderIDs._HistoryValidity, tfaParams.historyValidity);
- cmd.SetComputeFloatParam(tfaParams.temporalFilterCS, HDShaderIDs._PixelSpreadAngleTangent, tfaParams.pixelSpreadTangent);
-
- // Bind the output buffer
- cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, HDShaderIDs._ValidationBufferRW, tfaResources.validationBuffer);
-
- // Evaluate the validity
- cmd.DispatchCompute(tfaParams.temporalFilterCS, tfaParams.validateHistoryKernel, numTilesX, numTilesY, tfaParams.viewCount);
-
// Now that we have validated our history, let's accumulate
cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.temporalAccKernel, HDShaderIDs._DenoiseInputTexture, tfaResources.noisyBuffer);
cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.temporalAccKernel, HDShaderIDs._HistoryBuffer, tfaResources.historyBuffer);
@@ -297,6 +320,7 @@ static void ExecuteTemporalFilterArray(CommandBuffer cmd, TemporalFilterArrayPar
// Bind the constants
cmd.SetComputeIntParam(tfaParams.temporalFilterCS, HDShaderIDs._DenoisingHistorySlice, tfaParams.sliceIndex);
cmd.SetComputeVectorParam(tfaParams.temporalFilterCS, HDShaderIDs._DenoisingHistoryMask, tfaParams.channelMask);
+ cmd.SetComputeFloatParam(tfaParams.temporalFilterCS, HDShaderIDs._HistoryValidity, tfaParams.historyValidity);
// Bind the output buffer
cmd.SetComputeTextureParam(tfaParams.temporalFilterCS, tfaParams.temporalAccKernel, HDShaderIDs._DenoiseOutputTextureRW, tfaResources.outputBuffer);
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute
index 3aaddc280f3..975294cdcfa 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Denoising/TemporalFilter.compute
@@ -33,6 +33,9 @@
// Depth buffer of the current frame
TEXTURE2D_X(_DepthTexture);
+// Stencil buffer of the current frame
+TEXTURE2D_X_UINT2(_StencilTexture);
+int _ObjectMotionStencilBit;
// Depth buffer of the previous frame
TEXTURE2D_X(_HistoryDepthTexture);
// Normal buffer of the previous frame
@@ -121,9 +124,9 @@ void ValidateHistory(uint3 dispatchThreadId : SV_DispatchThreadID, uint2 groupTh
return;
}
- // We sample the velocity buffer, if not null
- float sampleVelocity = LOAD_TEXTURE2D_X(_VelocityBuffer, centerCoord).r;
- if (sampleVelocity > MINIMAL_MOTION_DISTANCE)
+ // Was the object of this pixel moving?
+ uint stencilValue = GetStencilValue(LOAD_TEXTURE2D_X(_StencilTexture, centerCoord));
+ if ((stencilValue & _ObjectMotionStencilBit) != 0)
{
_ValidationBufferRW[COORD_TEXTURE2D_X(centerCoord)] = 0;
return;
@@ -204,19 +207,22 @@ void TEMPORAL_ACCUMULATION(uint3 dispatchThreadId : SV_DispatchThreadID, uint2 g
#endif
// Get the velocity of the current sample
- float sampleVelocity = LOAD_TEXTURE2D_X(_VelocityBuffer, centerCoord).r;
+ float movingIntersection = LOAD_TEXTURE2D_X(_VelocityBuffer, centerCoord).r > MINIMAL_MOTION_DISTANCE;
// Accumulation factor that tells us how much we need to keep the history data
float accumulationFactor = 0.0;
+ // Combine the history validity from both sources
+ bool historyInvalid = (_ValidationBuffer[COORD_TEXTURE2D_X(centerCoord)].x * _HistoryValidity) < 1.0f;
+
// If the history is invalid or the history was flagged as moving (sampleCount == 0.0)
- if (_ValidationBuffer[COORD_TEXTURE2D_X(centerCoord)].x < 1.0 || sampleCount == 0.0)
+ if (historyInvalid || sampleCount == 0.0 || movingIntersection)
{
// We only take the current value
accumulationFactor = 0.0;
history = 0.0;
// And the sample count of history becomes 1 (or 0 if the previous sample was mooving)
- sampleCount = sampleVelocity > MINIMAL_MOTION_DISTANCE ? 0.0 : 1.0;
+ sampleCount = movingIntersection ? 0.0 : 1.0;
}
else
{
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingAmbientOcclusion.raytrace b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingAmbientOcclusion.raytrace
index f1be448e6e9..15a66abcd10 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingAmbientOcclusion.raytrace
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/RaytracingAmbientOcclusion.raytrace
@@ -21,6 +21,7 @@ TEXTURE2D_X(_DepthTexture);
// Output structure of the reflection raytrace shader
RW_TEXTURE2D_X(float, _AmbientOcclusionTextureRW);
+RW_TEXTURE2D_X(float, _VelocityBuffer);
[shader("miss")]
void MissShaderAmbientOcclusion(inout RayIntersection rayIntersection : SV_RayPayload)
@@ -66,7 +67,7 @@ void RayGenAmbientOcclusion()
// Variable that accumulate the radiance
float finalColor = 0.0;
-
+ float velocity = 0.0f;
// Let's loop through th e samples
for (int i = 0; i < numSamples; ++i)
{
@@ -98,8 +99,9 @@ void RayGenAmbientOcclusion()
// Evaluate the ray intersection
TraceRay(_RaytracingAccelerationStructure, RAY_FLAG_CULL_BACK_FACING_TRIANGLES, RAYTRACINGRENDERERFLAG_AMBIENT_OCCLUSION, 0, 1, 0, rayDescriptor, rayIntersection);
-
+
// Accumulate this value
+ velocity = max(velocity, rayIntersection.velocity);
finalColor += rayIntersection.color.x;
}
@@ -108,6 +110,7 @@ void RayGenAmbientOcclusion()
// Alright we are done
_AmbientOcclusionTextureRW[COORD_TEXTURE2D_X(currentPixelCoord)] = finalColor;
+ _VelocityBuffer[COORD_TEXTURE2D_X(currentPixelCoord)] = velocity;
}
// Fallback default any hit shader for this raytrace shader
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader
index 6a39449b45a..4a03fe3c643 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/RenderPass/MotionVectors/CameraMotionVectors.shader
@@ -82,7 +82,9 @@ Shader "Hidden/HDRP/CameraMotionVectors"
ReadMask [_StencilMask]
Ref [_StencilRef]
Comp NotEqual
- Fail Zero // We won't need the bit anymore.
+ // This line is intentionally commented, we keep the objectmotionvector information
+ // as it is used to do history rejection for numerous temporal accumulation based effects.
+ // Fail Zero // We won't need the bit anymore.
}
Cull Off ZWrite Off
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs
index 049d153968e..675e2dc6d82 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/HDRISky/HDRISky.cs
@@ -169,6 +169,21 @@ public override int GetHashCode()
return hash;
}
+ ///
+ /// Determines if the SkySettings is significantly divergent from another. This is going to be used to determine whether
+ /// to reset completely the ambient probe instead of using previous one when waiting for current data upon changes.
+ /// In addition to the checks done with the base function, this HDRISky override checks whether the cubemap parameter
+ /// has changed if both settings are HDRISky.
+ ///
+ /// The settings to compare with.
+ /// Whether the settings are deemed very different.
+ public override bool SignificantlyDivergesFrom(SkySettings otherSettings)
+ {
+ HDRISky otherHdriSkySettings = otherSettings as HDRISky;
+
+ return base.SignificantlyDivergesFrom(otherSettings) || hdriSky.value != otherHdriSkySettings.hdriSky.value;
+ }
+
///
/// Returns HDRISkyRenderer type.
///
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs
index 086d6759107..d5434d3fd19 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyManager.cs
@@ -562,6 +562,11 @@ void AllocateNewRenderingContext(SkyUpdateContext skyContext, int slot, int newH
if (context.renderingContext == null)
context.renderingContext = new SkyRenderingContext(m_Resolution, m_IBLFilterArray.Length, supportConvolution, previousAmbientProbe, name);
+ // If we detected a big difference with previous settings, then carrying over the previous ambient probe is probably going to lead to unexpected result.
+ // Instead we at least fallback to a neutral one until async readback has finished.
+ if (skyContext.settingsHadBigDifferenceWithPrev)
+ context.renderingContext.ClearAmbientProbe();
+
skyContext.cachedSkyRenderingContextId = slot;
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs
index 2e7d3fb760a..203ea852c1b 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyRenderer.cs
@@ -70,24 +70,7 @@ public virtual void PreRenderSky(BuiltinSkyParameters builtinParams) {}
/// Returns SkySetting exposure.
protected static float GetSkyIntensity(SkySettings skySettings, DebugDisplaySettings debugSettings)
{
- float skyIntensity = 1.0f;
-
- switch (skySettings.skyIntensityMode.value)
- {
- case SkyIntensityMode.Exposure:
- // Note: Here we use EV100 of sky as a multiplier, so it is the opposite of when use with a Camera
- // because for sky/light, higher EV mean brighter, but for camera higher EV mean darker scene
- skyIntensity *= ColorUtils.ConvertEV100ToExposure(-skySettings.exposure.value);
- break;
- case SkyIntensityMode.Multiplier:
- skyIntensity *= skySettings.multiplier.value;
- break;
- case SkyIntensityMode.Lux:
- skyIntensity *= skySettings.desiredLuxValue.value / skySettings.upperHemisphereLuxValue.value;
- break;
- }
-
- return skyIntensity;
+ return skySettings.GetIntensityFromSettings();
}
///
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkySettings.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkySettings.cs
index bd2980b3ba7..441ad44f08c 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkySettings.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkySettings.cs
@@ -217,6 +217,51 @@ public static int GetUniqueID(Type type)
return uniqueID;
}
+ ///
+ /// Returns the sky intensity as determined by this SkySetting.
+ ///
+ /// The sky intensity.
+ public float GetIntensityFromSettings()
+ {
+ float skyIntensity = 1.0f;
+ switch (skyIntensityMode.value)
+ {
+ case SkyIntensityMode.Exposure:
+ // Note: Here we use EV100 of sky as a multiplier, so it is the opposite of when use with a Camera
+ // because for sky/light, higher EV mean brighter, but for camera higher EV mean darker scene
+ skyIntensity *= ColorUtils.ConvertEV100ToExposure(-exposure.value);
+ break;
+ case SkyIntensityMode.Multiplier:
+ skyIntensity *= multiplier.value;
+ break;
+ case SkyIntensityMode.Lux:
+ skyIntensity *= desiredLuxValue.value / Mathf.Max(upperHemisphereLuxValue.value, 1e-5f);
+ break;
+ }
+ return skyIntensity;
+ }
+
+ ///
+ /// Determines if the SkySettings is significantly divergent from another. This is going to be used to determine whether
+ /// to reset completely the ambient probe instead of using previous one when waiting for current data upon changes.
+ /// Override this to have a per-sky specific heuristic.
+ ///
+ /// The settings to compare with.
+ /// Whether the settings are deemed very different.
+ public virtual bool SignificantlyDivergesFrom(SkySettings otherSettings)
+ {
+ if (otherSettings == null || otherSettings.GetSkyRendererType() != GetSkyRendererType())
+ return true;
+
+ float thisIntensity = GetIntensityFromSettings();
+ float otherIntensity = otherSettings.GetIntensityFromSettings();
+
+ // This is an arbitrary difference threshold. This needs to be re-evaluated in case it is proven problematic
+ float intensityRatio = thisIntensity > otherIntensity ? (thisIntensity / otherIntensity) : (otherIntensity / thisIntensity);
+ const float ratioThreshold = 3.0f;
+ return intensityRatio > ratioThreshold;
+ }
+
///
/// Returns the class type of the SkyRenderer associated with this Sky Settings.
///
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs
index 9127a4824f0..c96e5894218 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Sky/SkyUpdateContext.cs
@@ -11,6 +11,8 @@ internal class SkyUpdateContext
public int skyParametersHash = -1;
public float currentUpdateTime = 0.0f;
+ public bool settingsHadBigDifferenceWithPrev { get; private set; }
+
public SkySettings skySettings
{
get { return m_SkySettings; }
@@ -25,6 +27,11 @@ public SkySettings skySettings
skyRenderer = null;
}
+ if (m_SkySettings == null)
+ settingsHadBigDifferenceWithPrev = true;
+ else
+ settingsHadBigDifferenceWithPrev = m_SkySettings.SignificantlyDivergesFrom(value);
+
if (m_SkySettings == value)
return;
diff --git a/com.unity.visualeffectgraph/CHANGELOG.md b/com.unity.visualeffectgraph/CHANGELOG.md
index d6445d0c052..1bcf157dab8 100644
--- a/com.unity.visualeffectgraph/CHANGELOG.md
+++ b/com.unity.visualeffectgraph/CHANGELOG.md
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- Changed the "Edit" button so it becomes "New" when no asset is set on a Visual Effect component, in order to save a new visual effect graph asset.
+- Tidy up of platform abstraction code for random number generation, requires a dependency on com.unity.render-pipelines.core for those abstractions.
### Fixed
- Forbid incorrect link between incompatible context [Case 1269756](https://issuetracker.unity3d.com/product/unity/issues/guid/1269756/)
diff --git a/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl b/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl
index 9c1b789cc95..7ad2223b497 100644
--- a/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl
+++ b/com.unity.visualeffectgraph/Shaders/VFXCommon.hlsl
@@ -1,3 +1,6 @@
+// Required for the correct use of cross platform abstractions.
+#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
+
//Helper to disable bounding box compute code
#define USE_DYNAMIC_AABB 1
@@ -267,7 +270,7 @@ uint VFXMul24(uint a, uint b)
#ifndef SHADER_API_PSSL
return (a & 0xffffff) * (b & 0xffffff); // Tmp to ensure correct inputs
#else
- return mul24(a, b);
+ return Mul24(a, b);
#endif
}
@@ -311,7 +314,7 @@ uint Lcg(uint seed)
const uint multiplier = 0x0019660d;
const uint increment = 0x3c6ef35f;
#if RAND_24BITS && defined(SHADER_API_PSSL)
- return mad24(multiplier, seed, increment);
+ return Mad24(multiplier, seed, increment);
#else
return multiplier * seed + increment;
#endif
@@ -321,7 +324,7 @@ float ToFloat01(uint u)
{
#if !RAND_24BITS
return asfloat((u >> 9) | 0x3f800000) - 1.0f;
-#else //Using mad24 keeping consitency between platform
+#else //Using Mad24 keeping consitency between platform
return asfloat((u & 0x007fffff) | 0x3f800000) - 1.0f;
#endif
}
diff --git a/com.unity.visualeffectgraph/package.json b/com.unity.visualeffectgraph/package.json
index ed4bd32d191..08cf5657196 100644
--- a/com.unity.visualeffectgraph/package.json
+++ b/com.unity.visualeffectgraph/package.json
@@ -13,7 +13,8 @@
"particles"
],
"dependencies": {
- "com.unity.shadergraph": "11.0.0"
+ "com.unity.shadergraph": "11.0.0",
+ "com.unity.render-pipelines.core": "11.0.0"
},
"samples": [
{