Fix regression in missing shadows inside Global Surface Atals

This commit is contained in:
Wojtek Figat
2024-05-23 21:51:57 +02:00
parent 82ee84ad39
commit 182d6d8602
2 changed files with 3 additions and 4 deletions

View File

@@ -946,8 +946,8 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
// Draw light
PROFILE_GPU_CPU_NAMED("Directional Light");
const bool useShadow = light.CanRenderShadow(renderContext.View);
// TODO: test perf/quality when using Shadow Map for directional light (ShadowsPass::Instance()->LastDirLightShadowMap) instead of Global SDF trace
light.SetShaderData(data.Light, useShadow);
data.Light.ShadowsBufferAddress = useShadow; // Use this to indicate if trace shadow (SDF trace)
data.Light.Color *= light.IndirectLightingIntensity;
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
context->UpdateCB(_cb0, &data);
@@ -981,6 +981,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
PROFILE_GPU_CPU_NAMED("Point Light");
const bool useShadow = light.CanRenderShadow(renderContext.View);
light.SetShaderData(data.Light, useShadow);
data.Light.ShadowsBufferAddress = useShadow; // Use this to indicate if trace shadow (SDF trace)
data.Light.Color *= light.IndirectLightingIntensity;
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
context->UpdateCB(_cb0, &data);
@@ -1014,6 +1015,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
PROFILE_GPU_CPU_NAMED("Spot Light");
const bool useShadow = light.CanRenderShadow(renderContext.View);
light.SetShaderData(data.Light, useShadow);
data.Light.ShadowsBufferAddress = useShadow; // Use this to indicate if trace shadow (SDF trace)
data.Light.Color *= light.IndirectLightingIntensity;
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
context->UpdateCB(_cb0, &data);

View File

@@ -167,9 +167,6 @@ float4 PS_Lighting(AtlasVertexOutput input) : SV_Target
BRANCH
if (NoL > 0)
{
// TODO: try using shadow map for on-screen pixels
// TODO: try using cone trace with Global SDF for smoother shadow (eg. for sun shadows or for area lights)
// Shot a ray from texel into the light to see if there is any occluder
GlobalSDFTrace trace;
trace.Init(gBuffer.WorldPos + gBuffer.Normal * shadowBias, L, bias, toLightDst - bias);