diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md
index 7216985f991..339f4b79dc5 100644
--- a/com.unity.render-pipelines.high-definition/CHANGELOG.md
+++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md
@@ -28,7 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added Simple mode to Earth Preset for PBR Sky
- Added the export of normals during the prepass for shadow matte for proper SSAO calculation.
- Added the usage of SSAO for shadow matte unlit shader graph.
-
+- Added a new volume component parameter to control the max ray length of directional lights(case 1279849).
### Fixed
- Fixed several issues with physically-based DoF (TAA ghosting of the CoC buffer, smooth layer transitions, etc)
- Fixed GPU hang on D3D12 on xbox.
@@ -150,6 +150,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- When trying to install the local configuration package, if another one is already present the user is now asked whether they want to keep it or not.
- Improved MSAA color resolve to fix issues when very bright and very dark samples are resolved together.
- Improve performance of GPU light AABB generation
+- Removed the max clamp value for the RTR, RTAO and RTGI's ray length (case 1279849).
## [10.0.0] - 2019-06-10
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Ambient-Occlusion.md b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Ambient-Occlusion.md
index 105afe19a9f..45c4ac3958f 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Ambient-Occlusion.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Ambient-Occlusion.md
@@ -62,7 +62,7 @@ Ray-Traced Ambient Occlusion uses the [Volume](Volumes.md) framework, so to enab
| **Direct Lighting Strength** | Controls how much the ambient occlusion affects direct lighting. |
| **LayerMask** | Defines the layers that HDRP processes this ray-traced effect for. |
| **Quality** | Specifies the preset HDRP uses to populate the values of the following nested properties. The options are:
• **Low**: A preset that emphasizes performance over quality.
• **Medium**: A preset that balances performance and quality.
• **High**: A preset that emphasizes quality over performance.
• **Custom**: Allows you to override each property individually. |
-| - **Ray Length** | Controls the length of the rays that HDRP uses for ray tracing. This allows you to have smaller scale, local, ambient occlusion. |
+| - **Max Ray Length** | Controls the maximal ray length of the rays that HDRP uses for ray traced ambient occlusion. This allows you to have smaller scale, local, ambient occlusion. |
| - **Sample Count** | Controls the number of rays that HDRP uses per pixel, per frame. Increasing this value increases execution time linearly. |
| - **Denoise** | Enables the spatio-temporal filter that HDRP uses to remove noise from the ambient occlusion. |
| - - **Denoiser Radius** | Controls the radius of the spatio-temporal filter. A higher value reduces noise further. |
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Global-Illumination.md b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Global-Illumination.md
index 5ad3e4dad4a..9ad0873edb9 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Global-Illumination.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Global-Illumination.md
@@ -49,7 +49,7 @@ Alongside the standard properties, Unity makes different properties available de
| **LayerMask** | Defines the layers that HDRP processes this ray-traced effect for. |
| **Mode** | Defines if HDRP should evaluate the effect in **Performance** or **Quality** mode.
This property only appears if you select set **Supported Ray Tracing Mode** in your HDRP Asset to **Both**. |
| **Quality** | Specifies the preset HDRP uses to populate the values of the following nested properties. The options are:
• **Low**: A preset that emphasizes performance over quality.
• **Medium**: A preset that balances performance and quality.
• **High**: A preset that emphasizes quality over performance.
• **Custom**: Allows you to override each property individually.
This property only appears in [Performance](Ray-Tracing-Getting-Started.md#ray-tracing-mode) mode. |
-| **Ray Length** | Set a value to control the length of the rays that HDRP uses for ray tracing. If a ray doesn't find an intersection, then the ray returns the color of the sky. |
+| **Max Ray Length** | Controls the maximal length of reflection rays. The higher this value is, the more expensive ray traced reflections are. If a ray doesn't find an intersection, then the ray returns the color of the sky if Reflect Sky is enabled, or black if not. |
| **Clamp Value** | Set a value to control the threshold that HDRP uses to clamp the pre-exposed value. This reduces the range of values and makes the global illumination more stable to denoise, but reduces quality. |
| **Denoise** | Enable this to enable the spatio-temporal filter that HDRP uses to remove noise from the Ray-Traced Global Illumination. |
| - **Half Resolution Denoiser** | Enable this feature to evaluate the spatio-temporal filter in half resolution. This decreases the resource intensity of denoising but reduces quality. |
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Reflections.md b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Reflections.md
index 089e91e5a81..9725cbc7d21 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Reflections.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Traced-Reflections.md
@@ -66,7 +66,7 @@ Alongside the standard properties, Unity exposes extra properties depending on t
| **Quality** | Specifies the preset HDRP uses to populate the values of the following nested properties. The options are:
• **Low**: A preset that emphasizes performance over quality.
• **Medium**: A preset that balances performance and quality.
• **High**: A preset that emphasizes quality over performance.
• **Custom**: Allows you to override each property individually.
This property only appears in [Performance](Ray-Tracing-Getting-Started.md#ray-tracing-mode) mode. |
| **Minimum Smoothness** | Controls the minimum smoothness value for a pixel at which HDRP processes ray-traced reflections. If the smoothness value of the pixel is lower than this value, HDRP falls back to the next available reflection method in the [reflection hierarchy](Reflection-in-HDRP.md#ReflectionHierarchy). |
| **Smoothness Fade Start** | Controls the smoothness value at which the smoothness controlled fade out starts. The fade is in the range [Minimum Smoothness, Smoothness Fade Start]. |
-| **Ray Length** | Controls the length of the rays that HDRP uses for ray tracing. If a ray doesn't find an intersection, then the ray returns the color of the sky if Reflect Sky is enabled, or black if not. |
+| **Max Ray Length** | Controls the maximal length of global illumination rays. The higher this value is, the more expensive ray traced global illumination is. If a ray doesn't find an intersection. |
| **Clamp Value** | Controls the threshold that HDRP uses to clamp the pre-exposed value. This reduces the range of values and makes the reflections more stable to denoise, but reduces quality. |
| **Denoise** | Enables the spatio-temporal filter that HDRP uses to remove noise from the reflections. |
| - **Denoiser Radius** | Controls the radius of the spatio-temporal filter. Increasing this value results in a more blurry result and a higher execution time. |
diff --git a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Settings.md b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Settings.md
index f0007113233..32bab15a3c8 100644
--- a/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Settings.md
+++ b/com.unity.render-pipelines.high-definition/Documentation~/Ray-Tracing-Settings.md
@@ -14,3 +14,4 @@ In the High Definition Render Pipeline (HDRP), various ray-traced effects share
| **Ray Bias** | Specifies the bias value HDRP applies when casting rays for all effects. This value should remain unchained unless your scene scale is significantly smaller or larger than average. |
| **Extend Shadow Culling** | Extends the sets of GameObjects that HDRP includes in shadow maps for more accurate shadows in ray traced effects. |
| **Extend Camera Culling** | Extends the sets of GameObjects that HDRP includes in the rendering. This is a way to force skinned mesh animations for GameObjects that are not in the frustum. |
+| **Directional Shadow Ray Length** | Controls the maximal ray length for ray traced directional shadows. |
\ No newline at end of file
diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs
index 81e0f679b79..dbfb814846f 100644
--- a/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/AmbientOcclusionEditor.cs
@@ -87,7 +87,7 @@ public override void OnInspectorGUI()
using (new EditorGUI.DisabledScope(!useCustomValue))
{
EditorGUI.indentLevel++;
- PropertyField(m_RayLength, EditorGUIUtility.TrTextContent("Ray Length", "Controls the length of ambient occlusion rays."));
+ PropertyField(m_RayLength, EditorGUIUtility.TrTextContent("Max Ray Length", "Controls the maximal length of ambient occlusion rays. The higher this value is, the more expensive ray traced ambient occlusion is."));
PropertyField(m_SampleCount, EditorGUIUtility.TrTextContent("Sample Count", "Number of samples for ray traced ambient occlusion."));
PropertyField(m_Denoise, EditorGUIUtility.TrTextContent("Denoise", "Enable denoising on the ray traced ambient occlusion."));
{
diff --git a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs
index d5364b9a6d8..fa449727f64 100644
--- a/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/Lighting/Reflection/HDScreenSpaceReflectionEditor.cs
@@ -80,7 +80,7 @@ public override void OnEnable()
static public readonly GUIContent k_ScreenFaceDistanceText = EditorGUIUtility.TrTextContent("Screen Edge Fade Distance", "Controls the distance at which HDRP fades out SSR near the edge of the screen.");
static public readonly GUIContent k_DepthBufferThicknessText = EditorGUIUtility.TrTextContent("Object Thickness", "Controls the typical thickness of objects the reflection rays may pass behind.");
static public readonly GUIContent k_RayMaxIterationsText = EditorGUIUtility.TrTextContent("Max Ray Steps", "Sets the maximum number of steps HDRP uses for raytracing. Affects both correctness and performance.");
- static public readonly GUIContent k_RayLengthText = EditorGUIUtility.TrTextContent("Ray Length", "Controls the length of reflection rays.");
+ static public readonly GUIContent k_RayLengthText = EditorGUIUtility.TrTextContent("Max Ray Length", "Controls the maximal length of reflection rays. The higher this value is, the more expensive ray traced reflections are.");
static public readonly GUIContent k_ClampValueText = EditorGUIUtility.TrTextContent("Clamp Value", "Clamps the exposed intensity.");
static public readonly GUIContent k_SampleCountText = EditorGUIUtility.TrTextContent("Sample Count", "Number of samples for reflections.");
static public readonly GUIContent k_BounceCountText = EditorGUIUtility.TrTextContent("Bounce Count", "Number of bounces for reflection rays.");
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs
index 2ec5e495cba..2c7cb031ecd 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/GlobalIlluminationEditor.cs
@@ -75,6 +75,7 @@ public override void OnEnable()
m_SecondDenoiserPass = Unpack(o.Find(x => x.secondDenoiserPass));
}
+ static public readonly GUIContent k_RayLengthText = EditorGUIUtility.TrTextContent("Max Ray Length", "Controls the maximal length of global illumination rays. The higher this value is, the more expensive ray traced global illumination is.");
static public readonly GUIContent k_DepthBufferThicknessText = EditorGUIUtility.TrTextContent("Object Thickness", "Controls the typical thickness of objects the global illumination rays may pass behind.");
public void DenoiserGUI()
@@ -130,6 +131,7 @@ public override void OnInspectorGUI()
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledScope(!useCustomValue))
{
+ PropertyField(m_RayLength, k_RayLengthText);
PropertyField(m_RayLength);
PropertyField(m_ClampValue);
PropertyField(m_FullResolution);
@@ -142,7 +144,7 @@ public override void OnInspectorGUI()
break;
case RayTracingMode.Quality:
{
- PropertyField(m_RayLength);
+ PropertyField(m_RayLength, k_RayLengthText);
PropertyField(m_ClampValue);
PropertyField(m_SampleCount);
PropertyField(m_BounceCount);
@@ -154,7 +156,7 @@ public override void OnInspectorGUI()
}
else if (currentAsset.currentPlatformRenderPipelineSettings.supportedRayTracingMode == RenderPipelineSettings.SupportedRayTracingMode.Quality)
{
- PropertyField(m_RayLength);
+ PropertyField(m_RayLength, k_RayLengthText);
PropertyField(m_ClampValue);
PropertyField(m_SampleCount);
PropertyField(m_BounceCount);
@@ -166,6 +168,7 @@ public override void OnInspectorGUI()
EditorGUI.indentLevel++;
using (new EditorGUI.DisabledScope(!useCustomValue))
{
+ PropertyField(m_RayLength, k_RayLengthText);
PropertyField(m_RayLength);
PropertyField(m_ClampValue);
PropertyField(m_FullResolution);
diff --git a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RayTracingSettingsEditor.cs b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RayTracingSettingsEditor.cs
index e115aaa952a..23a8b7eb84a 100644
--- a/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RayTracingSettingsEditor.cs
+++ b/com.unity.render-pipelines.high-definition/Editor/RenderPipeline/Raytracing/RayTracingSettingsEditor.cs
@@ -11,6 +11,7 @@ class RayTracingSettingsEditor : VolumeComponentEditor
SerializedDataParameter m_RayBias;
SerializedDataParameter m_ExtendShadowCulling;
SerializedDataParameter m_ExtendCameraCulling;
+ SerializedDataParameter m_DirectionalShadowRayLength;
public override void OnEnable()
{
@@ -21,6 +22,7 @@ public override void OnEnable()
m_RayBias = Unpack(o.Find(x => x.rayBias));
m_ExtendShadowCulling = Unpack(o.Find(x => x.extendShadowCulling));
m_ExtendCameraCulling = Unpack(o.Find(x => x.extendCameraCulling));
+ m_DirectionalShadowRayLength = Unpack(o.Find(x => x.directionalShadowRayLength));
}
public override void OnInspectorGUI()
@@ -36,6 +38,7 @@ public override void OnInspectorGUI()
PropertyField(m_RayBias);
PropertyField(m_ExtendShadowCulling);
PropertyField(m_ExtendCameraCulling);
+ PropertyField(m_DirectionalShadowRayLength);
}
}
}
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs
index 0ecb713eca7..97c9528f841 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/GlobalIllumination.cs
@@ -241,8 +241,7 @@ public bool secondDenoiserPass
// RTGI
[SerializeField, FormerlySerializedAs("rayLength")]
- [Tooltip("Controls the length of GI rays.")]
- private ClampedFloatParameter m_RayLength = new ClampedFloatParameter(50.0f, 0f, 50f);
+ private MinFloatParameter m_RayLength = new MinFloatParameter(50.0f, 0.01f);
[SerializeField, FormerlySerializedAs("clampValue")]
[Tooltip("Controls the clamp of intensity.")]
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs
index 3c0e8cecf56..1a8f52fb4c1 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/AmbientOcclusion.cs
@@ -211,7 +211,7 @@ public int directionCount
// RTAO
[SerializeField, FormerlySerializedAs("rayLength")]
- private ClampedFloatParameter m_RayLength = new ClampedFloatParameter(0.5f, 0f, 50f);
+ private MinFloatParameter m_RayLength = new MinFloatParameter(50.0f, 0.01f);
[SerializeField, FormerlySerializedAs("sampleCount")]
private ClampedIntParameter m_SampleCount = new ClampedIntParameter(1, 1, 64);
[SerializeField, FormerlySerializedAs("denoise")]
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs
index eebc3628114..9689447edd5 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/ScreenSpaceLighting/ScreenSpaceReflection.cs
@@ -213,8 +213,7 @@ public int rayMaxIterations
private IntParameter m_RayMaxIterations = new IntParameter(32);
[SerializeField, FormerlySerializedAs("rayLength")]
- [Tooltip("Controls the length of reflection rays.")]
- private ClampedFloatParameter m_RayLength = new ClampedFloatParameter(50.0f, 0f, 50f);
+ private MinFloatParameter m_RayLength = new MinFloatParameter(50.0f, 0.01f);
[SerializeField, FormerlySerializedAs("clampValue")]
[Tooltip("Controls the clamp of intensity.")]
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs
index 07221989193..c2f199e17d5 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs
@@ -294,7 +294,6 @@ void RenderScreenSpaceShadows(HDCamera hdCamera, CommandBuffer cmd)
}
}
-
bool RenderLightScreenSpaceShadows(HDCamera hdCamera, CommandBuffer cmd)
{
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.RaytracingLightShadow)))
diff --git a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.cs b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.cs
index 4bf4697e72c..c06a41d12cf 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManagerDirectional.cs
@@ -17,6 +17,7 @@ struct RTShadowDirectionalTraceParameters
public bool softShadow;
public int numShadowSamples;
public bool colorShadow;
+ public float maxShadowLength;
// Kernels
public int clearShadowKernel;
@@ -33,6 +34,7 @@ struct RTShadowDirectionalTraceParameters
RTShadowDirectionalTraceParameters PrepareRTShadowDirectionalTraceParameters(HDCamera hdCamera, HDAdditionalLightData additionalLightData)
{
RTShadowDirectionalTraceParameters rtsdtParams = new RTShadowDirectionalTraceParameters();
+ RayTracingSettings rayTracingSettings = hdCamera.volumeStack.GetComponent();
// Set the camera parameters
rtsdtParams.texWidth = hdCamera.actualWidth;
@@ -44,6 +46,7 @@ RTShadowDirectionalTraceParameters PrepareRTShadowDirectionalTraceParameters(HDC
// If the surface is infinitively small, we force it to one sample.
rtsdtParams.numShadowSamples = rtsdtParams.softShadow ? additionalLightData.numRayTracingSamples : 1;
rtsdtParams.colorShadow = m_CurrentSunLightAdditionalLightData.colorShadow;
+ rtsdtParams.maxShadowLength = rayTracingSettings.directionalShadowRayLength.value;
// Kernels
rtsdtParams.clearShadowKernel = m_ClearShadowTexture;
@@ -151,6 +154,9 @@ static void ExecuteSSSDirectionalTrace(CommandBuffer cmd, RTShadowDirectionalTra
// Define the shader pass to use for the shadow pass
cmd.SetRayTracingShaderPass(rtsdtParams.screenSpaceShadowRT, "VisibilityDXR");
+ // Input Uniforms
+ cmd.SetRayTracingFloatParam(rtsdtParams.screenSpaceShadowRT, HDShaderIDs._DirectionalMaxRayLength, rtsdtParams.maxShadowLength);
+
// Set ray count texture
cmd.SetRayTracingTextureParam(rtsdtParams.screenSpaceShadowRT, HDShaderIDs._RayCountTexture, rtsdtResources.rayCountTexture);
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 e0c8883b760..1763a0a51d2 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/HDStringConstants.cs
@@ -567,6 +567,7 @@ static class HDShaderIDs
public static readonly int _RaytracedColorShadowIntegration = Shader.PropertyToID("_RaytracedColorShadowIntegration");
public static readonly int _DirectionalLightAngle = Shader.PropertyToID("_DirectionalLightAngle");
+ public static readonly int _DirectionalMaxRayLength = Shader.PropertyToID("_DirectionalMaxRayLength");
public static readonly int _DirectionalLightDirection = Shader.PropertyToID("_DirectionalLightDirection");
public static readonly int _SphereLightPosition = Shader.PropertyToID("_SphereLightPosition");
public static readonly int _SphereLightRadius = Shader.PropertyToID("_SphereLightRadius");
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/RayTracingSettings.cs b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/RayTracingSettings.cs
index eb38922da4b..3426f42bfaa 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/RayTracingSettings.cs
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/RayTracingSettings.cs
@@ -28,6 +28,12 @@ public sealed class RayTracingSettings : VolumeComponent
[Tooltip("Enables the override of the camera culling. This increases the validity area of animated skinned mesh that are outside of the frustum.")]
public BoolParameter extendCameraCulling = new BoolParameter(false);
+ ///
+ /// Controls the maximal ray length for ray traced shadows.
+ ///
+ [Tooltip("Controls the maximal ray length for ray traced directional shadows.")]
+ public MinFloatParameter directionalShadowRayLength = new MinFloatParameter(1000.0f, 0.01f);
+
///
/// Default constructor for the ray tracing settings volume component.
///
diff --git a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.raytrace b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.raytrace
index 794d68efb98..bd265bf7a45 100644
--- a/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.raytrace
+++ b/com.unity.render-pipelines.high-definition/Runtime/RenderPipeline/Raytracing/Shaders/Shadows/RaytracingShadow.raytrace
@@ -361,7 +361,7 @@ void RayGenAreaShadowSingle()
RW_TEXTURE2D_X(float, _RaytracedShadowIntegration);
RW_TEXTURE2D_X(float, _RaytracingDistanceBufferRW);
RW_TEXTURE2D_X(float, _VelocityBuffer);
-float _DirectionalLightAngle;
+float _DirectionalMaxRayLength;
[shader("raygeneration")]
void RayGenDirectionalShadowSingle()
@@ -411,7 +411,7 @@ void RayGenDirectionalShadowSingle()
rayDescriptor.Origin = rayOrigin;
rayDescriptor.Direction = rayDirection;
rayDescriptor.TMin = 0.0;
- rayDescriptor.TMax = 1000.0;
+ rayDescriptor.TMax = _DirectionalMaxRayLength;
// Create and init the RayIntersection structure for this
RayIntersection rayIntersection;
@@ -478,7 +478,7 @@ void RayGenDirectionalColorShadowSingle()
rayDescriptor.Origin = rayOrigin;
rayDescriptor.Direction = rayDirection;
rayDescriptor.TMin = 0.0;
- rayDescriptor.TMax = 1000.0;
+ rayDescriptor.TMax = _DirectionalMaxRayLength;
// Create and init the RayIntersection structure for this
RayIntersection rayIntersection;
@@ -495,7 +495,7 @@ void RayGenDirectionalColorShadowSingle()
rayDescriptor.Origin = rayOrigin;
rayDescriptor.Direction = rayDirection;
rayDescriptor.TMin = 0.0;
- rayDescriptor.TMax = 1000.0;
+ rayDescriptor.TMax = _DirectionalMaxRayLength;
rayIntersection.color = float3(1.0, 1.0, 1.0);
rayIntersection.t = MISS_RAY_TRACING_SHADOW_DISTANCE;