3
/// 1st Fragment Shader
5
// Projects points to screen space and rotates normal
6
// stores output on texture
7
#extension GL_ARB_draw_buffers : enable
10
uniform vec2 canvas_size;
12
varying vec3 normal_vec;
13
varying vec3 radius_depth_w;
14
varying float dist_to_eye;
20
if (radius_depth_w.x <= 0.0)
23
float proj_radius = radius_depth_w.x * scale / dist_to_eye;
24
float depth_interval = proj_radius;
26
vec2 screen_pos = (vec2(gl_FragCoord.xy) - vec2(0.5)) / canvas_size.xy;
28
//vec2 screen_pos = pos;
30
// First buffer : normal.x, normal.y, normal.z, radius
31
// Second buffer : minimum depth, depth interval, center.x, center.y
32
// Third buffer : color
33
// gl_FragData[0] = vec4 (normal_vec, radius_depth_w.x / radius_depth_w.z );
34
gl_FragData[0] = vec4 (normal_vec, proj_radius );
35
gl_FragData[1] = vec4 (radius_depth_w.y, 2.0*depth_interval, screen_pos);