Computer Graphics - Volume Rendering - Hendrik Lensch [a couple of - - PowerPoint PPT Presentation

computer graphics
SMART_READER_LITE
LIVE PREVIEW

Computer Graphics - Volume Rendering - Hendrik Lensch [a couple of - - PowerPoint PPT Presentation

Computer Graphics - Volume Rendering - Hendrik Lensch [a couple of slides thanks to Holger Theisel] Computer Graphics WS07/08 Volume Rendering Overview Last Week Subdivision Surfaces on Sunday Ida Helene Today


slide-1
SLIDE 1

Computer Graphics WS07/08 – Volume Rendering

Computer Graphics

  • Volume Rendering -

Hendrik Lensch [a couple of slides thanks to Holger Theisel]

slide-2
SLIDE 2

Computer Graphics WS07/08 – Volume Rendering 2

Overview

  • Last Week

– Subdivision Surfaces

  • on Sunday

– Ida Helene

  • Today

– Volume Rendering

  • until tomorrow: Evaluate this lecture on

http://frweb.cs.uni-sb.de/03.Studium/08.Eva/

slide-3
SLIDE 3

Computer Graphics WS07/08 – Volume Rendering

Motivation

  • Applications

– Fog, smoke, clouds, fire, water, … – Scientific/medical visualization: CT, MRI – Simulations: Fluid flow, temperature, weather, ... – Subsurface scattering

  • Effects in Participating Media

– Absorption – Emission – Scattering

  • Out-scattering
  • In-scattering
  • Literature

– Klaus Engel et al., Real-time Volume Graphics, AK Peters – Paul Suetens, Fundamentals of Medical Imaging, Cambridge University Press

slide-4
SLIDE 4

Computer Graphics WS07/08 – Volume Rendering 4

  • Examples of volume visualization:

Motivation Volume Rendering

slide-5
SLIDE 5

Computer Graphics WS07/08 – Volume Rendering

Direct Volume Rendering

slide-6
SLIDE 6

Computer Graphics WS07/08 – Volume Rendering

Volume Acquisition

slide-7
SLIDE 7

Computer Graphics WS07/08 – Volume Rendering 7

Direct Volume Rendering

slide-8
SLIDE 8

Computer Graphics WS07/08 – Volume Rendering 8

  • Shear-Warp

factorization (Lacroute/Levoy 94)

Direct Volume Rendering

slide-9
SLIDE 9

Computer Graphics WS07/08 – Volume Rendering 9

voxels voxels: represent : represent homogeneous areas homogeneous areas cells: represent cells: represent inhomogeneous areas inhomogeneous areas

  • Cells and voxels

Volume Representations

slide-10
SLIDE 10

Computer Graphics WS07/08 – Volume Rendering 10

voxels voxels: represent : represent homogeneous areas homogeneous areas cells: represent cells: represent inhomogeneous areas inhomogeneous areas

  • Cells and

voxels

Volume Representations

slide-11
SLIDE 11

Computer Graphics WS07/08 – Volume Rendering

Volume Representations

  • Simple shapes with procedural solid texture

– Ellipsoidal clouds with sum-of-sines densities – Hypertextures [Perlin]

  • 3D array

– Regular (uniform) or rectilinear (rectangular) – CT, MRI

  • 3D meshes

– Curvilinear grid (mapping of regular grid to 3D)

  • “Computational space” is uniform grid
  • “Physical space“ is distorted
  • Must map between them (through Jacobian)

– Unstructured meshes

  • Point clouds
  • Often tesselated into

tetrahedral mesh)

Curvilinear grid

slide-12
SLIDE 12

Computer Graphics WS07/08 – Volume Rendering

  • Rectilinear Grid:

– Wald et al. – Implicit kd-trees

  • Curvilinear Grid:

– Warped Rectilinear Grid – Hexahedral cells

  • Unstructured Mesh:

– Tetrahedral cells

Volume Organization

slide-13
SLIDE 13

Computer Graphics WS07/08 – Volume Rendering 13

Data values inside a cell have to be computed by interpolation. Data values inside a cell have to be computed by interpolation. Most common interpolation for cells: Most common interpolation for cells: trilinear trilinear interpolation interpolation

f100 f000 f110 f010 f001´ f101 f011 f111 f(x,y,z)

  • Cells

Trilinear Interpolation

slide-14
SLIDE 14

Computer Graphics WS07/08 – Volume Rendering 14

Let Let f fijk

ijk =

= f f( (i,j,k i,j,k) for ) for i,j,k i,j,k∈ ∈{0,1}. Then the value {0,1}. Then the value f f( (x,y,z x,y,z) for a certain point ) for a certain point ( (x,y,z x,y,z) )∈ ∈[0,1] [0,1]3

3 inside the cell is computed by

inside the cell is computed by trilinear trilinear interpolation as: interpolation as: a a1

1 = (1

= (1-

  • x

x)* )*f f000

000 +

+ x x* *f f100

100

a a2

2 = (1

= (1-

  • x

x)* )*f f010

010 +

+ x x* *f f110

110

a a3

3 = (1

= (1-

  • x

x)* )*f f011

011 +

+ x x* *f f111

111

a a4

4 = (1

= (1-

  • x

x)* )*f f001

001 +

+ x x* *f f101

101

a a5

5 = (1

= (1-

  • y

y)* )*a a1

1

+ + y y*a *a2

2

a a6

6 = (1

= (1-

  • y

y)* )*a a4

4

+ + y y*a *a3

3

f(x,y,z f(x,y,z) ) = (1 = (1-

  • z

z)* )*a a5

5

+ + z z*a *a6

6

f100 f000 f110 f010 f001´ f101 f011 f111 a1 a2 a3 a4 a5 a6 f(x,y,z)

Trilinear Interpolation

slide-15
SLIDE 15

Computer Graphics WS07/08 – Volume Rendering

Participating Media

  • Absorption
  • Emission
  • In-Scattering
  • Out-Scattering
  • Multiple Scattering
slide-16
SLIDE 16

Computer Graphics WS07/08 – Volume Rendering

Absorption

  • Absorption Coefficient κ(x,ω)

– Probability of a photon being absorbed at x in direction ω per unit length – Optical depth τ of a material of thickness s

  • Physical interpretation:

– Measure for how far light travels before being absorbed

) , ( ω x L dL x L + ) , ( ω

ds

) , ( ) , ( ) , ( ) , ( ) , ( ) , ( ω ω κ ω ω ω κ ω x L x x ds dL ds x L x x dL − = − =

) , ( ω κ x

] , [ ) , ( ) ( const iff s dt t x s

s

= = + = ∫ κ κ ω ω κ τ

slide-17
SLIDE 17

Computer Graphics WS07/08 – Volume Rendering

Transparency and Opacity

  • Integration Along Ray
  • Transparency (or Transmittance)
  • Opacity

) , ( ) ( ) , ( ) , ( ) , ( ) ( ) , ( ) , ( ) , (

) (

ω ω ω ω ω ω κ τ ω ω κ ω

τ

x L s T x L e s x L dt t x s and x L x x ds dL

s s

= = + + = − =

∫ + − −

= =

s

dt t x s

e e s T

) ( ) (

) (

ω κ τ

) ( 1 ) ( s T s O − =

slide-18
SLIDE 18

Computer Graphics WS07/08 – Volume Rendering

Emission

  • Emission Coefficient q(x,ω)

– Number of photons being emitted at x in direction ω per unit length

) , ( ω x L dL x L + ) , ( ω

ds

) , ( ) , ( ) , ( ) , ( ω ω ω ω x q x ds dL ds x q x dL = =

) , ( ω x q

slide-19
SLIDE 19

Computer Graphics WS07/08 – Volume Rendering

Emission-Absorption Model

  • Emission-Absorption Model

– Kombines absorption and emission only

  • Volume Rendering Equation

– In differential form

  • Volume Rendering Integral

– Incoming light is absorbed along the entire segment – Emitted light is only absorbed along the remaining segment – Must integrate over emission along the entire segment

) , ( ) , ( ) , ( ) , ( ω ω ω κ ω x q x L x x ds dL + − =

∫ + ∫ = +

− − s dt t dt t

ds e s q e x L s x L

s s s

) ( ) (

' ) ' ( ) , ( ) , (

'

κ κ

ω ω ω

slide-20
SLIDE 20

Computer Graphics WS07/08 – Volume Rendering

Out-Scattering

  • Scattering cross-section σ(x,ω)

– Probability of a photon being scattered out of direction per unit length – Total absorption (extinction): true absorption plus out-scattering – Albedo (“Weißheit”, measure for reflectivity or ability to scatter)

) , ( ω x L dL x L + ) , ( ω

ds

) (x σ

σ κ χ + = σ κ σ χ σ + = = W

slide-21
SLIDE 21

Computer Graphics WS07/08 – Volume Rendering

In-Scattering

  • Scattering cross-section σ(x,ω)

– Number of photons being scattered into path per unit length – Depend on scattering coefficient (probability of being scattered) and the phase function (directional distribution of out-scattering events) – Total Emission: true emission q plus in-scattering j – Phase function (essentially the BRDF for volumes)

) , ( ω x L dL x L + ) , ( ω

ds

) , ( ω σ x

=

2

) , ( ) , , ( ) , ( ) , (

S i i i i

d x L x p x x j ω ω ω ω ω σ ω ) , , ( ω ωi x p ) , ( ) , ( ) , ( ω ω ω η x j x q x + =

slide-22
SLIDE 22

Computer Graphics WS07/08 – Volume Rendering

Phase Functions

  • Phase angle is often only relative to incident direction

– cos θ = ω⋅ω'

  • Reciprocity and energy conservation
  • Phase functions

– Isotropic – Rayleigh (small molecules)

  • Strong wavelength dependence

– Mie scattering (larger spherical particles) ω ω’

1 ) (cos = θ p

4 2

cos 1 4 3 ) (cos λ θ θ + = p

= =

2

1 ) , , ( 4 1 ) , , ( ) , , (

S i i i

d x p x p x p ω ω ω π ω ω ω ω

slide-23
SLIDE 23

Computer Graphics WS07/08 – Volume Rendering

Rayleigh and Mie Scattering

slide-24
SLIDE 24

Computer Graphics WS07/08 – Volume Rendering

Henyey-Greenstein Phase Function

  • Empirical Phase Function

– Often used for interstellar clouds, tissue, and similar material – Average cosine of phase angle

( ) 2

3 2 2

cos 2 1 1 4 1 ) (cos θ π θ g g g p − + − = θ θ θ π

π

= cos ) (cos 2 d p g

g= 0.6 g= 0.0 g= -0.3

slide-25
SLIDE 25

Computer Graphics WS07/08 – Volume Rendering

Summary

  • Scattering in a volume
slide-26
SLIDE 26

Computer Graphics WS07/08 – Volume Rendering

Full Volume Rendering

  • Full Volume Rendering Equation
  • Full Volume Rendering Integral

+ + − = ∂ ∂ = ∇ ⋅

2

) , ( ) , , ( ) , ( ) , ( ) , ( ) , ( ) , ( ) , (

S i i i i x

d x L x p x x q x L x s x L x L ω ω ω ω ω σ ω ω ω χ ω ω ω

' ) , ' ( ) , (

) , (

'

ds s x e s x L

s dt t x

s s

ω ω η ω ω

ω ω χ

+ ∫ = +

+ −

Attenuation: (absorption &

  • ut-scattering)

Source Term: in-scattering,emission, and background (η(0,ω)= L(x,ω)δ(x))

point x at ) , , ( z y x

x

∂ ∂ ∂ ∂ ∂ ∂ = ∇

slide-27
SLIDE 27

Computer Graphics WS07/08 – Volume Rendering

Simple Atmosphere Model

  • Assumptions

– Homogeneous media (κ = const) – Constant source term q (ambient illumination)

  • Fog and Haze (in OpenGL)

– Affine combination of background and fog color – Depending on distance

( )

q s T C s T s L q e C e s L qds e C e s L q s L s s L

s s s s s

)) ( 1 ( ) ( ) ( 1 ) ( ' ) ( ) ( ) (

'

− + = − + = + = + − = ∂ ∂

− − − −

κ κ κ κ

κ

S C

slide-28
SLIDE 28

Computer Graphics WS07/08 – Volume Rendering 30

Volume Visualization

Two ways of graphical representation of volume data 1) extracting geometry

  • > Isosurfaces
  • > different extraction approaches
  • > Most famous: Marching Cubes

2) direct rendering of the whole volume (direct volume rendering)

  • > here in more detail
slide-29
SLIDE 29

Computer Graphics WS07/08 – Volume Rendering

Indirect Volume Rendering

  • Iso-Surfaces

– Compute iso-surface for v(x,y,z)= C and shade as normal

  • Ray Tracing

– Intersect ray with cubic surface defined by values at vertices – Several accurate and/or fast algorithms

  • Marching Cubes algorithm

– Iterate over all voxels – Classify voxel into 15 classes (by symmetry) surface topology – Compute vertex location by interpolation – Render as triangle mesh

slide-30
SLIDE 30

Computer Graphics WS07/08 – Volume Rendering 32 view plane view plane

a) b)

