diff options
author | LaG1924 <lag1924@gmail.com> | 2021-12-18 06:59:06 +0100 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2021-12-18 06:59:06 +0100 |
commit | 3dc7e8aba4a07cc3c0d897b82af5a5951bde9991 (patch) | |
tree | 7361aa7f00026b2cd6749e73bbe2bfc4b10ebd69 /cwd/assets/altcraft/shaders/frag/ssao.fs | |
parent | Fixed SSAO low occlusion factor (diff) | |
download | AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.tar AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.tar.gz AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.tar.bz2 AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.tar.lz AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.tar.xz AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.tar.zst AltCraft-3dc7e8aba4a07cc3c0d897b82af5a5951bde9991.zip |
Diffstat (limited to '')
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/ssao.fs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/ssao.fs b/cwd/assets/altcraft/shaders/frag/ssao.fs index 0e49c0b..1c9db1f 100644 --- a/cwd/assets/altcraft/shaders/frag/ssao.fs +++ b/cwd/assets/altcraft/shaders/frag/ssao.fs @@ -5,6 +5,7 @@ out vec4 fragColor; in vec2 uv; uniform sampler2D normal; +uniform sampler2D light; uniform sampler2D depthStencil; uniform sampler2D ssaoNoise; @@ -57,7 +58,8 @@ void main() { float sampleDepth = RecoverViewWorldPos(offset.xy, texture(depthStencil, offset.xy).r).z; float rangeCheck = smoothstep(0.0, 1.0, radius / abs(fragPos.z - sampleDepth)); - occlusion += (sampleDepth >= samplePos.z + bias ? 1.0 : 0.0) * rangeCheck; + float aoMask = texture(light, offset.xy).b; + occlusion += (sampleDepth >= samplePos.z + bias ? 1.0 : 0.0) * rangeCheck * aoMask; } occlusion = 1.0f - (occlusion / samples); |