• No results found

Inverse Volume Rendering

N/A
N/A
Protected

Academic year: 2021

Share "Inverse Volume Rendering"

Copied!
35
0
0

Loading.... (view fulltext now)

Full text

(1)

Inverse Volume Rendering

Absorption + Emission, Automatic Differentiation

Sebastian Weiß

Lehrstuhl f¨ ur Computergrafik Technische Universit¨ at M¨ unchen

November 2020

1 / 13

(2)

Overview

1. Models and Assumptions

1.1. Absorption 1.2. Emission 1.3. Transfer Function

2. Automatic Differentiation

2.1. Forward Mode 2.2. Backward Mode

(1) (2)

(1)https://www.youtube.com/watch?v=HwJyg5o3HGg

(2)https://commons.wikimedia.org/wiki/File:Convolutional_Neural_Network_with_Color_Image_Filter.gif

2 / 13

(3)

Overview

1. Models and Assumptions

1.1. Absorption 1.2. Emission 1.3. Transfer Function

2. Automatic Differentiation

2.1. Forward Mode 2.2. Backward Mode

(1) (2)

(1)https://www.youtube.com/watch?v=HwJyg5o3HGg

(2)https://commons.wikimedia.org/wiki/File:Convolutional_Neural_Network_with_Color_Image_Filter.gif 2 / 13

(4)

1. Models and Assumptions

1. Scalar Field d : R 3 → R + 0 of densities 2. Ray r (t) = x 0 + tω , x 0 ∈ R 3 , ω ∈ S 2 3. Received Illumination I out (x 0 , ω) ∈ R + 0

d ∶ ℝ

3

→ ℝ

0+

r(𝑡) = 𝑥

0

+ 𝑡𝜔

𝐼

𝑖𝑛

: ℝ

0+

𝐼

𝑜𝑢𝑡

: ℝ

0+

3 / 13

(5)

1.1 Only Absorption

Assume a medium that only absorbs incoming light, no emission or scattering.

I out (x 0 , ω) = Z ∞

0

g (t) exp



− Z t

0

τ (v (r (t 0 )))dt 0

 dt with g (s) = c(s)τ (s) +

Z

p(ω, ω 0 )I out (r (t), ω 0 )d ω 0

Set g (∞) = I in and zero everywhere else (only absorption). Set τ (d ) = d

⇒ Transparency T (s) = exp



− Z s

0

d (r (t))dt



⇒ Received Illumination I out = T (t max )I in

Nelson Max. Optical Models for Direct Volume Rendering. TVCG 1995 Kajiya, von Herzen. Ray Tracing Volume Densities. Computer Graphics 1984

4 / 13

(6)

1.1 Only Absorption

Assume a medium that only absorbs incoming light, no emission or scattering.

I out (x 0 , ω) = Z ∞

0

g (t) exp



− Z t

0

τ (v (r (t 0 )))dt 0

 dt with g (s) = c(s)τ (s) +

Z

p(ω, ω 0 )I out (r (t), ω 0 )d ω 0 Set g (∞) = I in and zero everywhere else (only absorption).

Set τ (d ) = d

⇒ Transparency T (s) = exp



− Z s

0

d (r (t))dt



⇒ Received Illumination I out = T (t max )I in

Nelson Max. Optical Models for Direct Volume Rendering. TVCG 1995 Kajiya, von Herzen. Ray Tracing Volume Densities. Computer Graphics 1984

4 / 13

(7)

1.1 Only Absorption

Assume a medium that only absorbs incoming light, no emission or scattering.

I out (x 0 , ω) = Z ∞

0

g (t) exp



− Z t

0

τ (v (r (t 0 )))dt 0

 dt with g (s) = c(s)τ (s) +

Z

p(ω, ω 0 )I out (r (t), ω 0 )d ω 0 Set g (∞) = I in and zero everywhere else (only absorption).

Set τ (d ) = d

⇒ Transparency T (s) = exp



− Z s

0

d (r (t))dt