data cube data cube 1 2 3 ..... ..... 3 1 2 4

Raycarsting vs. Projection

  • Two Methods for Direct volume rendering

1. Raycasting (send a ray through the data volume; evaluation of the color distribution concerning the hit volume elements)

for each ray do for each voxel-ray intersection d calculate pixel contribution

2. Projection of the volume elements onto screen

for each voxel or cell do for each pixel projected onto do calculate pixel contribution

slide-31
SLIDE 31

Computer Graphics WS07/08 – Volume Rendering 33

There are two ways to evaluate color and transparency properties for raycasting: equidistant equidistant stepsize stepsize intersection ray / volume element intersection ray / volume element

Raycasting

slide-32
SLIDE 32

Computer Graphics WS07/08 – Volume Rendering

Transfer Functions

  • Classification using transfer functions

– Map value given in the volume to optical properties – Typical: One-dimensional transfer functions

  • κ(x,ω)= Tκ(v(x)) and q(x,ω)= Tq(v(x))

– Multidimensional transfer functions

  • Depend on value v(x) and its gradient grad(v(x))
  • κ(x,ω)= Tκ(v(x), grad(v(x))) and q(x,ω)= Tq(v(x), grad(v(x)))
  • When to apply them

– Before (pre-) or after (post-classification) interpolation? – Post-classification is more appropriate

  • Transfer function generally modifies frequency spectrum of volume
  • Sampling of volume is chosen according to data not for any high-

