Skip to content

Commit 39b112a

Browse files
SSAO: properly compute sample radius for ortho projection
1 parent b0bacc2 commit 39b112a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Shaders/PostProcess/ScreenSpaceAmbientOcclusion/private/SSAO_ComputeAmbientOcclusion.fx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,12 @@ float ComputeAmbientOcclusionPS(in FullScreenTriangleVSOutput VSOut) : SV_Target
100100

101101
float FalloffMul = -1.0 / FalloffRange;
102102
float FalloffAdd = FalloffFrom / FalloffRange + 1.0;
103-
float SampleRadius = 0.5 * EffectRadius * MATRIX_ELEMENT(g_Camera.mProj, 0, 0) / PositionVS.z;
103+
float SampleRadius = 0.5 * EffectRadius * MATRIX_ELEMENT(g_Camera.mProj, 0, 0);
104+
if (g_Camera.mProj[3][3] == 0.0)
105+
{
106+
// Perspective
107+
SampleRadius /= PositionVS.z;
108+
}
104109

105110
float Visibility = 0.0;
106111
for (int SliceIdx = 0; SliceIdx < SSAO_SLICE_COUNT; SliceIdx++)

0 commit comments

Comments
 (0)