SSAO: Use the correct distance for range checking

It should remove halo around kart heads.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@14763 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
vincentlj
2013-12-23 23:25:14 +00:00
parent d6a532151d
commit f17f8b62cb

View File

@@ -49,10 +49,8 @@ void main(void)
vec4 occluderPos = invprojm * vec4(sampleProj.xy, 2.0 * occluderFragmentDepth - 1.0, 1.0f);
occluderPos /= occluderPos.w;
float depthDifference = sampleProj.z - (2. * occluderFragmentDepth - 1.0);
// depthDifference between 0 and radius
float increment = step(0., depthDifference) * step(-radius, -depthDifference);
bl += increment * smoothstep(radius, 0, distance(samplePos, FragPos)) * cosTheta;
bool isOccluded = (sampleProj.z > (2. * occluderFragmentDepth - 1.0)) && (distance(FragPos, occluderPos) < radius);
bl += isOccluded ? smoothstep(radius, 0, distance(samplePos, FragPos)) * cosTheta : 0.;
}
// output the result