File tree Expand file tree Collapse file tree 1 file changed +4
-0
lines changed
src/render/opengl/shaders Expand file tree Collapse file tree 1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -185,6 +185,8 @@ const ShaderReplacementRule INVERSE_TONEMAP (
185185 )" },
186186 {" GENERATE_LIT_COLOR" , R"(
187187 // NOTE: code is lazily duplicated between this rule and below
188+ float INVERSE_TONEMAP_EPS = 0.001; // inversion does bad things on 0 or 1, so clamp slightly away
189+ litColor = clamp(litColor, INVERSE_TONEMAP_EPS, 1.0 - INVERSE_TONEMAP_EPS);
188190 vec3 litColorUngamma = pow(litColor, vec3(u_gamma));
189191 float litColorLum = luminance(litColorUngamma);
190192 float invtonemap_a = -1.f / (u_whiteLevel*u_whiteLevel);
@@ -196,6 +198,8 @@ const ShaderReplacementRule INVERSE_TONEMAP (
196198 )" },
197199 {" TEXTURE_OUT_ADJUST" , R"(
198200 // NOTE: code is lazily duplicated between this rule and above
201+ float INVERSE_TONEMAP_EPS = 0.001; // inversion does bad things on 0 or 1, so clamp slightly away
202+ textureOut = clamp(textureOut, INVERSE_TONEMAP_EPS, 1.0 - INVERSE_TONEMAP_EPS);
199203 vec3 adj_textureOut3 = vec3(textureOut);
200204 vec3 litColorUngamma = pow(adj_textureOut3, vec3(u_gamma));
201205 float litColorLum = luminance(litColorUngamma);
You can’t perform that action at this time.
0 commit comments