0

I'm looking at presentation by Timothy Lottes where he derives a generic tonemapper (slides 37 and following).

Although the purpose of the different parameters is explained nicely I find it quite hard to adjust them properly. I wrote a simple script to compare different tonemappers and have trouble to find reasonable settings for the generic tonemapper.

Generally I cannot get the shoulder of the curve to behave comparable to the other operators. Maybe it is a mistake in my implementation (original source code is in the slides).

def generic(x):
    a = 1.2 # contrast
    d = 1.1 # shoulder

    mid_in = 1
    mid_out = 0.18

    hdr_max = 16

    # It seems to work better when omitting the minus
    b = (-math.pow(mid_in, a) + math.pow(hdr_max, a) * mid_out) / (math.pow(math.pow(hdr_max, a), d) - math.pow(math.pow(mid_in, a), d) * mid_out)

    c = (math.pow(math.pow(hdr_max, a), d) * math.pow(mid_in, a) - math.pow(hdr_max, a) * math.pow(math.pow(mid_in, a), d) * mid_out) / (math.pow(math.pow(hdr_max, a), d) - math.pow(math.pow(mid_in, a), d) * mid_out)

    z = math.pow(x, a)
    y = z / (math.pow(z, d) * b + c)

    return y

Has anybody experimented with this by chance?

B_old
  • 1,141
  • 3
  • 12
  • 26

1 Answers1

0

Apparently there is a problem in the code presented in the slides slide. Bart Wronski gives some corrected code in the comments section of his blog post. I have also updated the github project to reflect this.

B_old
  • 1,141
  • 3
  • 12
  • 26