Volume Rendering
Total Page:16
File Type:pdf, Size:1020Kb
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 – Volume Rendering • until tomorrow: Evaluate this lecture on http://frweb.cs.uni-sb.de/03.Studium/08.Eva/ Computer Graphics WS07/08 – Volume Rendering 2 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 Computer Graphics WS07/08 – Volume Rendering Motivation Volume Rendering • Examples of volume visualization: 4 Computer Graphics WS07/08 – Volume Rendering Direct Volume Rendering Computer Graphics WS07/08 – Volume Rendering Volume Acquisition Computer Graphics WS07/08 – Volume Rendering Direct Volume Rendering 7 Computer Graphics WS07/08 – Volume Rendering Direct Volume Rendering • Shear-Warp factorization (Lacroute/Levoy 94) 8 Computer Graphics WS07/08 – Volume Rendering Volume Representations • Cells and voxels voxels: represent cells: represent homogeneous areas inhomogeneous areas 9 Computer Graphics WS07/08 – Volume Rendering Volume Representations • Cells and voxels voxels: represent cells: represent homogeneous areas inhomogeneous areas 10 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 Computer Graphics WS07/08 – Volume Rendering Volume Organization • Rectilinear Grid: – Wald et al. – Implicit kd-trees • Curvilinear Grid: – Warped Rectilinear Grid – Hexahedral cells • Unstructured Mesh: – Tetrahedral cells Computer Graphics WS07/08 – Volume Rendering Trilinear Interpolation •Cells Data values inside a cell have to be computed by interpolation. f011 f111 f001´ f101 f(x,y,z) f010 f110 f000 f100 Most common interpolation for cells: trilinear interpolation 13 Computer Graphics WS07/08 – Volume Rendering Trilinear Interpolation Let fijk = f(i,j,k) for i,j,k∈{0,1}. Then the value f(x,y,z) for a certain point (x,y,z)∈[0,1]3 inside the cell is computed by trilinear interpolation as: f011 a3 f111 a6 f001´ a4 f101 f(x,y,z) a1 = (1-x)*f000 + x*f100 a2 = (1-x)*f010 + x*f110 a = (1-x)*f + x*f 3 011 111 f010 a2 a = (1-x)*f + x*f 4 001 101 f110 a5 = (1-y)*a1 + y*a2 a5 a6 = (1-y)*a4 + y*a3 f000 a1 f100 f(x,y,z) = (1-z)*a5 + z*a6 14 Computer Graphics WS07/08 – Volume Rendering Participating Media • Absorption • Emission • In-Scattering • Out-Scattering • Multiple Scattering Computer Graphics WS07/08 – Volume Rendering Absorption • Absorption Coefficient κ(x,ω) – Probability of a photon being absorbed at x in direction ω per unit length L(x,ω) L(x,ω) + dL κ(x,ω) ds dL(x,ω) = −κ(x,ω)L(x,ω)ds dL (x,ω) = −κ(x,ω)L(x,ω) ds – Optical depth τ of a material of thickness s • Physical interpretation: – Measure for how far light travels before being absorbed s τ (s) = κ(x + tω,ω)dt [= κs, iff κ = const] ∫0 Computer Graphics WS07/08 – Volume Rendering Transparency and Opacity • Integration Along Ray dL s (x,ω) = −κ(x,ω)L(x,ω) and τ (s) = κ(x + tω,ω)dt ds ∫0 L(x + sω,ω) = e−τ (s) L(x,ω) = T (s)L(x,ω) • Transparency (or Transmittance) − sκ (x+tω)dt T(s) = e−τ (s) = e ∫0 • Opacity O(s) =1−T(s) Computer Graphics WS07/08 – Volume Rendering Emission • Emission Coefficient q(x,ω) – Number of photons being emitted at x in direction ω per unit length L(x,ω) L(x,ω) + dL q(x,ω) dL(x,ω) = q(x,ω)ds ds dL (x,ω) = q(x,ω) ds Computer Graphics WS07/08 – Volume Rendering Emission-Absorption Model • Emission-Absorption Model – Kombines absorption and emission only • Volume Rendering Equation – In differential form dL (x,ω) = −κ(x,ω)L(x,ω) + q(x,ω) ds • Volume Rendering Integral s s −∫ κ (t)dt s −∫ κ (t)dt L(x + sω,ω) = L(x,ω)e 0 + q(s')e s ' ds' ∫0 – 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 Computer Graphics WS07/08 – Volume Rendering Out-Scattering • Scattering cross-section σ(x,ω) – Probability of a photon being scattered out of direction per unit length L(x,ω) L(x,ω) + dL σ (x) ds – Total absorption (extinction): true absorption plus out-scattering χ = κ +σ – Albedo (“Weißheit”, measure for reflectivity or ability to scatter) σ σ W = = χ κ +σ 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) L(x,ω) L(x,ω) + dL σ (x,ω) ds j(x,ω) = σ (x,ωi ) p(x,ωi ,ω)L(x,ωi )dωi ∫S 2 – Total Emission: true emission q plus in-scattering j η(x,ω) = q(x,ω) + j(x,ω) – Phase function (essentially the BRDF for volumes) p(x,ωi ,ω) Computer Graphics WS07/08 – Volume Rendering Phase Functions • Phase angle is often only relative to incident direction –cos θ = ω⋅ω' ω’ • Reciprocity and energy conservation ω p(x,ωi ,ω) = p(x,ω,ωi ) 1 p(x,ωi ,ω)dω =1 4π ∫S 2 • Phase functions – Isotropic p(cosθ ) =1 – Rayleigh (small molecules) • Strong wavelength dependence 3 1+ cos2 θ p(cosθ ) = 4 λ4 – Mie scattering (larger spherical particles) Computer Graphics WS07/08 – Volume Rendering Rayleigh and Mie Scattering Computer Graphics WS07/08 – Volume Rendering Henyey-Greenstein Phase Function • Empirical Phase Function – Often used for interstellar clouds, tissue, and similar material 1 1− g 2 p(cosθ ) = 3 4π ()1+ g 2 − 2g cosθ 2 g= -0.3 – Average cosine of phase angle π g = 2π p(cosθ )cosθ dθ g= 0.0 ∫0 g= 0.6 Computer Graphics WS07/08 – Volume Rendering Summary • Scattering in a volume Computer Graphics WS07/08 – Volume Rendering Full Volume Rendering • Full Volume Rendering Equation ω ⋅∇ x L(x,ω) = ∂L(x,ω) = −χ(x,ω)L(x,ω) + q(x,ω) + 2 σ (x,ωi ) p(x,ωi ,ω)L(x,ωi )dωi ∂s ∫S ∇ = (∂ , ∂ , ∂ ) at point x x ∂x ∂y ∂z • Full Volume Rendering Integral s s −∫ χ (x+tω,ω)dt L(x + sω,ω) = e s ' η(x + s'ω,ω)ds' ∫0 Attenuation: Source Term: (absorption & in-scattering,emission, out-scattering) and background (η(0,ω)= L(x,ω)δ(x)) Computer Graphics WS07/08 – Volume Rendering Simple Atmosphere Model • Assumptions – Homogeneous media (κ = const) – Constant source term q (ambient illumination) ∂L(s) = −κL(s) + q ∂s s L(s) = e−κsC + e−κs'qds' ∫0 L(s) = e−κsC + ()1− e−κs q SC L(s) = T (s)C + (1−T(s))q • Fog and Haze (in OpenGL) – Affine combination of background and fog color – Depending on distance Computer Graphics WS07/08 – Volume Rendering 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 30 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 Computer Graphics WS07/08 – Volume Rendering 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 data cube data cube 123 .. ... 4 3 2 1 .. ... a)view plane b) view plane 32 Computer Graphics WS07/08 – Volume Rendering Raycasting There are two ways to evaluate color and transparency properties for raycasting: equidistant stepsize intersection ray / volume element 33 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) Computer Graphics WS07/08 – Volume Rendering Steps in Volume Visualization Computer Graphics WS07/08 – Volume Rendering Volume Processing Pipeline 1.