Math behind Graph Bias adjustment 2003-11-20 - By stephan mantler
Back Helmar Gerhardt wrote: > Hi, I'm trying to figure out the mathematics behind Maya's ramp graph > input bias adjustment. (...) If the input bias is 0.0 then a value of > 0.5 will map to the exact middle of the opacity curve.
i can imagine a number of ways to achieve this, but standard gamma correction seems like a good starting point:
in : 0 <= x <= 1; gamma > 0 out: 0 <= f(x) <= 1
f(x, gamma) = x^(1/gamma)
now, since you would like to specify a bias instead of gamma: (note that we can assume -0.5 < bias < 0.5...)
f(0.5,gamma) = bias + 0.5
0.5^(1/gamma) = bias + 0.5
or, after a quick excursion into algebra,
gamma = log(0.5)/log(0.5+bias)
which can then be plugged back into our original formula:
f(x, bias) = x^(1/(log(0.5)/log(0.5+bias)) or, equally,
f(x, bias) = x^(-log(0.5+bias)/log(2))
greetings, -stephan
ps. hope the math is correct ;-)
-- stephan mantler | mail - step@(protected) -- ---- ---- ---- ---- -----| icq - 799434 It's not an adventure | fone - +43 (676) 308-5342 until something f--ks up. | web - www.stephanmantler.com
-- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- --- List-help: <mailto:listar@(protected)?Subject=help> List-archive: <http://www.highend3d.com/maya/devarchive/>
|
|