Direct Volume Rendering Han-Wei Shen The Ohio State University - - PowerPoint PPT Presentation

direct volume rendering
SMART_READER_LITE
LIVE PREVIEW

Direct Volume Rendering Han-Wei Shen The Ohio State University - - PowerPoint PPT Presentation

Direct Volume Rendering Han-Wei Shen The Ohio State University Volume Rendering A method to visualize the en?re 3D data set by simula?ng light transport across the volume A 2D projec?on of 3D discrete samples Direct Volume Rendering


slide-1
SLIDE 1

Direct Volume Rendering

Han-Wei Shen The Ohio State University

slide-2
SLIDE 2

Volume Rendering

  • A method to visualize the en?re 3D data set by

simula?ng light transport across the volume

  • A 2D projec?on of 3D discrete samples
slide-3
SLIDE 3

Direct Volume Rendering

  • Simulate light transport through a con?nuous volume
  • Data are interpolated from the samples at the grid points
  • Op?cal proper?es such as colors and opaci?es are assigned to

the interpolated data

  • Op?cal proper?es must be integrated along each viewing ray

c2 c3 c1

X

slide-4
SLIDE 4

What will we cover?

  • Part 1: Op?cal Model

– hLps://www.youtube.com/watch?v=hiaHlTLN9TE

  • Part 2: Discrete Implementa?on

– hLps://www.youtube.com/watch?v=M5WHEkbGhEE

  • Part 3: Live Demo and Try Yourself

– hLps://www.youtube.com/watch?v=IqIvK6EiBz8

slide-5
SLIDE 5

Op?cal Model

  • Absorp?on Model
  • Emission Model
  • Absorp?on + Emission

Par?cipa?ng medium (the voxels) can absorb, emit, or both absorb and emit light How much light will reach the eye?

slide-6
SLIDE 6

Absorp?on Only

  • The simplest par?cipa?ng medium
  • Consists of perfectly black par?cles that absorb all

the light that they intercept

  • Assume

– A small cylindrical slab with a base area E and thickness Δs – Number of par?cles per unit volume = ρ – each par?cle has an area of A = πr2 E Δs A = πr2

  • Total number of par?cles = E Δs ρ
  • Total area occluded by par?cles = A E Δs ρ
  • The frac?on of occluded area = AEΔsρ / E = A Δs ρ

Solve this ODE d I(s) ds = - I(s) x A Δs ρ(s) = - A ρ (s) I(s) Δs

slide-7
SLIDE 7

Absorp?on Only

  • The simplest par?cipa?ng medium
  • Consists of perfectly black par?cles that absorb all

the light that they intercept

  • Assume

– A small cylindrical slab with a base area E and thickness Δs – Number of par?cles per unit volume = ρ – each par?cle has an area of A = πr2 E Δs A = πr2

dI ds = - A ρ (s) I(s) Solve this ODE

I(s) = I0 × e−

R s

0 ρ(t)Adt = I0 × e−

R s

0 τ(t)dt

slide-8
SLIDE 8

Absorp?on Only

E Δs A = πr2

ρ(t)A = τ(t)

: ex?nc?on coefficient

I0 = Ini?al light intensity I0 Can be seen as the transparency, or 1 – opacity of the medium from 0 to s

I(s) = I0 × e−

R s

0 ρ(t)Adt = I0 × e−

R s

0 τ(t)dt

e−

R s

0 τ(t)dt

slide-9
SLIDE 9

Emission Only

  • Each par?cle will glow diffusively with an intensity C
  • In a small cylindrical slab, the

total area occupied by the par?cles is AEΔsρ

  • So the glow flux will be CAEΔsρ
  • Then the glow per unit area is CAEΔsρ /E = CAΔsρ

E Δs A = πr2

dI ds = C(s) A ρ(s) = C(s)τ(s) = g(s) Solve this ODE

slide-10
SLIDE 10