frequency modulation of it

  • Pre-Integrated Transfer Functions

– Assume linear interpolation of κ and q inside small segments – Precompute integral value for all tuples (v0,v1,∆s)

slide-33
SLIDE 33

Computer Graphics WS07/08 – Volume Rendering

Steps in Volume Visualization

slide-34
SLIDE 34

Computer Graphics WS07/08 – Volume Rendering

Volume Processing Pipeline

  • 1. Filtering
  • 1. Filtering

– – data acquisition data acquisition – – data conversion data conversion – – data completion data completion – – data reduction data reduction – – filter operators filter operators

  • 2. Classification
  • 2. Classification

– – for each volume element the distribution of the containing for each volume element the distribution of the containing materials is computed materials is computed – – for each material transparency and color is specified for each material transparency and color is specified – – multiply the percentage of materials with assigned properties multiply the percentage of materials with assigned properties

slide-35
SLIDE 35

Computer Graphics WS07/08 – Volume Rendering

Transfer Functions

slide-36
SLIDE 36

Computer Graphics WS07/08 – Volume Rendering 39

[Kniss et al, 2002]

  • 2D Transfer functions:
  • make transfer functions

depend not only on scalar value but also on magnitude of the gradient

  • emphasizes material

boundaries

  • strong gradient -> more
  • pacity
  • diminishes homogenuous

