Skip to content

Commit 5b40e3c

Browse files
Fix issue with screen-space shadows not enabled with RT off (#139)
* Fix issue with screen_space shadows not enabled with RT off * Proper fix: only keep directional screen space shadows with RT off * Fix shadow debug mode * cosmetic changes Co-authored-by: sebastienlagarde <sebastien@unity3d.com>
1 parent a0be82e commit 5b40e3c

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
569569
- Fixed shadowmask UI now correctly showing shadowmask disable
570570
- Made more explicit the warning about raytracing and asynchronous compute. Also fixed the condition in which it appears.
571571
- Fixed a null ref exception in static sky when the default volume profile is invalid.
572+
- Fixed issue with screen-space shadows not enabled properly when RT is disabled (case 1235821)
572573

573574
### Changed
574575
- Improve MIP selection for decals on Transparents

com.unity.render-pipelines.high-definition/Runtime/Lighting/Shadow/ScreenSpaceShadowManager.cs

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -246,27 +246,22 @@ void RenderScreenSpaceShadows(HDCamera hdCamera, CommandBuffer cmd)
246246
return;
247247
}
248248

249-
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing))
249+
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.ScreenSpaceShadows)))
250250
{
251-
using (new ProfilingScope(cmd, ProfilingSampler.Get(HDProfileId.ScreenSpaceShadows)))
252-
{
253-
// First of all we handle the directional light
254-
RenderDirectionalLightScreenSpaceShadow(cmd, hdCamera);
251+
// First of all we handle the directional light
252+
RenderDirectionalLightScreenSpaceShadow(cmd, hdCamera);
255253

254+
if (hdCamera.frameSettings.IsEnabled(FrameSettingsField.RayTracing))
255+
{
256256
// We handle the other light sources
257257
RenderLightScreenSpaceShadows(hdCamera, cmd);
258+
}
258259

259-
// We do render the debug view
260-
EvaluateShadowDebugView(cmd, hdCamera);
260+
// We do render the debug view
261+
EvaluateShadowDebugView(cmd, hdCamera);
261262

262-
// Big the right texture
263-
cmd.SetGlobalTexture(HDShaderIDs._ScreenSpaceShadowsTexture, m_ScreenSpaceShadowTextureArray);
264-
}
265-
}
266-
else
267-
{
268-
// We bind the black texture in this case
269-
BindBlackShadowTexture(cmd);
263+
// Bind the right texture
264+
cmd.SetGlobalTexture(HDShaderIDs._ScreenSpaceShadowsTexture, m_ScreenSpaceShadowTextureArray);
270265
}
271266
}
272267

@@ -911,12 +906,20 @@ void RenderPunctualScreenSpaceShadow(CommandBuffer cmd, HDCamera hdCamera
911906

912907
void EvaluateShadowDebugView(CommandBuffer cmd, HDCamera hdCamera)
913908
{
914-
ComputeShader shadowFilter = m_Asset.renderPipelineRayTracingResources.shadowFilterCS;
915-
916909
// If this is the right debug mode and the index we are asking for is in the range
917910
HDRenderPipeline hdrp = (RenderPipelineManager.currentPipeline as HDRenderPipeline);
918911
if (FullScreenDebugMode.ScreenSpaceShadows == hdrp.m_CurrentDebugDisplaySettings.data.fullScreenDebugMode)
919912
{
913+
if (!hdrp.rayTracingSupported)
914+
{
915+
// In this case we have not rendered any screenspace shadows, so push a black texture on the debug display
916+
hdrp.PushFullScreenDebugTexture(hdCamera, cmd, TextureXR.GetBlackTextureArray(), FullScreenDebugMode.ScreenSpaceShadows);
917+
return;
918+
}
919+
920+
// TODO: move the debug kernel outside of the ray tracing resources
921+
ComputeShader shadowFilter = m_Asset.renderPipelineRayTracingResources.shadowFilterCS;
922+
920923
// Texture dimensions
921924
int texWidth = hdCamera.actualWidth;
922925
int texHeight = hdCamera.actualHeight;

0 commit comments

Comments
 (0)