Fixed the piecewise function in linearToGamma to use <= instead of < when determining whether to use the linear part of the function.

This commit is contained in:
Alex Szpakowski
2016-01-13 21:23:56 -04:00
parent a95235ffa1
commit 314a82b126
2 changed files with 2 additions and 2 deletions
@@ -82,7 +82,7 @@ float linearToGammaPrecise(float c) {
return c < 0.0031308 ? c * 12.92 : 1.055 * pow(c, 1.0 / 2.4) - 0.055;
}
vec3 linearToGammaPrecise(vec3 c) {
bvec3 lt = lessThan(c, vec3(0.0031308));
bvec3 lt = lessThanEqual(c, vec3(0.0031308));
c.r = lt.r ? c.r * 12.92 : 1.055 * pow(c.r, 1.0 / 2.4) - 0.055;
c.g = lt.g ? c.g * 12.92 : 1.055 * pow(c.g, 1.0 / 2.4) - 0.055;
c.b = lt.b ? c.b * 12.92 : 1.055 * pow(c.b, 1.0 / 2.4) - 0.055;
+1 -1
View File
@@ -213,7 +213,7 @@ float Math::gammaToLinear(float c) const
**/
float Math::linearToGamma(float c) const
{
if (c < 0.0031308f)
if (c <= 0.0031308f)
return c * 12.92f;
else
return 1.055f * powf(c, 1.0f / 2.4f) - 0.055f;