-import postprocess;
+import flat_effect;
import _ambientocclusion;
#pragma MSP stage(fragment)
+layout(location=0) out vec4 frag_color;
void main()
{
vec3 center = unproject(vec3(vertex.xy, texture(depth, texcoord).r));
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;