Skip to content

Commit

Permalink
Adjusted SSAO
Browse files Browse the repository at this point in the history
  • Loading branch information
tippesi committed Apr 28, 2022
1 parent 2b45ed4 commit a00bad4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion data/shader/ao/ssao.csh
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ void main() {
// get sample depth
vec3 samplePos = ConvertDepthToViewSpace(textureLod(shadowMap, offset.xy, 0).r, offset.xy);

float rangeCheck = abs(fragPos.z - samplePos.z) < radius ? 1.0 : 0.0;
float delta = samplePos.z - ssaoSample.z;
occlusion += (delta > 0.0 ? 1.0 : 0.0) * saturate(radius - sqr(distance(fragPos, samplePos)));
occlusion += (delta > 0.0 ? 1.0 : 0.0) * rangeCheck;

}

float result = pow(1.0 - (occlusion / float(sampleCount)), strength);
Expand Down

0 comments on commit a00bad4

Please sign in to comment.