Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/environment/programs/hdr_downscale2x2luminence.glsl @ 8837

Last change on this file since 8837 was 7708, checked in by dafrick, 14 years ago

Merging cleanup branch. You will need to update your data repository as well as your local copy of the code.

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