Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/trunk/materials/programs/hdr_downscale3x3.glsl @ 7375

Last change on this file since 7375 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: 846 bytes
Line 
1uniform sampler2D inRTT;
2uniform vec2 texelSize;
3
4varying vec2 uv;
5
6void main(void)
7{
8    vec4 accum = vec4(0.0, 0.0, 0.0, 0.0);
9
10    // Get colour from source
11    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0, -1.0));
12    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0, -1.0));
13    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0, -1.0));
14    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  0.0));
15    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  0.0));
16    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  0.0));
17    accum += texture2D(inRTT, uv + texelSize * vec2(-1.0,  1.0));
18    accum += texture2D(inRTT, uv + texelSize * vec2( 0.0,  1.0));
19    accum += texture2D(inRTT, uv + texelSize * vec2( 1.0,  1.0));
20   
21        // take average of 9 samples
22        accum *= 0.1111111111111111;
23
24        gl_FragColor = accum;
25
26}
Note: See TracBrowser for help on using the repository browser.