Merge pull request #1724 from aws-lumberyard-dev/Atom/mriegger/esm16F

Switch directional light to use the same reformulation as projected s…
main
mrieggeramzn 5 years ago committed by GitHub
commit 1d95a4a2ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -54,7 +54,7 @@
"Attachment": "Depth"
},
"ImageDescriptor": {
"Format": "R32_FLOAT"
"Format": "R16_FLOAT"
}
}
],

@ -54,7 +54,7 @@
"Attachment": "Input"
},
"ImageDescriptor": {
"Format": "R32_FLOAT"
"Format": "R16_FLOAT"
}
}
],

@ -356,8 +356,9 @@ float DirectionalLightShadow::GetVisibilityFromLightEsm()
{
const float distanceWithinCameraView = depthDiff / (1. - distanceMin);
const float3 coord = float3(shadowCoord.xy, indexOfCascade);
const float expDepthInShadowmap = expShadowmap.Sample(PassSrg::LinearSampler, coord).r;
const float ratio = exp(-EsmExponentialShift * distanceWithinCameraView) * expDepthInShadowmap;
const float occluder = expShadowmap.Sample(PassSrg::LinearSampler, coord).r;
const float exponent = -EsmExponentialShift * (distanceWithinCameraView - occluder);
const float ratio = exp(exponent);
m_debugInfo.m_cascadeIndex = indexOfCascade;
return saturate(ratio);
@ -385,8 +386,9 @@ float DirectionalLightShadow::GetVisibilityFromLightEsmPcf()
{
const float distanceWithinCameraView = depthDiff / (1. - distanceMin);
const float3 coord = float3(shadowCoord.xy, indexOfCascade);
const float expDepthInShadowmap = expShadowmap.Sample(PassSrg::LinearSampler, coord).r;
float ratio = exp(-EsmExponentialShift * distanceWithinCameraView) * expDepthInShadowmap;
const float occluder = expShadowmap.Sample(PassSrg::LinearSampler, coord).r;
const float exponent = -EsmExponentialShift * (distanceWithinCameraView - occluder);
float ratio = exp(exponent);
static const float pcfFallbackThreshold = 1.04;
if (ratio > pcfFallbackThreshold)

@ -63,12 +63,7 @@ void MainCS(uint3 dispatchId: SV_DispatchThreadID)
// So this converts it to "depth" to emphasize the difference
// within the frustum.
const float depth = (depthInClip - distanceMin) / (1. - distanceMin);
// Todo: Expose Esm exponent slider for directional lights
// This would remove the exp calculation below, collapsing it into a subtraction in DirectionalLightShadow.azsli
// ATOM-15775
const float outValue = exp(EsmExponentialShift * depth);
PassSrg::m_outputShadowmap[dispatchId].r = outValue;
PassSrg::m_outputShadowmap[dispatchId].r = depth;
break;
}
case ShadowmapLightType::Spot:

Loading…
Cancel
Save