Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/data_extern/programs/GLSL150/hdr_downscale3x3brightpass.glsl @ 12206

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

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

File size: 1.2 KB
Line 
1#version 150
2
3uniform sampler2D inRTT;
4uniform sampler2D inLum;
5uniform vec2 texelSize;
6
7in vec2 oUv0;
8out vec4 fragColour;
9const vec4 BRIGHT_LIMITER = vec4(0.6, 0.6, 0.6, 0.0);
10
11// declare external function
12vec4 toneMap(in vec4 inColour, in float lum);
13
14void main(void)
15{
16    vec4 accum = vec4(0.0);
17
18    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0, -1.0));
19    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0, -1.0));
20    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0, -1.0));
21    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  0.0));
22    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  0.0));
23    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  0.0));
24    accum += texture(inRTT, oUv0 + texelSize * vec2(-1.0,  1.0));
25    accum += texture(inRTT, oUv0 + texelSize * vec2( 0.0,  1.0));
26    accum += texture(inRTT, oUv0 + texelSize * vec2( 1.0,  1.0));
27   
28        // take average of 9 samples
29        accum *= 0.1111111111111111;
30
31    // Reduce bright and clamp
32    accum = max(vec4(0.0, 0.0, 0.0, 1.0), accum - BRIGHT_LIMITER);
33
34        // Sample the luminence texture
35        vec4 lum = texture(inLum, vec2(0.5));
36       
37        // Tone map result
38        fragColour = toneMap(accum, lum.r);
39}
Note: See TracBrowser for help on using the repository browser.