⇒ Received Illumination I out = T (t max )I in

Nelson Max. Optical Models for Direct Volume Rendering. TVCG 1995 Kajiya, von Herzen. Ray Tracing Volume Densities. Computer Graphics 1984

4 / 13

(8)

1.1 Only Absorption

5 / 13

(9)

1.1 Only Absorption: Solutions

Densities on a grid v i

(1)

Trilinear Interpolation N i (x)

(2)

⇒ log I out = X

i ∈voxels 8

X

j =1

v ij Z t

1(i )

t

(i )0

N j (r (t))dt

Assemble into matrices for all rays:

⇒ log I out = Nv

(1)https://en.wikipedia.org/wiki/Regular_grid

(2)https://en.wikipedia.org/wiki/Trilinear_interpolation

6 / 13

(10)

1.1 Only Absorption: Solutions

Densities on a grid v i

(1)

Trilinear Interpolation N i (x)

(2)

⇒ log I out = X

i ∈voxels 8

X

j =1

v ij

Z t

1(i )

t

0(i )

N j (r (t))dt

Assemble into matrices for all rays:

⇒ log I out = Nv

(1)https://en.wikipedia.org/wiki/Regular_grid

(2)https://en.wikipedia.org/wiki/Trilinear_interpolation

6 / 13

(11)

1.1 Only Absorption: Differentiation

log I out = N v

output images matrix of

voxel-pixel contributions

voxel densities

⇒ Linear in v , simply solve it

7 / 13

(12)

1.1 Only Absorption: Differentiation

log I out = N v

output images matrix of

voxel-pixel contributions

voxel densities

⇒ Linear in v , simply solve it

7 / 13

(13)

1.2 With Emission

Now every point in space also emits light g (d )

Usually dependent on τ (d ): g (d ) := c(d )τ (d ) for some color c(d ).

I out = T (t max )I in + Z t

max

0

g (t)T (t)dt

with T (s) = exp



− Z s

0

τ (v (r (t)))dt



This is a nested integral and cannot be solved analytically.

8 / 13

(14)

1.2 With Emission

Now every point in space also emits light g (d )

Usually dependent on τ (d ): g (d ) := c(d )τ (d ) for some color c(d ).

I out = T (t max )I in + Z t

max

0

g (t)T (t)dt

with T (s) = exp



− Z s

0

τ (v (r (t)))dt



This is a nested integral and cannot be solved analytically.

8 / 13

(15)

1.2 With Emission

τ (d ) = d , c(d ) = d

τ (d ), c(d ) arbitrary

9 / 13

(16)

1.2 With Emission

τ (d ) = d , c(d ) = d τ (d ), c(d ) arbitrary

9 / 13

(17)

1.2 With Emission

τ (d ) = d , c(d ) = d τ (d ), c(d ) arbitrary

9 / 13

(18)

2. Automatic Differentiation

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f k (x k−1 , w k ) with

k ∈ N number of operations x i ∈ R n state variables

x k ∈ R m size of the output / last state w i ∈ R p parameters

⇒ dx k dw 1

10 / 13

(19)

2. Automatic Differentiation

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f k (x k−1 , w k ) with

k ∈ N number of operations x i ∈ R n state variables

x k ∈ R m size of the output / last state w i ∈ R p parameters

⇒ dx k dw 1

10 / 13

(20)

2.1 AutoDiff: Forward Mode

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Replace each x i , w i by

˜ x i =

 x i , dx

i

dw

1



, ˜ w i =



w i , dw

i

dw

1



Note that ˜ x 0 = hx 0 , 0i, ˜ w 1 = hw 1 , 1i

Replace a function c = f (a, b) by ˜ c = ˜ f ( ˜ a, ˜ b) with

 c, dc

dc 1



=



f (a, b),

J f |a (a, b) da i

dw 1 + J f |b (a, b) db i

dw 1



⇒ O(np) memory

⇒ O(kn 2 + knp) computations

11 / 13

(21)