Emission Only

  • Each par?cle will glow diffusively with an intensity C
  • In a small cylindrical slab, the

total area occupied by the par?cles is AEΔsρ

  • So the glow flux will be CAEΔsρ
  • Then the glow per unit area is CAEΔsρ /E = CAΔsρ

dI ds = C(s) A ρ(s) = C(s)τ(s) = g(s) Solve this ODE

I(s) = I0 + Z s g(t)dt = I0 + Z s C(t)τ(t)dt

E Δs A = πr2

slide-11
SLIDE 11

Emission plus Absorp?on

  • Simply add emission and absorp?on together

dI ds

= C(s)τ(s) - A ρ (s) I(s) = g(s) – τ(s)I(s)

E Δs A = πr2

Solve this ODE

I(D) = I0 × e−

R D τ(t)dt +

Z

D 0 g(s)e− R D

s

τ(t)dtds

emission absorp?on

I0

S = 0 S = D

slide-12
SLIDE 12

Put It All Together

  • Absorp?on only:
  • Emission only:
  • Emission plus absorp?on:

I(s) = I0 × e−

R s

0 ρ(t)Adt = I0 × e−

R s

0 τ(t)dt

I(s) = I0 + Z s g(t)dt = I0 + Z s C(t)τ(t)dt

I(D) = I0 × e−

R D τ(t)dt +

Z

D 0 g(s)e− R D

s

τ(t)dtds

I0

S = 0 S = D

slide-13
SLIDE 13

Look More Closely

I(D) = I0 × e−

R D τ(t)dt +

Z

D 0 g(s)e− R D

s

τ(t)dtds

I0

: background light

τ(t) : ex?nc?on coefficient at t , related to the rate that light is occluded

D

: total distance light will travel

e−

R D τ(t)dt : transparency of medium between 0 and D

1 − e−

R D τ(t)dt = α : opacity of medium between 0 and D

g(s)

: source term at point s, typically derived from the data value

I0

S = 0 S = D

slide-14
SLIDE 14

Discrete Implementa?on

  • Numerical integra?on:

Δx = Xi – Xi-1 X0 X1 X2 X3 X4 X5 …

Z D h(x)dx =

i=n

X

i=1

h(xi)∆x

(Riemann Sum)

e−

R D τ(t)dt = e− Pi=n

i=1 τ(tt)∆t

= e− Pi=n

i=1 τ(i∆x)∆x =

Y e−τ(i∆x)∆x

=

i=n

Y

i=1

(1 − αi)

(Remember )

1 − e−

R D τ(t)dt = α

i

slide-15
SLIDE 15

Discrete Implementa?on

I(D) = I0 × e−

R D τ(t)dt +

Z

D 0 g(s)e− R D

s

τ(t)dtds

I0

i=n

Y

i=1

(1 − αi)

i=n

X

i=1

gi ×

n

Y

j=i+1

(1 − αi)

I0

S = 0 S = D g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 … α1 α2 α3 α4 α5 α6 α7 α8 α9 α10 …

= gn + (1-αn)(gn-1+(1-αn-1)(gn-2+ (1-αn-2(…. (1-α2)(g2+(1-α1)(g1+I0)))))…)))))

This is called - Back to Front Composi?ng

slide-16
SLIDE 16

Discrete Implementa?on

I(D) = I0 × e−

R D τ(t)dt +

Z

D 0 g(s)e− R D

s

τ(t)dtds

I0

i=n

Y

i=1

(1 − αi)

i=n

X

i=1

gi ×

n

Y

j=i+1

(1 − αi)

I0

S = 0 S = D g1 g2 g3 g4 g5 g6 g7 g8 g9 g10 … α1 α2 α3 α4 α5 α6 α7 α8 α9 α10 …

= gn + (1-αn)(gn-1+(1-αn-1)(gn-2+ (1-αn-2(…. (1-α2)(g2+(1-α1)(g1+I0)))))…)))))

