-import postprocess;
+import flat_effect;
import _ambientocclusion;
#pragma MSP stage(fragment)
+layout(location=0) out float frag_out;
void main()
{
vec4 rv = texture(rotate, gl_FragCoord.xy/4.0)*2.0-1.0;
for(int i=0; i<n_samples; ++i)
{
vec3 psp = project(center+transform*sample_points[i]);
- float sample = texture(depth, psp.xy*0.5+0.5).r;
- if(sample>=min_depth)
+ float sample_depth = texture(depth, psp.xy*0.5+0.5).r;
+ if(sample_depth>=min_depth)
{
- if(sample<psp.z)
+ if(sample_depth<psp.z)
occlusion_sum += 1.0;
count += 1.0;
}
}
- frag_color = vec4(1.0-occlusion_sum/count, 0.0, 0.0, 1.0);
+ frag_out = 1.0-occlusion_sum/count;
}