Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL150/hdr_downscale2x2luminence.glsl @ 12181

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

Changed folder structure, deletet some unused files and cleaned up code

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