Fix regression in missing shadows inside Global Surface Atals
This commit is contained in:
@@ -946,8 +946,8 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
|||||||
// Draw light
|
// Draw light
|
||||||
PROFILE_GPU_CPU_NAMED("Directional Light");
|
PROFILE_GPU_CPU_NAMED("Directional Light");
|
||||||
const bool useShadow = light.CanRenderShadow(renderContext.View);
|
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);
|
light.SetShaderData(data.Light, useShadow);
|
||||||
|
data.Light.ShadowsBufferAddress = useShadow; // Use this to indicate if trace shadow (SDF trace)
|
||||||
data.Light.Color *= light.IndirectLightingIntensity;
|
data.Light.Color *= light.IndirectLightingIntensity;
|
||||||
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
|
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
|
||||||
context->UpdateCB(_cb0, &data);
|
context->UpdateCB(_cb0, &data);
|
||||||
@@ -981,6 +981,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
|||||||
PROFILE_GPU_CPU_NAMED("Point Light");
|
PROFILE_GPU_CPU_NAMED("Point Light");
|
||||||
const bool useShadow = light.CanRenderShadow(renderContext.View);
|
const bool useShadow = light.CanRenderShadow(renderContext.View);
|
||||||
light.SetShaderData(data.Light, useShadow);
|
light.SetShaderData(data.Light, useShadow);
|
||||||
|
data.Light.ShadowsBufferAddress = useShadow; // Use this to indicate if trace shadow (SDF trace)
|
||||||
data.Light.Color *= light.IndirectLightingIntensity;
|
data.Light.Color *= light.IndirectLightingIntensity;
|
||||||
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
|
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
|
||||||
context->UpdateCB(_cb0, &data);
|
context->UpdateCB(_cb0, &data);
|
||||||
@@ -1014,6 +1015,7 @@ bool GlobalSurfaceAtlasPass::Render(RenderContext& renderContext, GPUContext* co
|
|||||||
PROFILE_GPU_CPU_NAMED("Spot Light");
|
PROFILE_GPU_CPU_NAMED("Spot Light");
|
||||||
const bool useShadow = light.CanRenderShadow(renderContext.View);
|
const bool useShadow = light.CanRenderShadow(renderContext.View);
|
||||||
light.SetShaderData(data.Light, useShadow);
|
light.SetShaderData(data.Light, useShadow);
|
||||||
|
data.Light.ShadowsBufferAddress = useShadow; // Use this to indicate if trace shadow (SDF trace)
|
||||||
data.Light.Color *= light.IndirectLightingIntensity;
|
data.Light.Color *= light.IndirectLightingIntensity;
|
||||||
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
|
data.LightShadowsStrength = 1.0f - light.ShadowsStrength;
|
||||||
context->UpdateCB(_cb0, &data);
|
context->UpdateCB(_cb0, &data);
|
||||||
|
|||||||
@@ -167,9 +167,6 @@ float4 PS_Lighting(AtlasVertexOutput input) : SV_Target
|
|||||||
BRANCH
|
BRANCH
|
||||||
if (NoL > 0)
|
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
|
// Shot a ray from texel into the light to see if there is any occluder
|
||||||
GlobalSDFTrace trace;
|
GlobalSDFTrace trace;
|
||||||
trace.Init(gBuffer.WorldPos + gBuffer.Normal * shadowBias, L, bias, toLightDst - bias);
|
trace.Init(gBuffer.WorldPos + gBuffer.Normal * shadowBias, L, bias, toLightDst - bias);
|
||||||
|
|||||||
Reference in New Issue
Block a user