2.1 AutoDiff: Forward Mode

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Replace each x i , w i by

˜ x i =

 x i , dx

i

dw

1



, ˜ w i =



w i , dw

i

dw

1



Note that ˜ x 0 = hx 0 , 0i, ˜ w 1 = hw 1 , 1i

Replace a function c = f (a, b) by ˜ c = ˜ f ( ˜ a, ˜ b) with

 c, dc

dc 1



=



f (a, b),

J f |a (a, b) da i

dw 1 + J f |b (a, b) db i

dw 1



⇒ O(np) memory

⇒ O(kn 2 + knp) computations

11 / 13

(22)

2.1 AutoDiff: Forward Mode

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Replace each x i , w i by

˜ x i =

 x i , dx

i

dw

1



, ˜ w i =



w i , dw

i

dw

1



Note that ˜ x 0 = hx 0 , 0i, ˜ w 1 = hw 1 , 1i

Replace a function c = f (a, b) by ˜ c = ˜ f ( ˜ a, ˜ b) with

 c, dc

dc 1



=



f (a, b),

J f |a (a, b) da i

dw 1 + J f |b (a, b) db i dw 1



⇒ O(np) memory

⇒ O(kn 2 + knp) computations

11 / 13

(23)

2.1 AutoDiff: Forward Mode

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Replace each x i , w i by

˜ x i =

 x i , dx

i

dw

1



, ˜ w i =



w i , dw

i

dw

1



Note that ˜ x 0 = hx 0 , 0i, ˜ w 1 = hw 1 , 1i

Replace a function c = f (a, b) by ˜ c = ˜ f ( ˜ a, ˜ b) with

 c, dc

dc 1



=



f (a, b),

J f |a (a, b) da i

dw 1 + J f |b (a, b) db i dw 1



⇒ O(np) memory

⇒ O(kn 2 + knp) computations

11 / 13

(24)

2.2 AutoDiff: Backward Mode / Adjoint Method

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Assume x k ∈ R is a scalar (m = 1), define x ˆ i = dx

k

dx

i

∈ R n , ˆ w i = dx

k

dw

i

∈ R p , Note: ˆ x k = 1.

1. Forward Pass, compute x k normally, but save intermediate results 2. Backward Pass: For i = k, ..., 1

ˆ

x i −1 = J f

i

|x

i −1

(x i −1 , w i )

T

x ˆ i ˆ

w i = J f

i

|w

i

(x i −1 , w i )

T

x ˆ i

⇒ O(kn) memory

⇒ O(kn 2 + np) computations

12 / 13

(25)

2.2 AutoDiff: Backward Mode / Adjoint Method

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Assume x k ∈ R is a scalar (m = 1), define x ˆ i = dx

k

dx

i

∈ R n , ˆ w i = dx

k

dw

i

∈ R p , Note: ˆ x k = 1.

1. Forward Pass, compute x k normally, but save intermediate results 2. Backward Pass: For i = k, ..., 1

ˆ

x i −1 = J f

i

|x

i −1

(x i −1 , w i )

T

x ˆ i ˆ

w i = J f

i

|w

i

(x i −1 , w i )

T

x ˆ i

⇒ O(kn) memory

⇒ O(kn 2 + np) computations

12 / 13

(26)

2.2 AutoDiff: Backward Mode / Adjoint Method

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Assume x k ∈ R is a scalar (m = 1), define x ˆ i = dx

k

dx

i

∈ R n , ˆ w i = dx

k

dw

i

∈ R p , Note: ˆ x k = 1.

1. Forward Pass, compute x k normally, but save intermediate results

2. Backward Pass: For i = k, ..., 1 ˆ

x i −1 = J f

i

|x

i −1

(x i −1 , w i )

T

x ˆ i ˆ

w i = J f

i

|w

i

(x i −1 , w i )

T

x ˆ i

⇒ O(kn) memory

⇒ O(kn 2 + np) computations

12 / 13

(27)

