Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/skybox/Media/materials/programs/hdr_tonemap_util.glsl @ 3050

Last change on this file since 3050 was 390, checked in by landauf, 17 years ago

added materials

File size: 654 bytes
RevLine 
[390]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.