HDR
HDR
glsl"
#define MODE_COPY 0
#define MODE_GRAY 1
#define MODE_BLUR 2
#define MODE_HEAT 3
#define MODE_FXAA 4
#define FXAA_GREEN_AS_LUMA 1
#include "srgb.glsl"
#line 31
#if TONE_MAP
#include "tone_map.glsl"
#endif
#if VSHADER
#if TONE_MAP
calc_light_meter();
#endif
}
#endif
#if FSHADER
#define K 1.0
#if TONE_MAP
#if TO_SRGB
tone_map_linear_to_srgb(rgb);
#else
tone_map(rgb);
#endif
#elif TO_SRGB
rgb = to_srgb(rgb);
#endif
return vec4(rgb,in_color.a);
}
gl_FragColor =
u_kernel2.w * texture2D(u_tex1, v_texcoord0.st - 7.0 *
u_offset * K)
+ u_kernel2.z * texture2D(u_tex1, v_texcoord0.st - 6.0 *
u_offset * K)
+ u_kernel2.y * texture2D(u_tex1, v_texcoord0.st - 5.0 *
u_offset * K)
+ u_kernel2.x * texture2D(u_tex1, v_texcoord0.st - 4.0 *
u_offset * K)
+ u_kernel1.w * texture2D(u_tex1, v_texcoord0.st - 3.0 *
u_offset * K)
+ u_kernel1.z * texture2D(u_tex1, v_texcoord0.st - 2.0 *
u_offset * K)
+ u_kernel1.y * texture2D(u_tex1, v_texcoord0.st - u_offset *
K)
+ u_kernel1.x * texture2D(u_tex1, v_texcoord0.st )
+ u_kernel1.y * texture2D(u_tex1, v_texcoord0.st + u_offset *
K)
+ u_kernel1.z * texture2D(u_tex1, v_texcoord0.st + 2.0 *
u_offset * K)
+ u_kernel1.w * texture2D(u_tex1, v_texcoord0.st + 3.0 *
u_offset * K)
+ u_kernel2.x * texture2D(u_tex1, v_texcoord0.st + 4.0 *
u_offset * K)
+ u_kernel2.y * texture2D(u_tex1, v_texcoord0.st + 5.0 *
u_offset * K)
+ u_kernel2.z * texture2D(u_tex1, v_texcoord0.st + 6.0 *
u_offset * K)
+ u_kernel2.w * texture2D(u_tex1, v_texcoord0.st + 7.0 *
u_offset * K);
#endif
#if MODE==MODE_COPY
gl_FragColor = v_color * final_color_correct(texture2D(u_tex1,
v_texcoord0.st));
#endif
#if MODE==MODE_GRAY
// Grayscale shader. v_color's rgb is the weight ratios to convert to
gray - usually
// mostly green since that's how our eyes work.
#if MODE==MODE_HEAT
// gl_FragColor = texture2D(u_tex1, v_screen_pos.st);
vec2 screen_rat = vec2(
(v_screen_pos.x /
v_screen_pos.w) * 0.5 + 0.5,
(v_screen_pos.y /
v_screen_pos.w) * 0.5 + 0.5);
float t1 = fract(u_time);
t1 = (t1 > 0.5) ? (1.0 - t1) : t1;
t1 *= 2.0;
float t2 = 1.0 - t1;
gl_FragColor = vec4(blur,v_color.a);
gl_FragColor = final_color_correct(gl_FragColor);
// gl_FragColor = vec4(blur,0.25+noise);
// gl_FragColor = vec4(0.5 + noise);
#endif
#if MODE==MODE_FXAA
gl_FragColor = vec4(0.0);
// gl_FragColor.rgb = texture2D(u_tex1,v_texcoord0.xy).xyz;
gl_FragColor = final_color_correct(gl_FragColor);
gl_FragColor.a = 1.0;
#endif
}
#endif