diff options
author | LaG1924 <lag1924@gmail.com> | 2021-12-07 21:55:37 +0100 |
---|---|---|
committer | LaG1924 <lag1924@gmail.com> | 2021-12-07 22:27:55 +0100 |
commit | 039f05be5a548a9b5051b988869f984d7e335a47 (patch) | |
tree | a5d0f41fafcace53d9238dda0f56b5316089f0be /cwd/assets/altcraft/shaders/frag/ssao.fs | |
parent | Fixed SSAO normals (diff) | |
download | AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.gz AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.bz2 AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.lz AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.xz AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.tar.zst AltCraft-039f05be5a548a9b5051b988869f984d7e335a47.zip |
Diffstat (limited to '')
-rw-r--r-- | cwd/assets/altcraft/shaders/frag/ssao.fs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cwd/assets/altcraft/shaders/frag/ssao.fs b/cwd/assets/altcraft/shaders/frag/ssao.fs index 0615e8f..4ed93fd 100644 --- a/cwd/assets/altcraft/shaders/frag/ssao.fs +++ b/cwd/assets/altcraft/shaders/frag/ssao.fs @@ -8,6 +8,8 @@ uniform sampler2D normal; uniform sampler2D worldPos; uniform sampler2D ssaoNoise; +uniform int ssaoSamples; + layout (std140) uniform Globals { mat4 projView; mat4 proj; @@ -36,7 +38,8 @@ void main() { mat3 TBN = mat3(tangent, bitangent, normal); float occlusion = 0.0; - for(int i = 0; i < kernelSize; i++) + int samples = min(kernelSize, ssaoSamples); + for(int i = 0; i < samples; i++) { vec3 samplePos = TBN * ssaoKernels[i].xyz; samplePos = fragPos + samplePos * radius; |