supplemental document: nteractive hair rendering and ...kun/hair/[siga11][interactive... ·...

3
Supplemental Document: Interactive Hair Rendering and Appearance Editing under Environment Lighting Kun Xu 1 Li-Qian Ma 1 Bo Ren 1 Rui Wang 2 Shi-Min Hu 1 1 TNList, Department ofComputer Science and Technology, Tsinghua University, Beijing 2 Department of Computer Science, University of Massachusetts, Amherst This supplemental document provides additional proofs and results for the paper entitled Interactive Hair Rendering and Appearance Editing under Environment Lighting. 1 Approximating circular Gaussian by Gaus- sian Using a 2nd-order Taylor expansion: cos (φ - μ ) 1 - (φ - μ ) 2 /2 The circular Gaussian could be approximated by: g c (φ ; μ , λ ) = exp[ 2 (cos (x - μ ) - 1) λ 2 ] exp[- (φ - μ ) 2 λ 2 ]= g(φ ; μ , λ ) This means a circular Gaussian can be well approximated by a Gaussian. When φ [μ - π , μ + π ] and λ < π /6, the relative error of this approximation is 1.3%. 2 Product of two 1D Gaussians A 1D Gaussian g is defined by g(x; μ , λ )= exp(-(x - μ ) 2 /λ 2 ) where μ is the center and λ is the width. Assume two 1D Gaussians g 1 (x; μ 1 , λ 1 ) and g 2 (x; μ 2 , λ 2 ), it is straightforward to prove that their product is still a Gaussian, given by g 1 · g 2 = b · g 3 (x; μ 3 , λ 3 ), where: μ 3 = μ 1 /λ 2 1 + μ 2 /λ 2 2 1/λ 2 1 + 1/λ 2 2 , λ 3 = s 1 1/λ 2 1 + 1/λ 2 2 , b = exp (μ 1 - μ 2 ) 2 λ 2 1 + λ 2 2 ! . 3 Product Integral of 1D Gaussians with Polynomials First, the indefinite integral of a 1D Gaussian function g(x; μ , λ ) is: Z g(x; μ , λ ) dx = 1 2 πλ erf x - μ λ where erf is the error function given by: erf(x)= 2 π R x 0 e -t 2 dt . It is also known that the indefinite product integral of a Gaussian function with the linear function x is computed as: Z x · g(x; μ , λ ) dx = - 1 2 λ 2 g(x; μ , λ )+ 1 2 πμλ erf x - μ λ To evaluate the erf function, we can either use a precomputed table, or in our case, we use the following approximation [Abramowitz and Stegun 1964] that is easy to evaluate in a shader: erf(x) 1 - (a 1 t + a 2 t 2 + a 3 t 3 )e -x 2 , t = 1/(1 + px) where p = 0.47047, a 1 = 0.3480242, a 2 = -0.0958798, a 3 = 0.7478556. This approximation is very accurate, and the approx- imation error is guaranteed to be smaller than 2.5 × 10 -5 . 4 Integral of 1D circular Gaussian The integral of a 1D circular Gaussian g c (φ ; μ , λ ) over [-π , π ] can be approximated as: Z π -π g c (φ ; μ , λ )dφ Z π -π g(φ ; μ , λ )dφ Z -g(φ ; μ , λ )dφ = πλ When λ < π /6, the relative error of this approximation is 1.9%. 5 Product of two 1D circular Gaussians A circular Gaussian g c is defined by g c (φ ; μ , λ )= exp[2 (cos(φ - μ ) - 1)/λ 2 ], which is a function of the angle φ on the circle. As- sume two circular Gaussians g c 1 (φ ; μ 1 , λ 1 ) and g c 2 (φ ; μ 2 , λ 2 ), it is straightforward to prove that their product is still a circular Gaus- sian, given by g c 1 · g c 2 = b · g c 3 (φ ; μ 3 , λ 3 ), where: μ 3 = arctan(n, m), λ 3 = 1 4 m 2 + n 2 , b = exp - 2 λ 2 1 - 2 λ 2 2 + 2 λ 2 3 ! , m = cos μ 1 λ 2 1 + cos μ 2 λ 2 2 , n = sin μ 1 λ 2 1 + sin μ 2 λ 2 2 . 6 Definitions of A b (θ d ), Δ b (θ d ), and σ b (θ d ) terms in Eq 29 According to [Zinke et al. 2008], these terms are all defined as func- tions of a f (θ d ), a b (θ d ), α f (θ d ), α b (θ d ), β f (θ d ), β b (θ d ), where a, α , β stand for the average scattering attenuation, shift, and vari- ance; and the subscripts f , b indicate the forward/backward scatter- ing respectively. Specifically, their formulas are: A b = a b (θ d ) a 2 f (θ d ) 1 - a 2 f (θ d ) + a 3 b (θ d ) a 2 f (θ d ) (1 - a 2 f (θ d )) 3 Δ b α b 1 - 2 a 2 b (1 - a 2 f ) 2 ! + α f 2(1 - a 2 f ) 2 + 4 a 2 f a 2 b (1 - a 2 f ) 3 ! σ b (1 + 0.7 a 2 f ) a b q 2 β 2 f + β 2 b + a 3 b q 2 β 2 f + 3 β 2 b a b + a 3 b (2 β f + 3 β b ) where the average forward and backward scattering shifts α f , α b , and the average forward and backward scattering variances β 2 f , β 2 b

Upload: others

Post on 07-Feb-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Supplemental Document: nteractive Hair Rendering and ...kun/hair/[SIGA11][Interactive... · Supplemental Document: Interactive Hair Rendering and Appearance Editing under Environment

Supplemental Document:Interactive Hair Rendering and Appearance Editing under Environment Lighting

Kun Xu1 Li-Qian Ma1 Bo Ren1 Rui Wang2 Shi-Min Hu1

1 TNList, Department of Computer Science and Technology, Tsinghua University, Beijing2 Department of Computer Science, University of Massachusetts, Amherst

This supplemental document provides additional proofs and resultsfor the paper entitled Interactive Hair Rendering and AppearanceEditing under Environment Lighting.

1 Approximating circular Gaussian by Gaus-sian

Using a 2nd-order Taylor expansion:

cos(φ −µ)≈ 1− (φ −µ)2/2

The circular Gaussian could be approximated by:

gc(φ ; µ,λ ) = exp[2(cos(x−µ)−1)

λ 2 ]

≈ exp[− (φ −µ)2

λ 2 ] = g(φ ; µ,λ )

This means a circular Gaussian can be well approximated by aGaussian. When φ ∈ [µ−π,µ +π] and λ < π/6, the relative errorof this approximation is ≤ 1.3%.

2 Product of two 1D Gaussians

A 1D Gaussian g is defined by g(x; µ,λ ) = exp(−(x− µ)2/λ 2)where µ is the center and λ is the width. Assume two 1D Gaussiansg1(x; µ1,λ1) and g2(x; µ2,λ2), it is straightforward to prove thattheir product is still a Gaussian, given by g1 ·g2 = b ·g3(x; µ3,λ3),where:

µ3 =µ1/λ 2

1 + µ2/λ 22

1/λ 21 +1/λ 2

2, λ3 =

√1

1/λ 21 +1/λ 2

2,

b = exp

((µ1−µ2)2

λ 21 +λ 2

2

).

3 Product Integral of 1D Gaussians withPolynomials

First, the indefinite integral of a 1D Gaussian function g(x; µ,λ ) is:∫g(x; µ,λ )dx =

12√

π λ erf(

x−µ

λ

)where erf is the error function given by: erf(x) = 2√

π

∫ x0 e−t2

dt.It is also known that the indefinite product integral of a Gaussianfunction with the linear function x is computed as:∫

x ·g(x; µ,λ )dx =−12

λ2g(x; µ,λ )+

12√

π µ λ erf(

x−µ

λ

)To evaluate the erf function, we can either use a precomputed table,or in our case, we use the following approximation [Abramowitzand Stegun 1964] that is easy to evaluate in a shader:

erf(x)≈ 1− (a1t +a2t2 +a3t3)e−x2, t = 1/(1+ px)

where p = 0.47047, a1 = 0.3480242, a2 = −0.0958798, a3 =0.7478556. This approximation is very accurate, and the approx-imation error is guaranteed to be smaller than 2.5×10−5.

4 Integral of 1D circular Gaussian

The integral of a 1D circular Gaussian gc(φ ; µ,λ ) over [−π,π] canbe approximated as:∫

π

−π

gc(φ ; µ,λ )dφ ≈∫

π

−π

g(φ ; µ,λ )dφ ≈∫

−∞

g(φ ; µ,λ )dφ =√

πλ

When λ < π/6, the relative error of this approximation is ≤ 1.9%.

5 Product of two 1D circular Gaussians

A circular Gaussian gc is defined by gc(φ ; µ,λ ) = exp[2(cos(φ −µ)− 1)/λ 2], which is a function of the angle φ on the circle. As-sume two circular Gaussians gc

1(φ ; µ1,λ1) and gc2(φ ; µ2,λ2), it is

straightforward to prove that their product is still a circular Gaus-sian, given by gc

1 ·gc2 = b ·gc

3(φ ; µ3,λ3), where:

µ3 = arctan(n,m), λ3 =1

4√

m2 +n2,

b = exp

(− 2

λ 21− 2

λ 22

+2

λ 23

),

m =cos µ1

λ 21

+cos µ2

λ 22

, n =sin µ1

λ 21

+sin µ2

λ 22

.

6 Definitions of Ab(θd), ∆b(θd), and σb(θd)terms in Eq 29

According to [Zinke et al. 2008], these terms are all defined as func-tions of a f (θd), ab(θd), α f (θd), αb(θd), β f (θd), β b(θd), wherea,α,β stand for the average scattering attenuation, shift, and vari-ance; and the subscripts f ,b indicate the forward/backward scatter-ing respectively. Specifically, their formulas are:

Ab =ab(θd)a2

f (θd)

1−a2f (θd)

+a3

b(θd)a2f (θd)

(1−a2f (θd))3

∆b ≈ αb

(1− 2a2

b(1−a2

f )2

)+α f

(2(1−a2

f )2 +4a2

f a2b

(1−a2f )

3

)

σb ≈ (1+0.7a2f )

ab

√2β

2f +β

2b +a3

b

√2β

2f +3β

2b

ab +a3b (2β f +3β b)

where the average forward and backward scattering shifts α f ,αb,

and the average forward and backward scattering variances β2f ,β

2b

Page 2: Supplemental Document: nteractive Hair Rendering and ...kun/hair/[SIGA11][Interactive... · Supplemental Document: Interactive Hair Rendering and Appearance Editing under Environment

are calculated as (all sums are over t ∈ {R,T T,T RT}):

a f (θd) = ∑t

a f ,t(θd) , ab(θd) = ∑t

ab,t(θd)

α f (θd) =∑t a f ,t(θd)αt

a f (θd), αb(θd) =

∑t ab,t(θd)αt

ab(θd)

β2f (θd) =

∑t a f ,t(θd)β 2t

a f (θd), β

2b(θd) =

∑t ab,t(θd)β 2t

ab(θd)

7 Proof of the integral of Nt in Eq 33

∫ 3π

2

π

2

∫ π

2

− π

2

Nt(θd ,φo−φd)dφd dφo = 2∫

π

0φ Nt(θd ,φ)dφ

The proof is given as follows:

∫ 3π

2

φo= π

2

∫ π

2

φd=− π

2

Nt(θd ,φo−φd)dφd dφo

=∫ 3π

2

φo= π

2

∫φo+ π

2

φ=φo− π

2

Nt(θd ,φ)dφ dφo (1)

=∫ 2π

φ=0

∫ min( 3π

2 ,φ+ π

2 )

φo=max( π

2 ,φ− π

2 )Nt(θd ,φ)dφo dφ (2)

=∫ 2π

φ=0Nt(θd ,φ)dφ

∫ min( 3π

2 ,φ+ π

2 )

max( π

2 ,φ− π

2 )dφo

= 2∫

π

φ=0Nt(θd ,φ)dφ

∫ min( 3π

2 ,φ+ π

2 )

max( π

2 ,φ− π

2 )dφo (3)

= 2∫

π

φ=0Nt(θd ,φ)dφ

∫φ+ π

2

π

2

dφo

= 2∫

π

φ=0Nt(θd ,φ)φ dφ

where step (1) uses the change of integral variable; step (2) switchesthe inner and outer intergrals; and step (3) is due to the symmetryof Nt with respect to φ .

8 Images of the precomputed 2D tables

In Fig 1, we show the images of all precomputed 2D tables used inthis paper, including the 7 tables of Ck(λ ′j, φo−φ j) (0≤ k ≤ 6) forthe R mode, 3 tables of H T T

k (η ,θd) (k=0,2,4) for the TT mode,and 3 tables of H T RT

k (η ,θd) (k=0,2,4) for the TRT mode. All ofthem are computed at a default resolution of 128× 64. From theimages we can see that these functions are smooth and hence ourdefault resolution is sufficient.

9 Addition plots

In Fig 2 (next page) we show addition plots, including the singlescattering inner integral Nt cos2 θi/cos2 θd computed for the threescattering modes, and the same for the global multiple scattering in-ner integral N G

t cos2 θi/cos2 θd . Note that these functions will beintegrated with a 1D Gaussian using our linear quadrature methoddescribed in Section 4.2.2. By examining the smoothness of thesefunctions in Fig 2 , we can see that our linear quadrature method isquite accurate in practice.

(a) The 7 tables of Ck(λ ′j, φo−φ j) (0≤ k ≤ 6) for the R mode.

.(b) The 3 tables of H T T

k (η ,θd) (k=0,2,4) for the TT mode

(c) The 3 tables of H T RTk (η ,θd) (k=0,2,4) for the TRT mode.

Figure 1: Images of the precomputed 2D tables, all of which arecomputed at a resolution of 128×64.

10 Addition Comparisons

In Fig 3, we compare the results of our method to [Ren et al. 2010]under a single SRBF light at different bandwidth λ . We observethat using SRBF ranging from small bandwidth (λ = 0.01) to largebandwidth (λ = 0.8), our method consistently matches [Ren et al.2010] very well.

In Fig 4, we provide a comparison between renderings computedwith directional lights vs. SRBF lights. We observe that using only10 SRBFs already leads to more accurate result than using 240 di-rectional lights. This is because the environment map used for thisexample – Eucalyptus Grove – has a wide region of sky light, whichrequires a large number of directional lights to approximate well.

References

ABRAMOWITZ, M., AND STEGUN, I. A. 1964. Handbook ofMathematical Functions with Formulas, Graphs, and Mathemat-ical Tables. Dover, New York.

ZINKE, A., YUKSEL, C., WEBER, A., AND KEYSER, J. 2008.Dual scattering approximation for fast multiple scattering in hair.ACM Trans. Graph. 27, 3, 32:1–32:10.

Page 3: Supplemental Document: nteractive Hair Rendering and ...kun/hair/[SIGA11][Interactive... · Supplemental Document: Interactive Hair Rendering and Appearance Editing under Environment

−1/2π 0 1/2π0

0.005

0.01

0.015

R Single

−→ θi

φo− φ

j=π/6

φo− φ

j=π/2

φo− φ

j=5π/6

−1/2π 0 1/2π0

0.1

0.2

0.3

TT Single

−→ θi

φo− φ

j=π/6

φo− φ

j=π/2

φo− φ

j=5π/6

−1/2π 0 1/2π0

0.005

0.01

0.015

TRT Single

−→ θi

φo− φ

j=π/6

φo− φ

j=π/2

φo− φ

j=5π/6

(a) (b) (c)

−1/2π 0 1/2π0

0.01

0.02

0.03

0.04

R Multiple

−→ θi

φo− φ

j=π/6

φo− φ

j=π/2

φo− φ

j=5π/6

−1/2π 0 1/2π0

0.2

0.4

0.6

TT Multiple

−→ θi

φo− φ

j=π/6

φo− φ

j=π/2

φo− φ

j=5π/6

−1/2π 0 1/2π0

0.01

0.02

TRT Multiple

−→ θi

φo− φ

j=π/6

φo− φ

j=π/2

φo− φ

j=5π/6

(d) (e) (f)

Figure 2: The top three figures show Nt cos2 θi/cos2 θd (in single scattering) computed for the three scattering modes. The bottom threefigures show the same for N G

t cos2 θi/cos2 θd (in multiple scattering). Note that all these functions are very smooth.

λ = 0.01 λ = 0.2 λ = 0.4 λ = 0.6 λ = 0.8

[Ren

etal

.201

0]O

urm

etho

d

Figure 3: Comparison of our method (bottom row) to [Ren et al. 2010] (top row) under a single SRBF light at different bandwidth λ . Notefrom small SRBF bandwidth (λ = 0.01) to large bandwidth (λ = 0.8), our method consistently matches [Ren et al. 2010] well.

(a) 10 DLs (b) 240 DLs (c) 10 SRBFs (d) 30 SRBFs (e) reference

Figure 4: Comparison of results using directional lights (DL) and SRBF lights. In (a) and (b), the environment map is approximated as 10and 240 directional lights (i.e. zero support size), respectively; (c) and (d) show our result by approximating the environment map as 10 and30 SRBF lights, respectively. (e) is the reference image. Note that using only 10 SRBFs already leads to more accurate result than using 240directional lights.