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
9
uniform vec2 oo_fbo_size;
11
//uniform vec2 canvas_border;
12
//uniform float min_size;
14
uniform float reconstruction_filter_size;
15
uniform float canvas_width;
16
uniform int mask_size;
18
varying vec3 normal_vec;
19
varying vec3 radius_depth_w;
20
varying float dist_to_eye;
24
if (radius_depth_w.x <= 0.0)
27
vec2 texCoord = vec2( floor(gl_FragCoord.st)*oo_fbo_size );
29
float radius = radius_depth_w.x * scale / dist_to_eye;
30
float unprojected_radius = radius;
32
int log_level = int(floor(log2( ( 2.0 * radius * reconstruction_filter_size * canvas_width ) / float(mask_size*2 + 1) )));
34
// if (radius > min_size)
36
unprojected_radius *= -1.0;
38
/* if ((2.0*radius*(1.0/canvas_width)*reconstruction_filter_size) > float(mask_size*2 + 1)) */
39
/* unprojected_radius *= -1.0; */
41
gl_FragData[0] = vec4 ( normalize(normal_vec), radius_depth_w.y );
42
// gl_FragData[0] = vec4 ( normalize(normal_vec), gl_FragCoord.z);
44
gl_FragData[1] = vec4 ( 4.0*unprojected_radius, radius, texCoord.st );
45
gl_FragData[2] = gl_Color;
47
// avoids sample with low quality overwritting sample with high quality in same pixel
49
//gl_FragDepth = gl_FragCoord.z - gl_Color.a*0.05;