Skip to content

Commit

Permalink
merian-shader: tonemap: cleanup eps
Browse files Browse the repository at this point in the history
  • Loading branch information
LDAP committed Nov 27, 2024
1 parent 06221e2 commit 3113d60
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions include/merian-shaders/tonemap.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,9 @@ vec3 tonemap_lottes(const vec3 rgb, const float contrast, const float shoulder,
const float c = (pow(hdrMax, contrast*shoulder)*pow(midIn, contrast) - pow(hdrMax, contrast)*pow(midIn, contrast*shoulder)*midOut) /
(pow(hdrMax, contrast*shoulder)*midOut - pow(midIn, contrast*shoulder)*midOut);

#define EPS 1e-7f
float peak = max(rgb.r, max(rgb.g, rgb.b));

peak = max(EPS, peak);
peak = max(1e-7f, peak);

vec3 ratio = rgb / peak;
const float z = pow(peak, contrast);
Expand All @@ -96,8 +95,6 @@ vec3 tonemap_lottes(const vec3 rgb, const float contrast, const float shoulder,
ratio = mix(ratio, vec3(white), pow(peak, crosstalk));
ratio = pow(abs(ratio), vec3(crossSaturation));

#undef EPS

return peak * ratio;
}

Expand Down

0 comments on commit 3113d60

Please sign in to comment.