areas

Transfer Functions

slide-37
SLIDE 37

Computer Graphics WS07/08 – Volume Rendering 40

( )

T z y x T

f f f z f y f x f f grad , , , , = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ = ∂ ∂ ∂ ∂ ∂ ∂

Direct Volume Rendering

  • Idea

Idea: collect contributions (using a local lightning model) along a : collect contributions (using a local lightning model) along a viewing ray viewing ray

  • for surface rendering the

for surface rendering the normals normals are necessary; they can be are necessary; they can be computed using computed using gradients gradients. .

  • The gradient

The gradient grad grad f f over a scalar function

  • ver a scalar function f =

f = f(x,y,z f(x,y,z) ) is is definied definied as: as:

slide-38
SLIDE 38

Computer Graphics WS07/08 – Volume Rendering 41

, 2 ) 1 , , ( ) 1 , , ( ; 2 ) , 1 , ( ) , 1 , ( ; 2 ) , , 1 ( ) , , 1 (

z z y y x x

s z y x f z y x f G s z y x f z y x f G s z y x f z y x f G − − + = − − + = − − + =

Gradients express the difference of the data values along the ax Gradients express the difference of the data values along the axes. es. They are perpendicular to the They are perpendicular to the isosurfaces isosurfaces f(x,y,z f(x,y,z)=const )=const; thus they can ; thus they can be used to estimate the surface be used to estimate the surface normals normals. . For piecewise For piecewise trilinear trilinear scalar fields, gradients are computed using scalar fields, gradients are computed using central differences: central differences: where where G Gx

x,

, G Gy

y and

and G Gz

z are the components of the gradients and

are the components of the gradients and s sx

x,

, s sy

y,

, s sz

z is

is the the stepsize stepsize along the regular grid in x along the regular grid in x-

  • , y

, y-

  • and z

and z-

  • direction.

direction.

Gradients

slide-39
SLIDE 39

Computer Graphics WS07/08 – Volume Rendering 42

  • Properties:

– No binary classification – Show small details – Compute complexity depends on volume size; but parallelization possible; – combination with geometrical data not trivial, no traditional rendering

Direct Volume Rendering

slide-40
SLIDE 40

Computer Graphics WS07/08 – Volume Rendering

Compositing Along a Ray

  • Incremental compositing algorithm

– As seen from the viewer (sn is at front)

  • Two Approaches

– Front to back (start at sn) and back to front (start at s0) – Accumulate color and opacity

  • Algorithm (front to back)

– Allows for early ray termination – C = Cn, α=0 (Opacity) – for (i=n-1; i >= 0; i--) – C += (1-α)*ci – α += (1-α)(1-Ti) – if (α > threshold) break – C+= (1-α)Cbackground

– Algorithm (back to front)

  • Does not allow for termination
  • C = Cbackground
  • for (i=0; i <= n; i++)
  • C= (1-Ti)C + ci
slide-41
SLIDE 41

Computer Graphics WS07/08 – Volume Rendering

Single Scattering

  • Single scattering approximation

– Compute illumination via shadow ray

  • Accumulate transparency along the way
  • Multiply with scattering coefficient,

phase function, and light radiance

– Accumulate front to back

  • Illumination from light source
  • Weight with transparency
  • Accumulate transparency

– Add background illumination times transparency T=1 L=0 for (s=0; s < 1; s+= ds) j= σ(s) * p(ω, ωL) * Ls * TS L += T*j*ds T *= (1- Τ(v(s))) L+= T * L0 Directional Lighting Shadow Ray: TS=1 for (t=0; t < 1; t+= dt) TS *= (1- Τ(v(t)))*dt

slide-42
SLIDE 42

Computer Graphics WS07/08 – Volume Rendering

Multiple Scattering

  • Highly computationally demanding

– Zonal method (FE-Technique) [Rushmeier’87]

  • Assume constant, isotropic scattering in voxels
  • Set up linear system (a la radiosity) and solve numerically
  • Also includes surface interactions (SS, SV, VS, VV)

– P-N (PN) method [Kajiya’84]

  • Represent light distribution at each point in Spherical Harmonics (SH)
  • Compute interactions of SH-coefficients an solve numerically

– Discrete Ordinate method [Languénou’95]

  • Choose M fixed directions to redistribute energy in
  • Can generate “ray effects” due to fixed directions

– Should distribute in solid angle

– Diffusion process [Stam’95]

  • Assumes optically dense medium much scattering uniform diffusion
  • Recently also used for sub-surface scattering approximation
  • E.g. computes Point Spread Function (PSF)
slide-43
SLIDE 43

Computer Graphics WS07/08 – Volume Rendering 47

  • Early Ray Termination:

check transparency; if beyond certain threshold: stop process;

  • Increase number of sent rays adaptively

Ray is sent for group of pixels, i.e. 3*3; if values of adjacent rays differ significantly: additional rays are sent.

  • Discretization of rays

describe a ray as set of 3D points (artifacts possible)

  • 3D distance transformations

per volume element: coding the distance to the next volume element -> skip areas of low interest.

Cost Reduction for Ray Casting

slide-44
SLIDE 44

Computer Graphics WS07/08 – Volume Rendering 48

  • first hit

first hit

Cost Reduction for Composition

slide-45
SLIDE 45

Computer Graphics WS07/08 – Volume Rendering 49

  • maximum intensity projection

maximum intensity projection

Cost Reduction for Composition

slide-46
SLIDE 46

Computer Graphics WS07/08 – Volume Rendering 50

– average

Cost Reduction for Composition

slide-47
SLIDE 47

Computer Graphics WS07/08 – Volume Rendering

  • Rendering Volume Data

– Isosurface Rendering (implicit surface) – Maximum-Intensity-Projection

  • Render the larges volume value along a ray

– Direct or Emission-Absorption Volume Rendering (x-ray)

Isosurface Rendering Maximum-Intensity-P. E-A Volume Rendering

Volume Visualization Techniques

slide-48
SLIDE 48

Computer Graphics WS07/08 – Volume Rendering 52

view plane view plane

a) b)

