diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md
index 40d167030e9..a2b1726ffbc 100644
--- a/com.unity.render-pipelines.high-definition/CHANGELOG.md
+++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md
@@ -50,6 +50,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed culling of planar reflection probes that change position (case 1218651)
- Fixed null reference when processing lightprobe (case 1235285)
- Fix black screen in XR when HDRP package is present but not used.
+- Fixed white flash happening with auto-exposure in some cases (case 1223774)
+- Fixed NaN which can appear with real time reflection and inf value
+- Fixed raytracing shader compilation on Metal
+- Fixed an issue that was collapsing the volume components in the HDRP default settings
+- Fixed warning about missing bound decal buffer
### Changed
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/AxF-Shader.md b/com.unity.render-pipelines.high-definition/Documentation~/AxF-Shader.md
index 0d5cb0b20ee..5a346878a38 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/AxF-Shader.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/AxF-Shader.md
@@ -25,7 +25,7 @@ This process does not duplicate the Textures and other resources that the origin
### Creating AxF Materials from scratch
-New Materials in HDRP use the [Lit Shader](https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@7.1/manual/Lit-Shader.html) by default. To create an AxF Material from scratch, create a Material and then make it use the AxF Shader. To do this:
+New Materials in HDRP use the [Lit Shader](Lit-Shader.md) by default. To create an AxF Material from scratch, create a Material and then make it use the AxF Shader. To do this:
1. In the Unity Editor, navigate to your Project's Asset window.
2. Right-click the Asset Window and select **Create > Material**. This adds a new Material to your Unity Project’s Asset folder.
@@ -60,8 +60,9 @@ Note: The AxF Importer imports every Texture as half float, linear, sRGB gamut (
| --------------------- | ------------------------------------------------------------ |
| **Material Tiling U** | Sets the tile rate along the x-axis for every Texture in the **Surface Inputs** section. HDRP uses this value to tile the Textures along the x-axis of the Material’s surface, in object space. |
| **Material Tiling V** | Sets the tile rate along the y-axis for every Texture in the **Surface Inputs** section. HDRP uses this value to tile the Textures along the y-axis of the Material’s surface, in object space. |
-| **BRDF Type** | Controls the main AxF Material representation.
• **SVBRDF**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - SVBRDF](https://docs.google.com/document/d/1_Oq2hsx3J7h8GHKoQM_8qf6Ip5VlHv_31K7dYYVOEmU/edit#heading=h.f1msh9g44mev).
•**CAR_PAINT**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - CAR_PAINT](https://docs.google.com/document/d/1_Oq2hsx3J7h8GHKoQM_8qf6Ip5VlHv_31K7dYYVOEmU/edit#heading=h.eorkre6buegg). |
+| **BRDF Type** | Controls the main AxF Material representation.
• **SVBRDF**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - SVBRDF](#SVBRDF).
•**CAR_PAINT**: For information on the properties Unity makes visible when you select this option, see [BRDF Type - CAR_PAINT](#CAR_PAINT). |
+
#### BRDF Type - SVBRDF
| **Property** | **Description** |
@@ -86,6 +87,7 @@ Note: The AxF Importer imports every Texture as half float, linear, sRGB gamut (
| **- Enable Refraction** | Indicates whether the clear coat is refractive. If you enable this checkbox, HDRP uses angles refracted by the clear coat to evaluate the undercoat of the Material surface. |
| **- - Clearcoat IOR** | Specifies a Texture (red channel only) that implicitly defines the index of refraction (IOR) for the clear coat by encoding it to a monochromatic (single value) F0 (aka as specular color or Fresnel reflectance at 0 degree incidence. This also assumes the coat interfaces with air). As such, the value is in the range of **0** to **1** and HDRP calculates the final IOR as:
`IOR = (1.0 + squareRoot(R) ) / (1.0 - squareRoot(R))`
Where **R** is the normalized value in the red color channel of this Texture. Note: HDRP uses this IOR for both coat refraction and, if enabled, transmission and reflectance calculations through and on the coat. Therefore, you must always assign a Texture to this property when you enable clear coat. |
+
#### BRDF Type - CAR_PAINT
| **Property** | **Description** |
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs
index b244d14d284..35167715150 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Settings/DefaultSettingsPanel.cs
@@ -45,7 +45,7 @@ public class Styles
ReorderableList m_BeforeTransparentCustomPostProcesses;
ReorderableList m_BeforePostProcessCustomPostProcesses;
ReorderableList m_AfterPostProcessCustomPostProcesses;
- int m_CurrentVolumeProfileHash;
+ int m_CurrentVolumeProfileInstanceID;
public void OnGUI(string searchContext)
{
@@ -209,9 +209,9 @@ void Draw_VolumeInspector()
EditorGUILayout.EndHorizontal();
// The state of the profile can change without the asset reference changing so in this case we need to reset the editor.
- if (m_CurrentVolumeProfileHash != asset.GetHashCode() && m_CachedDefaultVolumeProfileEditor != null)
+ if (m_CurrentVolumeProfileInstanceID != asset.GetInstanceID() && m_CachedDefaultVolumeProfileEditor != null)
{
- m_CurrentVolumeProfileHash = asset.GetHashCode();
+ m_CurrentVolumeProfileInstanceID = asset.GetInstanceID();
m_CachedDefaultVolumeProfileEditor = null;
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl
index db345b63d26..873dbb2195f 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/LightLoop/LightLoopDef.hlsl
@@ -130,6 +130,9 @@ float4 SampleEnv(LightLoopContext lightLoopContext, int index, float3 texCoord,
color.rgb = SampleSkyTexture(texCoord, lod, sliceIdx).rgb;
}
+ // Planar, Reflection Probes and Sky aren't pre-expose, so best to clamp to max16 here in case of inf
+ color.rgb = ClampToFloat16Max(color.rgb);
+
return color;
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader
index 6857146ac21..4ffd39c9568 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadows.shader
@@ -7,6 +7,7 @@ Shader "Hidden/HDRP/ScreenSpaceShadows"
#pragma target 4.5
#pragma only_renderers d3d11 playstation xboxone vulkan metal switch
#include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"
+ #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonLighting.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Builtin/BuiltinData.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"
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader
index 48fb5ccf9de..a9cac1fe65f 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader
+++ b/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLit.shader
@@ -369,7 +369,6 @@ Shader "HDRP/LayeredLit"
HLSLINCLUDE
#pragma target 4.5
- #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
#pragma shader_feature_local _ALPHATEST_ON
#pragma shader_feature_local _DEPTHOFFSET_ON
@@ -527,6 +526,8 @@ Shader "HDRP/LayeredLit"
ColorMask 0
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -556,7 +557,7 @@ Shader "HDRP/LayeredLit"
Tags { "LightMode" = "GBuffer" } // This will be only for opaque object based on the RenderQueue index
Cull [_CullMode]
- ZTest[_ZTestGBuffer]
+ ZTest [_ZTestGBuffer]
Stencil
{
@@ -567,6 +568,8 @@ Shader "HDRP/LayeredLit"
}
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -593,8 +596,8 @@ Shader "HDRP/LayeredLit"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Material.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl"
#include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/ShaderPass/LitSharePass.hlsl"
- #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitData.hlsl"
- #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassGBuffer.hlsl"
+ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/Material/LayeredLit/LayeredLitData.hlsl"
+ #include "Packages/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/ShaderPass/ShaderPassGBuffer.hlsl"
#pragma vertex Vert
#pragma fragment Frag
@@ -612,6 +615,8 @@ Shader "HDRP/LayeredLit"
Cull Off
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -652,6 +657,8 @@ Shader "HDRP/LayeredLit"
ZWrite On
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -690,6 +697,8 @@ Shader "HDRP/LayeredLit"
ColorMask 0
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -726,6 +735,8 @@ Shader "HDRP/LayeredLit"
ZWrite On
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -774,6 +785,8 @@ Shader "HDRP/LayeredLit"
Cull [_CullMode]
HLSLPROGRAM
+
+ #pragma only_renderers d3d11 playstation xboxone vulkan metal switch
//enable GPU instancing support
#pragma multi_compile_instancing
#pragma instancing_options renderinglayer
@@ -837,6 +850,8 @@ Shader "HDRP/LayeredLit"
HLSLPROGRAM
+ #pragma only_renderers d3d11
+
#pragma raytracing surface_shader
#pragma multi_compile _ DEBUG_DISPLAY
@@ -880,6 +895,8 @@ Shader "HDRP/LayeredLit"
HLSLPROGRAM
+ #pragma only_renderers d3d11
+
#pragma raytracing surface_shader
#pragma multi_compile _ DEBUG_DISPLAY
@@ -919,6 +936,8 @@ Shader "HDRP/LayeredLit"
HLSLPROGRAM
+ #pragma only_renderers d3d11
+
#pragma raytracing surface_shader
#pragma multi_compile _ DEBUG_DISPLAY
@@ -954,6 +973,8 @@ Shader "HDRP/LayeredLit"
HLSLPROGRAM
+ #pragma only_renderers d3d11
+
#pragma raytracing surface_shader
#define SHADERPASS SHADERPASS_RAYTRACING_VISIBILITY
@@ -978,6 +999,8 @@ Shader "HDRP/LayeredLit"
HLSLPROGRAM
+ #pragma only_renderers d3d11
+
#pragma raytracing surface_shader
#pragma multi_compile _ DEBUG_DISPLAY
@@ -1010,6 +1033,8 @@ Shader "HDRP/LayeredLit"
HLSLPROGRAM
+ #pragma only_renderers d3d11
+
#pragma raytracing surface_shader
#pragma multi_compile _ DEBUG_DISPLAY
diff --git a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs
index 0d1e26a9a19..89cfa38f09d 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/PostProcessing/PostProcessSystem.cs
@@ -372,7 +372,11 @@ public void BeginFrame(CommandBuffer cmd, HDCamera camera, HDRenderPipeline hdIn
}
else
{
- if (IsExposureFixed())
+ // Fix exposure is store in Exposure Textures at the beginning of the frame as there is no need for color buffer
+ // Dynamic exposure (Auto, curve) is store in Exposure Textures at the end of the frame (as it rely on color buffer)
+ // Texture current and previous are swapped at the beginning of the frame.
+ bool isFixedExposure = IsExposureFixed();
+ if (isFixedExposure)
{
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.FixedExposure)))
{
@@ -380,7 +384,14 @@ public void BeginFrame(CommandBuffer cmd, HDCamera camera, HDRenderPipeline hdIn
}
}
- cmd.SetGlobalTexture(HDShaderIDs._ExposureTexture, GetExposureTexture(camera));
+ // Note: GetExposureTexture(camera) must be call AFTER the call of DoFixedExposure to be correctly taken into account
+ // When we use Dynamic Exposure and we reset history we can't use pre-exposure (as there is no information)
+ // For this reasons we put neutral value at the beginning of the frame in Exposure textures and
+ // apply processed exposure from color buffer at the end of the Frame, only for a single frame.
+ // After that we re-use the pre-exposure system
+ RTHandle currentExposureTexture = (camera.resetPostProcessingHistory && !isFixedExposure) ? m_EmptyExposureTexture : GetExposureTexture(camera);
+
+ cmd.SetGlobalTexture(HDShaderIDs._ExposureTexture, currentExposureTexture);
cmd.SetGlobalTexture(HDShaderIDs._PrevExposureTexture, GetPreviousExposureTexture(camera));
}
}
@@ -485,9 +496,9 @@ void PoolSource(ref RTHandle src, RTHandle dst)
cmd.DispatchCompute(cs, kernel, (camera.actualWidth + 7) / 8, (camera.actualHeight + 7) / 8, camera.viewCount);
PoolSource(ref source, destination);
+ }
}
}
- }
if (m_PostProcessEnabled)
{
@@ -876,9 +887,9 @@ void DoDynamicExposure(CommandBuffer cmd, HDCamera camera, RTHandle colorBuffer,
if (camera.resetPostProcessingHistory)
{
- kernel = cs.FindKernel("KReset");
- cmd.SetComputeTextureParam(cs, kernel, HDShaderIDs._OutputTexture, prevExposure);
- cmd.DispatchCompute(cs, kernel, 1, 1, 1);
+ // For Dynamic Exposure, we need to undo the pre-exposure from the color buffer to calculate the correct one
+ // When we reset history we must setup neutral value
+ prevExposure = m_EmptyExposureTexture; // Use neutral texture
}
m_ExposureVariants[0] = 1; // (int)exposureSettings.luminanceSource.value;
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
index ab4468b6cad..3ab1fcabdd2 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDRenderPipeline.cs
@@ -3104,6 +3104,10 @@ void RenderDBuffer(HDCamera hdCamera, CommandBuffer cmd, ScriptableRenderContext
{
// We still bind black textures to make sure that something is bound (can be a problem on some platforms)
m_DbufferManager.BindBlackTextures(cmd);
+
+ // Bind buffer to make sure that something is bound .
+ cmd.SetGlobalBuffer(HDShaderIDs._DecalPropertyMaskBufferSRV, m_DbufferManager.propertyMaskBuffer);
+
return;
}