2.2 AutoDiff: Backward Mode / Adjoint Method

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Assume x k ∈ R is a scalar (m = 1), define x ˆ i = dx

k

dx

i

∈ R n , ˆ w i = dx

k

dw

i

∈ R p , Note: ˆ x k = 1.

1. Forward Pass, compute x k normally, but save intermediate results 2. Backward Pass: For i = k, ..., 1

ˆ

x i −1 = J f

i

|x

i −1

(x i −1 , w i )

T

x ˆ i ˆ

w i = J f

i

|w

i

(x i −1 , w i )

T

x ˆ i

⇒ O(kn) memory

⇒ O(kn 2 + np) computations

12 / 13

(28)

2.2 AutoDiff: Backward Mode / Adjoint Method

x 0 = const x 1 = f 1 (x 0 , w 1 ) x 2 = f 2 (x 1 , w 2 )

. . .

x k = f n (x k−1 , w k )

Assume x k ∈ R is a scalar (m = 1), define x ˆ i = dx

k

dx

i

∈ R n , ˆ w i = dx

k

dw

i

∈ R p , Note: ˆ x k = 1.

1. Forward Pass, compute x k normally, but save intermediate results 2. Backward Pass: For i = k, ..., 1

ˆ

x i −1 = J f

i

|x

i −1

(x i −1 , w i )

T

x ˆ i ˆ

w i = J f

i

|w

i

(x i −1 , w i )

T

x ˆ i

⇒ O(kn) memory

⇒ O(kn 2 + np) computations

12 / 13

(29)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops

I Arbitrary number of outputs

I Compile-time: implement with operator overloading I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

(30)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops I Arbitrary number of outputs

I Compile-time: implement with operator overloading I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

(31)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops I Arbitrary number of outputs

I Compile-time: implement with operator overloading

I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

(32)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops I Arbitrary number of outputs

I Compile-time: implement with operator overloading I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

(33)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops I Arbitrary number of outputs

I Compile-time: implement with operator overloading I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

(34)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops I Arbitrary number of outputs

I Compile-time: implement with operator overloading I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

(35)

2.3 AutoDiff: Comparison

Forward Mode I ⇒ O(np) memory

⇒ O(kn 2 + knp) ops I Arbitrary number of outputs

I Compile-time: implement with operator overloading I Expensive for large p

⇒ use if k large, p small

⇒ Sensitivity Analysis in simulations

Backward Mode I ⇒ O(kn) memory

⇒ O(kn 2 + np) ops

I Only one output! Or repeat backward pass

I Dynamic computation graph Dynamic memory

I Lots of memory

⇒ use if k small, p large

⇒ Neural networks

For DVR we need some hybrid method...

13 / 13

References

Related documents

Ellis, who was Research Professor of Physical Chemistry in the California Institute of Technology, then carried out an X-ray investigation of a single crystal

More generally, this paper suggests that owner- ship architectures help us understand important as- pects of large systems by providing a visualization of the organization of

In this paper, we considered an EPQ model with partial trade credit financing in fuzzy environment, where demand is taken as a left right type of fuzzy number and gh

Wheeled vehicles (2011), air defence system (2012), tracked vehicles (2013), combat training center (2013), cost overruns in Norwegian subsidiary (2014) Cost overruns Political

The second half of the 1950s was a time of change in British theatre and given the close proximity between the London stage and BBC radio drama this was another factor

These six groups of evaluation methods are illustrated with a wide range of example applications, including evaluations of an early childhood intervention program, a voucher

ع ةدابعلاك ةديقعلا في ةعوضولدا ثيداحلأا رثأ ن ملسلدا عتملمجا د ةعقاولا تاظفامح سخم فى ئطاش في ةيليلتح ةسارد : نمادنأ ربح ثحبلا عوضوم رصن اتدم للها ف جنو ثحابلا ةيملاسلإا

The perspectives in this paper are aligned with Oxelheim and Rand0y (2003 and 2005) and Oxelheim et al (2013), who analyse the composition and the presence of international advisers