summaryrefslogtreecommitdiffstats
path: root/cwd/assets/altcraft/shaders/frag/ssao.fs
diff options
context:
space:
mode:
Diffstat (limited to 'cwd/assets/altcraft/shaders/frag/ssao.fs')
-rw-r--r--cwd/assets/altcraft/shaders/frag/ssao.fs5
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;