Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/Example/GLSL150/hdr_tonemap_util.glsl @ 12083

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

Reorganised shader programs

File size: 693 bytes
Line 
1#version 150
2
3const float MIDDLE_GREY = 0.72;
4const float FUDGE = 0.001;
5const float L_WHITE = 1.5;
6
7/** Tone mapping function
8@note Only affects rgb, not a
9@param inColour The HDR colour
10@param lum The scene lumninence
11@returns Tone mapped colour
12*/
13vec4 toneMap(in vec4 inColour, in float lum)
14{
15        // From Reinhard et al
16        // "Photographic Tone Reproduction for Digital Images"
17       
18        // Initial luminence scaling (equation 2)
19    inColour.rgb *= MIDDLE_GREY / (FUDGE + lum);
20
21        // Control white out (equation 4 nom)
22    inColour.rgb *= (1.0 + inColour.rgb / L_WHITE);
23
24        // Final mapping (equation 4 denom)
25        inColour.rgb /= (1.0 + inColour.rgb);
26       
27        return inColour;
28}
Note: See TracBrowser for help on using the repository browser.