view point data cubel data cube

Cost Reduction through Transformation

use parallel use parallel-

  • instead perspective projection

instead perspective projection

  • Transform the data volume such that rays are parallel to coordin

Transform the data volume such that rays are parallel to coordinate ate axes. axes.

slide-49
SLIDE 49

Computer Graphics WS07/08 – Volume Rendering 54

  • Projection and rasterization of cells, Voxels, planes

– plane composing – voxel projection – cell projection – shear warp

Projection

slide-50
SLIDE 50

Computer Graphics WS07/08 – Volume Rendering 55

  • The plane composing (or “slicing”) method, divides the volume into

slices. During the rendering process, the slices are composes one over the

  • ther, producing the image.

Basic Complexity = VolumeSize

Volume Slicing

slide-51
SLIDE 51

Computer Graphics WS07/08 – Volume Rendering

Volume Rendering on GPU

  • Volume Rendering with 3D-Textures

– Given volume data set as 3D texture – Slice bounding box of 3D texture with planes parallel to viewing plane – Render with back to front approach

  • With compositing set appropriately (does not need Alpha buffer)
  • FB_color = FB_color * (1-fragment_alpha) + fragment_color
  • Using 2D Texture

– Same technique but use 2D slices of of volume directly – Needs three copies (xy, xz, yz) to always use best orientation

