Skip to content

Commit

Permalink
Disable auto exposure for now.
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Lejeune committed Mar 31, 2014
1 parent 251e7f6 commit 33f31db
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions data/shaders/color_levels.frag
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ void main()

#else


//#define AUTO_EXPOSURE

uniform sampler2D tex;
uniform sampler2D dtex;
uniform vec3 inlevel;
Expand All @@ -223,20 +226,22 @@ vec3 getCIEYxy(vec3 rgbColor);
vec3 getRGBFromCIEXxy(vec3 YxyColor);

float exposure = .1;
float whitePoint = 1.;
float whitePoint = 2.5;
float delta = 0.0001;

void main()
{
vec4 col = texture(tex, uv);
float avgLuminance = textureLod(logluminancetex, uv, 10.);
#ifdef AUTO_EXPOSURE
float avgLuminance = textureLod(logluminancetex, uv, 10.).x;
avgLuminance = exp(avgLuminance) - delta;

vec3 Yxy = getCIEYxy(col.xyz);
float a = max(0, 1.5 - 1.5 / (avgLuminance * .1 + 1)) + .1;
float Lp = Yxy.r * a / avgLuminance;
Yxy.r = Lp;//(Lp * (1. * Lp / (whitePoint * whitePoint))) / (1. + Lp);
Yxy.r = (Lp * (1. * Lp / (whitePoint * whitePoint))) / (1. + Lp);
col.xyz = getRGBFromCIEXxy(Yxy);
#endif

float curdepth = texture(dtex, uv).x;
vec4 FragPos = invprojm * (2.0 * vec4(uv, curdepth, 1.0f) - 1.0f);
Expand Down

0 comments on commit 33f31db

Please sign in to comment.