]> git.tdb.fi Git - libs/gl.git/blobdiff - builtin_data/_ambientocclusion_combine.glsl
Check the flat qualifier from the correct member
[libs/gl.git] / builtin_data / _ambientocclusion_combine.glsl
index 88929066b73f7cca9a77cc062223935522ce511a..353ea8c385d1d0166cc03d096fa4bf174588bc3a 100644 (file)
@@ -15,16 +15,16 @@ void main()
                        vec2 offset = vec2(float(i), float(j))-1.5;
                        vec2 sample_coord = texcoord+offset*tex_scale;
                        float occ = texture(occlusion, sample_coord).r;
-                       float sample = texture(depth, sample_coord).r;
+                       float sample_depth = texture(depth, sample_coord).r;
                        float z_range = occlusion_radius*length(offset)*edge_depth_threshold;
                        float min_depth = project(vec3(center.xy, center.z+z_range)).z;
                        float max_depth = project(vec3(center.xy, center.z-z_range)).z;
-                       if(sample>=min_depth && sample<=max_depth)
+                       if(sample_depth>=min_depth && sample_depth<=max_depth)
                        {
                                sum += occ;
                                count += 1.0;
                        }
                }
        vec4 src_color = texture(source, texcoord);
-       frag_color = vec4(src_color.rgb*mix(1.0, min(sum*2.0/count, 1.0), darkness), src_color.a);
+       frag_color = vec4(src_color.rgb*mix(1.0, min(sum/count, 1.0), darkness), src_color.a);
 }