slide-52
SLIDE 52

Computer Graphics WS07/08 – Volume Rendering 58

Volume Slicing

slide-53
SLIDE 53

Computer Graphics WS07/08 – Volume Rendering 59

Volume Slicing

slide-54
SLIDE 54

Computer Graphics WS07/08 – Volume Rendering 60

Volume Slicing

slide-55
SLIDE 55

Computer Graphics WS07/08 – Volume Rendering 61

Volume Slicing

slide-56
SLIDE 56

Computer Graphics WS07/08 – Volume Rendering 62

Volume Slicing

slide-57
SLIDE 57

Computer Graphics WS07/08 – Volume Rendering 63

Volume Slicing

slide-58
SLIDE 58

Computer Graphics WS07/08 – Volume Rendering 64

Volume Slicing

slide-59
SLIDE 59

Computer Graphics WS07/08 – Volume Rendering 65

Volume Slicing

slide-60
SLIDE 60

Computer Graphics WS07/08 – Volume Rendering 66

Volume Slicing

slide-61
SLIDE 61

Computer Graphics WS07/08 – Volume Rendering 67

Volume Slicing

slide-62
SLIDE 62

Computer Graphics WS07/08 – Volume Rendering

Volumes and Surfaces

  • Interactions

– Surface/Volume

  • Intersect with surfaces ray segment
  • Perform volume rendering along segment
  • Add contribution from surface
  • Must handle surfaces within volumes correctly

– Volume/Volume

  • Parallel traversal necessary if volumes overlap

– Opacity combines from both volumes

  • Comparison

– Surfaces:

  • Complex traversal operations
  • Single intersection per ray few complex shading operations

– Volumes

  • Often simple traversal
  • Constantly shading but often simple shading algorithms
slide-63
SLIDE 63

Computer Graphics WS07/08 – Volume Rendering

Context Aware Volume Rendering

[Bruckner & Groeller 2005]