A Convenient Generalization of Schlick's Bias and Gain Functions
AA Convenient Generalization of Schlick’s Bias and Gain Functions
Jonathan T. Barron [email protected]
Abstract
We present a generalization of Schlick’s bias and gainfunctions — simple parametric curve-shaped functions forinputs in [0 , . Our single function includes both bias andgain as special cases, and is able to describe other smoothand monotonic curves with variable degrees of asymmetry. Schlick’s bias and gain functions [2] are simple tools formodeling smooth and monotonic curve-shaped mappingsfrom [0 , to [0 , . These functions were presented as in-expensive rational alternatives to the similarly-shaped biasand gain functions presented by Perlin [1]. Though biasand gain were originally developed for use in proceduraltexture generation they are often used as general purpose“easing” functions, or as a means to manipulate interpola-tion weights.Schlick’s bias and gain are respectively defined as: B( x, a ) = x (1 /a − − x ) + 1 , (1) G( x, a ) = B(2 x, a )2 if x < / B(2 x − , − a ) + 12 if x ≥ / , (2)where the input x is in [0 , , the shape of each function isdetermined by one parameter a ∈ (0 , , and the output isguaranteed to be in [0 , . See Figure 1 for visualizationsof bias and gain for different values of a . The bias function B “biases” the input towards either or , while the gainfunction G pushes or pulls the input towards or away from / . The bias function is a single curve that is symmetricacross y = 1 − x ; setting a < / biases the output towards , setting a = / yields the identity function, and setting a > / biases the output towards . The gain function istwo scaled and shifted bias curves joined at x = / , whereeach curve’s shape parameter is one minus that of the other. Our generalization of bias and gain is as follows: C( x, s, t ) = txx + s ( t − x ) + (cid:15) if x < t (1 − t )( x − − x − s ( t − x ) + (cid:15) + 1 if x ≥ t , (3)where the input x is in [0 , and the shape of the functionis determined by two parameters s ≥ and t ∈ [0 , ( (cid:15) ismachine epsilon, and just prevents division by zero when t is or ). The “threshold” parameter t controls the valueof x where the curve reverses it shape, which is also theonly input location (besides x = 0 and x = 1 ) where theoutput of the curve is guaranteed to be equal to its input.The “slope” parameter s controls the slope of the curve atthe threshold t , and is exactly the derivative of C( x, s, t ) with respect to x at x = t . This parameterization allows apractitioner to shape the curve similarly to how one mightadjust a Hermite spline.We can reproduce Schlick’s bias two ways, one in which t = 0 and the slope is small (or large) and another in which t = 1 and the slope is large (or small). B ( x, / ( s + 1) ) = C ( x, / s ,
0) = C( x, s, . (4)We can also reproduce Schlick’s gain by setting t = / . G ( x, / ( s + 1) ) = C( x, s, / ) . (5)Our generalization exhibits similarly symmetries asSchlick’s bias and gain functions: C( x, s, t ) = 1 − C(1 − x, s, − t ) . (6)We can invert our function by setting s to its reciprocal: x = C (cid:0) C( x, s, t ) , / s , t (cid:1) . (7)Unlike Schlick’s bias and gain functions, our general-ization is able to describe asymmetric gain-like curves bysetting t to values other than / , as shown in Figure 2. References [1] Kenneth Perlin and Eric M Hoffert. Hypertexture.
SIG-GRAPH , 1989.[2] Christophe Schlick. Fast alternatives to perlin’s bias and gainfunctions.
Graphics Gems , 4, 1994. a r X i v : . [ c s . G R ] O c t
0 1/4 1/2 3/4 1 x y a = . a = . a = . a = . a = . a = . a = . (a) y = B( x, a )
0 1/4 1/2 3/4 1 x y a = . a = . a = . a = . a = . (b) y = G( x, a ) Figure 1: Visualizations of Schlick’s bias and gain functions for different values of a . t=0 y t=1/4 t=1/2 t=3/4 t=1 s=64 y s=8 y s=1 y s=1/8
0 1/4 1/2 3/4 1 x y
0 1/4 1/2 3/4 1 x
0 1/4 1/2 3/4 1 x
0 1/4 1/2 3/4 1 x
0 1/4 1/2 3/4 1 x s=1/64
Figure 2: A “small multiples” visualization of y = C( x, s, t ) for different values of s (rows) and of t (columns). A knotindicates where x = t . When t is or (first column, last column) our generalization reproduces Schlick’s bias, and when t is /2