Fast High Accuracy Volume Rendering Thesis Defense May 2004 Kenneth Moreland Ph.D. Candidate Sandia...

Post on 17-Dec-2015

214 views 1 download

Tags:

transcript

Fast High Accuracy Volume Rendering

Thesis Defense

May 2004

Kenneth MorelandPh.D. Candidate

Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company,for the United States Department of Energy’s National Nuclear Security Administration

under contract DE-AC04-94AL85000.

Fast High Accuracy Volume Rendering

2May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

3May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

4May 2004

Problem Description

• Given: A 3D field of scalar information, typically represented as:– A finite set of points in three space with associated

scalar values.

– A connectivity graph.

Fast High Accuracy Volume Rendering

5May 2004

Problem Description

• Goal: Transform scalars to colors/opacities, render 3D model.

Transfer Function

Scalars

ColorsOpacities

Fast High Accuracy Volume Rendering

6May 2004

What Is Available

• Traditional/commodity 3D graphics hardware– Fast, powerful, and now flexible.

– Only (directly) support 0, 1, and 2 dimensional primitives (i.e. points, lines, and polygons).

• Special purpose volume rendering hardware– Constrained functionality; rectilinear grids only.

– Smaller economy of scale.• Development/fabrication costs distributed less.• Longer time span between generations.

Fast High Accuracy Volume Rendering

7May 2004

Using Commodity Graphics Hardware

• Naïve approach: render cell faces as translucent polygons.

Fast High Accuracy Volume Rendering

8May 2004

Using Commodity Graphics Hardware

• Naïve approach: render cell faces as translucent polygons.

• Result: “unrealistic” hollow cells.

Fast High Accuracy Volume Rendering

9May 2004

Why is it Wrong?

• 2D polygons only capture surfaces.– Volumes absorb/emit light differently.

Fast High Accuracy Volume Rendering

10May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

11May 2004

Light Transport

Fast High Accuracy Volume Rendering

12May 2004

Light Transport

Fast High Accuracy Volume Rendering

13May 2004

A Light Transport Model

• The Particle Model– Sabella, 1988

0I

0I

Fast High Accuracy Volume Rendering

14May 2004

A Light Transport Model

• Ultimately, as light passes though a disk of size Δd, some percentage energy is absorbed, while some fixed amount is added.

dI

dz= L(z)τ (z) − τ (z)I(z)

Fast High Accuracy Volume Rendering

15May 2004

The Volume Rendering Equation

I(d) = I0e− τ ( t )dt

0

d

Attenuationof IncomingLight

1 2 4 3 4 + L(s)τ (s)e− τ (t )dt

s

d

∫ ds0

d

∫Emitted Light (Including Self Attenuation)

1 2 4 4 4 3 4 4 4

Fast High Accuracy Volume Rendering

16May 2004

The Volume Rendering Equation

• This equation must be solved for every pixel.– In practice, we do piecewise integration, so we may

have to solve 100’s of times or more per pixel.

• Has no closed form.– Must solve for specific L and functions.

Fast High Accuracy Volume Rendering

17May 2004

Solution: Linear

• We can do a first order approximation through cells with linear interpolation.

• The volume rendering equation can be solved with linear functions for L and , but…

Fast High Accuracy Volume Rendering

18May 2004

Solution: Linear

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ b −τ f( )

e

d

2 τ b −τ f( )τ f

2

π2 erf τ b

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erf τ f

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

( )=dI

Fast High Accuracy Volume Rendering

19May 2004

Solution: Linear

I d( ) =

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ f −τ b( )

e

d

2 τ b −τ f( )τ f

2

π2 erfi τ b

d

