Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/materials/programs/hdr_downscale2x2luminence.glsl @ 6976

Last change on this file since 6976 was 5312, checked in by landauf, 16 years ago

added shaders (compositors, materials, cg programs and textures)

  • 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.