PICCANTE  0.4
The hottest HDR imaging library!
tone.hpp
Go to the documentation of this file.
1 /*
2 
3 PICCANTE
4 The hottest HDR imaging library!
5 http://vcg.isti.cnr.it/piccante
6 
7 Copyright (C) 2014
8 Visual Computing Laboratory - ISTI CNR
9 http://vcg.isti.cnr.it
10 First author: Francesco Banterle
11 
12 This Source Code Form is subject to the terms of the Mozilla Public
13 License, v. 2.0. If a copy of the MPL was not distributed with this
14 file, You can obtain one at http://mozilla.org/MPL/2.0/.
15 
16 */
17 
18 #ifndef PIC_UTIL_GL_TONE_HPP
19 #define PIC_UTIL_GL_TONE_HPP
20 
21 #include <string>
22 
23 #include "../../base.hpp"
24 
25 namespace pic {
26 
33 {
34  std::string ret;
35 
36  ret = MAKE_STRING(
37  vec3 SimpleTMO(vec3 col, float exposure, float gamma) {
38  pow(color.xyz * exposure, vec3(gamma))
39  }
40  );
41 
42  return ret;
43 }
44 
50 {
51  std::string ret;
52 
53  ret = MAKE_STRING(
54  const vec3 LUM_XYZ = vec3(0.213, 0.715, 0.072);
55  //maxL: maximum luminance
56  //c1: log(Drago_b)/log(0.5)
57  //c2: (Drago_Ld_Max/100)/(log10(1+LMax))
58  vec3 DragoTMO(vec3 col, float maxL, float c1, float c2) {
59  float Lw = dot(LUM_XYZ, col);
60  float Ld = c2 * log(1 + L) / log(2.0 + 8.0 * pow((L / maxL), c2));
61  return (col.xyz * Ld) / Lw;
62  }
63  );
64 
65  return ret;
66 }
67 
68 } // end namespace pic
69 
70 #endif /* PIC_UTIL_GL_TONE_HPP */
71 
#define MAKE_STRING(input_string)
PIC_INLINE std::string GLSL_DRAGO_TMO()
GLSL_DRAGO_TMO returns Drago et al.&#39;s tone mapping operator.
Definition: tone.hpp:49
#define PIC_INLINE
Definition: base.hpp:33
PIC_INLINE std::string GLSL_SIMPLE_EXPOSURE_GAMMA()
GLSL_SIMPLE_EXPOSURE_GAMMA applies a simple gamma correctiona and exposure in a shader.
Definition: tone.hpp:32
The DragoTMO class.
Definition: drago_tmo.hpp:33
Definition: bilateral_separation.hpp:25