1 const int max_samples = 128;
3 uniform CameraTransform
11 uniform sampler2D source;
12 uniform sampler2D depth;
13 uniform sampler2D occlusion;
14 uniform sampler2D rotate;
15 uniform AmbientOcclusionParams
18 vec3 sample_points[max_samples];
20 float occlusion_radius;
21 float edge_depth_threshold;
24 #pragma MSP stage(fragment)
25 vec3 project(vec3 position)
28 return vec3(0.0, 0.0, -1.0);
29 vec4 pp = clip_eye_matrix*vec4(position, 1.0);
33 vec3 unproject(vec3 position)
35 vec4 upp = eye_clip_matrix*vec4(position, 1.0);
39 vec3 get_fragment_position(vec2 tc)
41 return unproject(vec3(tc*2.0-1.0, texture(depth, tc).r));
44 vec3 get_slope(vec3 a, vec3 x, vec3 b)
46 float dz1 = abs(x.z-a.z);
47 float dz2 = abs(b.z-x.z);
48 return (dz1>2.0*dz2 ? b-x : dz2>2.0*dz1 ? x-a : b-a);