Computer Graphics - Max Planck...

63
Computer Graphics WS07/08 – Volume Rendering Computer Graphics - Volume Rendering - Hendrik Lensch [a couple of slides thanks to Holger Theisel]

Transcript of Computer Graphics - Max Planck...

Page 1: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Computer Graphics

- Volume Rendering -

Hendrik Lensch

[a couple of slides thanks to Holger Theisel]

Page 2: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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/

Page 3: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 4: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering4

• Examples of volume visualization:

Motivation Volume Rendering

Page 5: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Direct Volume Rendering

Page 6: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Volume Acquisition

Page 7: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering7

Direct Volume Rendering

Page 8: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering8

• Shear-Warp factorization (Lacroute/Levoy 94)

Direct Volume Rendering

Page 9: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering9

voxelsvoxels: represent : represent homogeneous areashomogeneous areas

cells: represent cells: represent inhomogeneous areasinhomogeneous areas

• Cells and voxels

Volume Representations

Page 10: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering10

voxelsvoxels: represent : represent homogeneous areashomogeneous areas

cells: represent cells: represent inhomogeneous areasinhomogeneous areas

• Cells and voxels

Volume Representations

Page 11: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 12: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 13: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering13

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: trilineartrilinear interpolationinterpolation

f100f000

f110f010

f001´ f101

f011 f111

f(x,y,z)

• Cells

Trilinear Interpolation

Page 14: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering14

Let Let ffijkijk = = ff((i,j,ki,j,k) for ) for i,j,ki,j,k∈∈{0,1}. Then the value {0,1}. Then the value ff((x,y,zx,y,z) for a certain point ) for a certain point ((x,y,zx,y,z))∈∈[0,1][0,1]3 3 inside the cell is computed by inside the cell is computed by trilineartrilinear interpolation as:interpolation as:

aa11 = (1= (1--xx)*)*ff000000 + + xx**ff100100aa22 = (1= (1--xx)*)*ff010010 + + xx**ff110110aa33 = (1= (1--xx)*)*ff011011 + + xx**ff111111aa44 = (1= (1--xx)*)*ff001001 + + xx**ff101101aa55 = (1= (1--yy)*)*aa11 + + yy*a*a22aa66 = (1= (1--yy)*)*aa44 + + yy*a*a33

f(x,y,zf(x,y,z)) = (1= (1--zz)*)*aa55 + + zz*a*a66

f100f000

f110f010

f001´ f101

f011 f111

a1

a2

a3

a4

a5

a6

f(x,y,z)

Trilinear Interpolation

Page 15: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Participating Media• Absorption• Emission• In-Scattering• Out-Scattering• Multiple Scattering

Page 16: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

),( ωxL dLxL +),( ω

ds

),(),(),(

),(),(),(

ωωκω

ωωκω

xLxxdsdL

dsxLxxdL

−=

−=

),( ωκ x

],[),()(0

constiffsdttxss

==+= ∫ κκωωκτ

Page 17: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Transparency and Opacity• Integration Along Ray

• Transparency (or Transmittance)

• Opacity

),()(),(),(

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

)(

0

ωωωω

ωωκτωωκω

τ xLsTxLesxL

dttxsandxLxxdsdL

s

s

==+

+=−=

∫ +−− ==s dttxs eesT 0 )()()( ωκτ

)(1)( sTsO −=

Page 18: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Emission• Emission Coefficient q(x,ω)

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

),( ωxL dLxL +),( ω

ds

),(),(

),(),(

ωω

ωω

xqxdsdL

dsxqxdL

=

=

),( ωxq

Page 19: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

),(),(),(),( ωωωκω xqxLxxdsdL

+−=

∫ ∫+∫=+−− s dttdtt

dsesqexLsxLs

s

s

0

)()(')'(),(),( '0

κκωωω

Page 20: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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)

),( ωxL dLxL +),( ω

ds

)(xσ

σκχ +=

σκσ

χσ

+==W

Page 21: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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)

),( ωxL dLxL +),( ω

ds

),( ωσ x

∫= 2),(),,(),(),(

S iiii dxLxpxxj ωωωωωσω

),,( ωωixp

),(),(),( ωωωη xjxqx +=

Page 22: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

2cos143)(cos

λθθ +

=p

∫ =

=

21),,(

41

),,(),,(

S i

ii

dxp

xpxp

ωωωπ

ωωωω

Page 23: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Rayleigh and Mie Scattering

Page 24: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

( ) 232

2

cos21

141)(cos

θπθ

gg

gp−+

−=

θθθππ

∫=0

cos)(cos2 dpg

g= 0.6

g= 0.0

g= -0.3

Page 25: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Summary• Scattering in a volume

Page 26: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Full Volume Rendering • Full Volume Rendering Equation

• Full Volume Rendering Integral

∫++−=∂

∂=∇⋅

2),(),,(),(),(),(),(),(

),(

S iiii

x

dxLxpxxqxLxsxLxL

ωωωωωσωωωχωωω

'),'(),(0

),(' dssxesxL

s dttxs

s ωωηωωωωχ

+∫=+ ∫+−

Attenuation:(absorption &out-scattering)

Source Term:in-scattering,emission,

and background(η(0,ω)= L(x,ω)δ(x))

point xat ),,( zyxx ∂∂

∂∂

∂∂=∇

Page 27: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

( )qsTCsTsL

qeCesL

qdseCesL

qsLssL

ss

s ss

))(1()()(1)(

')(

)()(

0

'

−+=−+=

+=

+−=∂

−−

−− ∫κκ

κκ

κ

S C

Page 28: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering30

Volume VisualizationTwo 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

Page 29: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 30: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering32

view plane view planea) b)

