Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSLES/hdr_downscale2x2luminence.glsles @ 12091

Last change on this file since 12091 was 12091, checked in by wiesep, 6 years ago

Updated programs and adjusted Material to work with GLSL>150

File size: 717 bytes
Line 
1#version 100
2precision mediump int;
3precision mediump float;
4
5uniform sampler2D inRTT;
6uniform vec2 texelSize;
7
8varying vec2 uv;
9
10void main()
11{
12    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
13        vec4 LUMINENCE_FACTOR  = vec4(0.27, 0.67, 0.06, 0.0);
14
15    // Get colour from source
16    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, -0.5));
17    accum += texture2D(inRTT, uv + texelSize * vec2(-0.5, 0.5));
18    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, 0.5));
19    accum += texture2D(inRTT, uv + texelSize * vec2(0.5, -0.5));
20   
21        // Adjust the accumulated amount by lum factor
22        float lum = dot(accum, LUMINENCE_FACTOR);
23        // take average of 4 samples
24        lum *= 0.25;
25        gl_FragColor = vec4(lum, lum, lum, 1.0);
26}
Note: See TracBrowser for help on using the repository browser.