Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: data/branches/Shader_HS18/programs/GLSL120/hdr_tonemap_util.glsl @ 12319

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

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

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