Fix sqrt(int) in diffuseenvmap

This commit is contained in:
Vincent Lejeune 2014-11-08 01:02:46 +01:00
parent 5eefe0c0ad
commit 04d313671c

View File

@ -52,7 +52,7 @@ void main(void)
float specval = pow(texture(ntex, uv).z, 2.); float specval = pow(texture(ntex, uv).z, 2.);
// From http://graphics.cs.williams.edu/papers/EnvMipReport2013/ // From http://graphics.cs.williams.edu/papers/EnvMipReport2013/
int texSize = textureSize(tex, 0).x; int texSize = textureSize(tex, 0).x;
float lodval = clamp(log2(texSize * sqrt(3)) - .5 * log2(specval + 1), 0., 10.); float lodval = clamp(log2(texSize * sqrt(3.)) - .5 * log2(specval + 1.), 0., 10.);
vec4 specular = textureLod(tex, sampleDirection, lodval); vec4 specular = textureLod(tex, sampleDirection, lodval);
Spec = max(specular, vec4(0.)); Spec = max(specular, vec4(0.));
} }