Disable auto exposure for now.

This commit is contained in:
Vincent Lejeune 2014-03-31 17:23:22 +02:00
parent 251e7f669e
commit 33f31dbf30

View File

@ -204,6 +204,9 @@ void main()
#else
//#define AUTO_EXPOSURE
uniform sampler2D tex;
uniform sampler2D dtex;
uniform vec3 inlevel;
@ -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);