data cube data cube1 2 3

.....

.....

31

24

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 dofor each voxel-ray intersection d

calculate pixel contribution2. Projection of the volume elements onto screen

for each voxel or cell dofor each pixel projected onto do

calculate pixel contribution

Page 31: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering33

There are two ways to evaluate color and transparency properties for raycasting:

equidistant equidistant stepsizestepsize intersection ray / volume element intersection ray / volume element

Raycasting

Page 32: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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)

Page 33: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Steps in Volume Visualization

Page 34: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Volume Processing Pipeline1. Filtering1. Filtering

–– data acquisitiondata acquisition–– data conversiondata conversion–– data completiondata completion–– data reductiondata reduction–– filter operators filter operators

2. Classification2. Classification–– for each volume element the distribution of the containing for each volume element the distribution of the containing

materials is computedmaterials 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 propertiesmultiply the percentage of materials with assigned properties

Page 35: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Transfer Functions

Page 36: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering39

[Kniss et al, 2002]

• 2D Transfer functions:

• make transfer functionsdepend not only on scalarvalue but also on magnitude of the gradient

• emphasizes material boundaries

• strong gradient -> moreopacity

• diminishes homogenuousareas

Transfer Functions

Page 37: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering40

( )Tzyx

T

fffzf

yf

xffgrad ,,,, =⎟⎟

⎞⎜⎜⎝

⎛=

∂∂

∂∂

∂∂

Direct Volume Rendering•• IdeaIdea: collect contributions (using a local lightning model) along a : collect contributions (using a local lightning model) along a

viewing rayviewing ray•• for surface rendering the for surface rendering the normalsnormals are necessary; they can be are necessary; they can be

computed using computed using gradientsgradients. . •• The gradient The gradient gradgrad ff over a scalar function over a scalar function f = f = f(x,y,zf(x,y,z)) is is definieddefinied as:as:

Page 38: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering41

,2

)1,,()1,,(

;2

),1,(),1,(

;2

),,1(),,1(

zz

yy

xx

szyxfzyxfG

szyxfzyxfG

szyxfzyxfG

−−+=

−−+=

−−+=

Gradients express the difference of the data values along the axGradients express the difference of the data values along the axes. es. They are perpendicular to the They are perpendicular to the isosurfacesisosurfaces f(x,y,zf(x,y,z)=const)=const; thus they can ; thus they can

be used to estimate the surface be used to estimate the surface normalsnormals. . For piecewise For piecewise trilineartrilinear scalar fields, gradients are computed using scalar fields, gradients are computed using

central differences: central differences:

where where GGxx, , GGyy and and GGzz are the components of the gradients and are the components of the gradients and ssxx, , ssyy, , sszz is is the the stepsizestepsize along the regular grid in xalong the regular grid in x--, y, y-- and zand z--direction.direction.

Gradients

Page 39: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering42

• 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

Page 40: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 41: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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 transparencyT=1L=0for (s=0; s < 1; s+= ds)

j= σ(s) * p(ω, ωL) * Ls * TSL += T*j*dsT *= (1- Τ(v(s)))

L+= T * L0

DirectionalLighting

Shadow Ray:TS=1for (t=0; t < 1; t+= dt)

TS *= (1- Τ(v(t)))*dt

Page 42: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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)

Page 43: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering47

• Early Ray Termination:check transparency; if beyond certain threshold: stop process;

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

• Discretization of raysdescribe a ray as set of 3D points (artifacts possible)

• 3D distance transformationsper volume element: coding the distance to the next volume element -> skip areas of low interest.

Cost Reduction for Ray Casting

Page 44: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering48

-- first hitfirst hit

Cost Reduction for Composition

Page 45: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering49

•• maximum intensity projectionmaximum intensity projection

Cost Reduction for Composition

Page 46: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering50

– average

Cost Reduction for Composition

Page 47: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 48: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering52

view plane view plane

a) b)

view point

data cubel data cube

Cost Reduction throughTransformation

use paralleluse parallel-- instead perspective projectioninstead perspective projection

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

Page 49: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering54

• Projection and rasterization of cells, Voxels, planes– plane composing– voxel projection– cell projection– shear warp

Projection

Page 50: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering55

• The plane composing (or “slicing”) method, divides the volume into slices.During the rendering process, the slices are composes one over the other, producing the image.

Basic Complexity = VolumeSize

Volume Slicing

Page 51: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 52: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering58

Volume Slicing

Page 53: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering59

Volume Slicing

Page 54: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering60

Volume Slicing

Page 55: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering61

Volume Slicing

Page 56: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering62

Volume Slicing

Page 57: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering63

Volume Slicing

Page 58: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering64

Volume Slicing

Page 59: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering65

Volume Slicing

Page 60: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering66

Volume Slicing

Page 61: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering67

Volume Slicing

Page 62: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

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

Page 63: Computer Graphics - Max Planck Societyresources.mpi-inf.mpg.de/departments/d4/teaching/ws200708/cg/sli… · Computer Graphics WS07/08 – Volume Rendering Indirect Volume Rendering

Computer Graphics WS07/08 – Volume Rendering

Context Aware Volume Rendering

[Bruckner & Groeller 2005]