2 τ f −τ b( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erfi τ f

d

2 τ f −τ b( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

fb <

fb >

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ b −τ f( )

e

d

2 τ b −τ f( )τ f

2

π2 erf τ b

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erf τ f

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

Fast High Accuracy Volume Rendering

20May 2004

Solution: Linear

( )=dI

I0e−τd + Lb

1τd − 1

τd e−τd − e−τd

( ) + L f 1+ 1τd e

−τd − 1τd( ) fb =

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ f −τ b( )

e

d

2 τ b −τ f( )τ f

2

π2 erfi τ b

d

2 τ f −τ b( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erfi τ f

d

2 τ f −τ b( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

fb <

fb >

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ b −τ f( )

e

d

2 τ b −τ f( )τ f

2

π2 erf τ b

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erf τ f

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

Fast High Accuracy Volume Rendering

21May 2004

( )=dI

I0e−τd + Lb

1τd − 1

τd e−τd − e−τd

( ) + L f 1+ 1τd e

−τd − 1τd( ) fb =

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ f −τ b( )

e

d

2 τ b −τ f( )τ f

2

π2 erfi τ b

d

2 τ f −τ b( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erfi τ f

d

2 τ f −τ b( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

fb <

fb >

I0e−d

τ b +τ f2 + L f − Lbe

−dτ b +τ f

2 + Lb − L f( ) 1

d τ b −τ f( )

e

d

2 τ b −τ f( )τ f

2

π2 erf τ b

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟− erf τ f

d

2 τ b −τ f( )

⎛ ⎝ ⎜

⎞ ⎠ ⎟

⎣ ⎢ ⎤

⎦ ⎥

Solution: LinearThree Cases

Many Terms

NumericallyUnstable

Fast High Accuracy Volume Rendering

22May 2004

Linear “Approximation”

• Plug in average luminance and attenuation.

Fast High Accuracy Volume Rendering

23May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

24May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

25May 2004

Transfer Function

• In the real world, a cloud is parameterized with material properties (luminance and density).

• In scientific visualization, a volume can parameterized by any number of scalars (pressure, temperature, vorticity, density, etc.).

• These scalars are mapped to material properties via a transfer function.

• The scalar (f) often varies linearly, but the transfer function (TL and T) does not.

L(s) = TL f (s)( )

(t) = Tτ f (t)( )

Fast High Accuracy Volume Rendering

26May 2004

Transfer Function Sampling

• We cannot solve the volume rendering integral for general transfer functions, so we sample.

0 0.5 1

0

0.5

1

Fast High Accuracy Volume Rendering

27May 2004

Transfer Function Sampling

• We cannot solve the volume rendering integral for general transfer functions, so we sample.

0 0.5 1

0

0.5

1

Fast High Accuracy Volume Rendering

28May 2004

Transfer Function Sampling

• We cannot solve the volume rendering integral for general transfer functions, so we sample.

0 0.5 1

0

0.5

1(0.5)

Fast High Accuracy Volume Rendering

29May 2004

Transfer Function Sampling

• We cannot solve the volume rendering integral for general transfer functions, so we sample.

0 0.5 1

0

0.5

1(0.5) 0

0.5

1(0.5)

Fast High Accuracy Volume Rendering

30May 2004

Transfer Function Aliasing

Fast High Accuracy Volume Rendering

31May 2004

Adaptive Transfer Function Sampling

• Constrain the transfer function to be piecewise linear [Williams98].

• The function has linear segments joined at control points.

• Between the control points, the properties change linearly.

Fast High Accuracy Volume Rendering

32May 2004

Adaptive Transfer Function Sampling

• If none of the scalars in a cell are a control point of the transfer function, then the transfer function varies linearly.

• Solution: clip cells at control points.– When the scalars vary linearly, the locus of points

for a given scalar is a plane.

• Rather than clip cells geometrically, clip ray fragments.

Fast High Accuracy Volume Rendering

33May 2004

Adaptive Transfer Function Sampling

• Clipping parameters can be determined from the surface scalars relative to the isosurface scalar.

Fast High Accuracy Volume Rendering

34May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

35May 2004

Linear Luminance

• A common approach for finding a closed form for the volume rendering integral [Max90, Shirley90] is to hold the luminance constant.

• This simplifies the equation, but introduces error in the color.

• Instead, let us analyze the volume rendering integral with linearly varying luminance.

Fast High Accuracy Volume Rendering

36May 2004

Linear Luminance

I(d) = I0e− τ ( t )dt

0

d

∫ + L(s)τ (s)e− τ (t )dt

s

d

∫ ds0

d

L s( ) = Lb 1− sD( ) + L f sD

I(d) = I0e− τ ( t )dt

0

d

+ Lb 1− sD( ) + L f sDτ (s)e− τ ( t )dt

s

d

∫ ds0

d

Fast High Accuracy Volume Rendering

37May 2004

Linear Luminance

• After lots of calculus…

I d( ) = I0e− τ t( )dt

0

D

∫ + L f 1−1

De

− τ t( )dts

D

∫ ds0

D

∫ ⎛

⎝ ⎜

⎠ ⎟

+Lb1

De

− τ t( )dts

D

∫ ds0

D

∫ − e− τ t( )dt

0

D

∫ ⎛

⎝ ⎜

⎠ ⎟

Fast High Accuracy Volume Rendering

38May 2004

Linear Luminance

• After lots of calculus…

I d( ) = I0e− τ t( )dt

0

D

∫ + L f 1−1

De

− τ t( )dts

D

∫ ds0

D

∫ ⎛

⎝ ⎜

⎠ ⎟

+Lb1

De

− τ t( )dts

D

∫ ds0

D

∫ − e− τ t( )dt

0

D

∫ ⎛

⎝ ⎜

⎠ ⎟

Notice theRepetition

Fast High Accuracy Volume Rendering

39May 2004

Substitute

• Now we just need to solve for and .

Let

≡e− τ t( )dt

0

D

≡1

De

− τ t( )dts

D

∫ ds0

D

I D( ) = I0ζ + L f 1− Ψ( ) + Lb Ψ −ζ( )

Fast High Accuracy Volume Rendering

40May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

41May 2004

, linear

• Easy enough to solve.– Not too bad to compute.

D,τ b ,τ f( ) = e−Dτ b +τ f

2

Fast High Accuracy Volume Rendering

42May 2004

, linear

• Not so easy to solve/compute.• But, we can build a 3D table.

– Calculate values for all applicable (D,b,f) triples.

D,τ b ,τ f( ) =1

De

− τ b 1− tD( )+τ f

tD( )dt

s

D

∫ ds0

D

Fast High Accuracy Volume Rendering

43May 2004

Smaller Tables

• 3D tables work, but– take lots of space

– are not very cache coherent

• We could afford much more fidelity in a 2D table.• Consider what happens when we change the

limits of the integrals to range from 0 to 1.

Fast High Accuracy Volume Rendering

44May 2004

Smaller Tables

• Next, we distribute D within the inner integral.

• Notice that this is an algebraic manipulation, not an approximation.

D,τ b ,τ f( ) =1

De

− τ b 1− tD( )+τ f

tD( )dt

s

D

∫ ds0

D

= e−D τ b 1−t( )+τ f t( )dt

s

1

∫ ds0

1

bD,τ fD( ) = e− τ bD 1−t( )+τ f Dt( )dt

s

1

∫ ds0

1

Fast High Accuracy Volume Rendering

45May 2004

Partial Pre-Integration

• Because part of the equation is stored in a table, I dub this technique partial pre-integration.

Problem: The domain is infinite. goes to zero as bD or fD goes to , but not fast enough.

Fast High Accuracy Volume Rendering

46May 2004

Partial Pre-Integration

• Solution: change the variables used to index .

γ≡ DτD+1

Fast High Accuracy Volume Rendering

47May 2004

Partial Pre-Integration

Average Partial Pre-Integration

[Williams98]

Fast High Accuracy Volume Rendering

48May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

49May 2004

Linear Attenuation is Not Always Best

• A user-intuitive transfer function editor presents opacity in the range from completely transparent to completely opaque.– But attenuation ranges

from 0 to infinity.• It also allows the user to

vary the visible opacity linearly.– But linear changes in

attenuation result in exponential changes in visible opacity.

Fast High Accuracy Volume Rendering

50May 2004

Attenuation versus Opacity

• Attenuation relates to the density of the volume.• Opacity is the fraction of light the volume

occludes.• The relationship between the two [Wilhelms91]:

α =1− e−τ

=−ln 1−α( )

Fast High Accuracy Volume Rendering

51May 2004

, linear α

• Solving results in an unwieldy equation.• Rather than try to compute , use approximation.

≈1− 1− 12 α b +α f( )( )

D

Fast High Accuracy Volume Rendering

52May 2004

, linear α

• That’s really close, but there is a tapering at the corners.

• A cross section reveals a parabola-like structure.• Fit a parabola to it to get really close.

≈1− 1− 12 α b +α f( ) − 0.108165 α b +α f( )

2

( )D

Fast High Accuracy Volume Rendering

53May 2004

, linear α

with linear α has no closed form.• Approximate with average α.

α ≈12 α b +α f( )

Fast High Accuracy Volume Rendering

54May 2004

, linear α

• That’s good, but we can do better.

• If αf is greater than αb, should be smaller.

– Weight accordingly.

α ≈0.27α b + 0.73α f

Fast High Accuracy Volume Rendering

55May 2004

Linear α Approximations

Average Initial Approx

Improved Approx

Fast High Accuracy Volume Rendering

56May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

57May 2004

Results, Speed

0

0.2

0.4

0.6

0.8

1

1.2

1.4

Blunt Fin Oxygen Post Delta Wing

Frame Rate (Hz)

Average Color and Attenuation

Linear Color and Attenuation

Partial Pre Integration

Average Color and Opacity

Linear Color, Average Opacity

Linear Color and Opacity Approx

Fast High Accuracy Volume Rendering

58May 2004

Results, Accuracy

Average Partial Pre-Integration [Williams98]

D = 0.001

D = 0.1

D = 1

Fast High Accuracy Volume Rendering

59May 2004

Results, Accuracy

Average Approx 1 Approx 2

D = 0.001

D = 0.1

D = 1

Fast High Accuracy Volume Rendering

60May 2004

Spatial Visualization

• Uniform errors are unlikely to make a difference in visual perception.

Fast High Accuracy Volume Rendering

61May 2004

Spatial Visualization

• Spatial transitions in color are very noticeable.

- -+

- -+

- -+

Fast High Accuracy Volume Rendering

62May 2004

Cell Boundaries

• At cell boundaries, approximation errors can change when the color does not.

Fast High Accuracy Volume Rendering

63May 2004

Results, Cell Boundaries

Uni

form

Att

enua

tion

Bac

kO

paqu

eF

ront

Opa

que

Average Partial Pre-Integration [Williams98]

Uniform

Lum

inanceB

ack Lit

Front L

it

Fast High Accuracy Volume Rendering

64May 2004

Results, Cell Boundaries

Uni

form

Att

enua

tion

Bac

kO

paqu

eF

ront

Opa

que

Uniform

Lum

inanceB

ack Lit

Front L

it

Average Approx 1 Approx 2

Fast High Accuracy Volume Rendering

65May 2004

Overview

• Problem Description• Previous Work• Contributions

– Adaptive Transfer Function Sampling

– Linear Luminance

– Partial Pre-Integration

– Linear Opacity

• Results• Conclusions

Fast High Accuracy Volume Rendering

66May 2004

Conclusions

• Adaptive transfer function sampling functional but slower than expected.– Due to heavy reliance on fragment processor.

– Still competitive with other rendering solutions.

• Partial pre-integration works well.– Visually indistinguishable from [Williams98].

– Over 10X faster.

• Approximations for linear opacity work well.– Nearly as fast as [Wilhelms91].

– No visual artifacts.

Fast High Accuracy Volume Rendering

67May 2004

fin