Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/dataRelease2012/programs/hdr_tonemap_util.glsl @ 10257

Last change on this file since 10257 was 7708, checked in by dafrick, 14 years ago

Merging cleanup branch. You will need to update your data repository as well as your local copy of the code.

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