( )

slide-17
SLIDE 17

Ray Cas?ng Algorithm

  • For each pixel

– Cast a ray into the volume – Linearly interpolate data values from cell (voxel) corners – Convert the data values to op?cal proper?es (color and opacity) – Composite the op?cal proper?es – Return the final color

X

g1 g2 g3

slide-18
SLIDE 18

Shading and Classifica?on

  • Shading: computer a color for every sample in the

volume

  • Classifica?on: computer an opacity for every

sample in the volume

  • This is ooen done through a table (transfer

func?on) lookup

f(xi) c(xi), a(xi)

slide-19
SLIDE 19

Shading

  • Use the Phong illumina?on model

illumina?on = ambient + diffuse + specular

θ θ Sample i φ V R N L

= C(xi) x Ia + C(xi) x Id x (N.L) + C(xi) x Is x (R.V)n

C(xi) : color of sample i Ia, Id, Is: light’s ambient, diffuse, and specular colors (usually set as white) N: normal at sample i V: vector from sample point to eye L: light vector, from sample to light source R: reflec?on vector of light vector n: shininess

slide-20
SLIDE 20

Normal Es?ma?on

  • How to compute the sample normal N?

– Normal: a vector that is perpendicular to the local surface, which is the gradient of the sample point

  • 1. Compute the gradient G at the cell corners using central

difference

  • 2. Linearly interpolate the gradients
slide-21
SLIDE 21

Classifica?on

  • Classifica?on: mapping from data values to opaci?es

– Region of interest: high opacity – Rest: translucent or transparent

  • The opacity func?on, or called transfer func?on, is

given by the user

I(D) = I0 × e−

R D τ(t)dt +

Z

D 0 g(s)e− R D

s

τ(t)dtds

I0

i=n

Y

i=1

(1 − αi)

i=n

X

i=1

gi ×

n

Y

j=i+1

(1 − αi)

slide-22
SLIDE 22

Ray Sampling

c1 c2 c3

  • Sample the volume at discrete

points along the ray

  • Perform tri-linear interpola?on to get

the sample values

  • Look up the transfer func?on to

get the color and opacity

  • Composi?ng the color/opacity

(front-to-back or back-to-front)

slide-23
SLIDE 23

Back-to-Front Composi?ng

c1 c2 c3

The ini?al pixel color = Black Back-to-Front composi?ng: use ‘under’ operator C = C1 ‘under’ background C = C2 ‘under’ C C = C3 ‘under’ C … Cout = Cin * (1-α(x)) + C(x)*α(x) (this is the alpha blending formula)

slide-24
SLIDE 24

c1 c2 c3

Front-to-Back composi?ng: use ‘over’ operator C = background ‘over’ C1 C = C ‘over’ C2 C = C ‘over’ C3 … Cout = Cin + C(x) α(x) *(1- αin); αout = αin + α(x) *(1-αin)

Front-to-Back Composi?ng

slide-25
SLIDE 25

pos dir

c2 c3 c1

X

Put Everything Together

RGBA Ray-Cas?ng(pos, dir) { color_acc = 0;

  • pacity_acc = 0;

t = entry_pos; max_t = exit_pos; while (t < max_t) { sample = get_sample(pos+dir*t); color, opacity = trans_func(sample); color_acc += (1-opacity_acc)*color*opacity;

  • pacity_acc += (1-opacity_acc)*opacity;

t++; } return color_acc, opacity_acc; }

slide-26
SLIDE 26

Live Demo and Try Yourself

slide-27
SLIDE 27

Live Demo and Try Yourself

  • Want to try yourself?

– ParaView:

  • hLps://www.paraview.org/download/

– Volume Data:

  • hLp://www9.informa?k.uni-erlangen.de/External/vollib/

– WebGL implementa?ons of volume rendering:

  • hLp://www.lebarba.com/WebGL/Index.html
  • hLps://github.com/FNNDSC/ami