You are on page 1of 6

Direct volume rendering

Volume rendering (sometimes called direct volume rendering) stands for methods that generate images directly from 3D scalar

3
Raycasting
Ronald Peikert SciVis 2007 - Raycasting 3-1

data.

"Directly" means: no intermediate geometry (such as an isosurface) is i generated. t d

Volume rendering techniques • depend strongly on the grid type • exist for structured and unstructured grids • are predominantly applied to uniform grids (3D images).
Ronald Peikert SciVis 2007 - Raycasting 3-2

Direct volume rendering

Raycasting
Raycasting is historically the first volume rendering technique. It has common with raytracing: • image-space method: main loop is over pixels of output image • a view ray per pixel (or per subpixel) is traced backward • samples are taken along the ray and composited to a single color Differences are: • no secondary (reflected, shadow) rays • transmitted ray is not refracted • more elaborate compositing functions • samples are taken at intervals (not at object intersections)

2D or 3D image data are uniform grids with cell-centered data. Cell-centered data • are attributed to cells (pixels, voxels) rather than nodes • can also occur in (finite volume) CFD datasets • are converted to node data – by taking the dual grid (easy for uniform grids, n cells → n-1 cells!) – or by interpolating.

Ronald Peikert

SciVis 2007 - Raycasting

3-3

Ronald Peikert

SciVis 2007 - Raycasting

3-4

Raycasting

Ray templates
A ray template (Yagel 1991) is a voxelized ray which by translating generates all view rays. Ray templates speed up the sampling process, but are obviously restricted to orthographic views. Algorithm: • Rename volume axes such that z is the one "most orthogonal" to most orthogonal the image plane. Create ray template with 3D version of Bresenham algorithm, giving 26-connected rays which are functional in z coordinate (have exactly one voxel per z-layer) Translate ray template in base plane, not in image plane

Sampling interval can be fixed or adjusted to voxels:

uniform sampling

Connectedness of "voxelized" rays:

voxel-by-voxel traversal (faster)


6-connected (strongest)
Ronald Peikert

18-connected
SciVis 2007 - Raycasting

26-connected (weakest)
3-5 Ronald Peikert SciVis 2007 - Raycasting 3-6

1

Raycasting α-compositing α-compositing The first few generations.….1] .Ray templates Compositing Two simple compositing functions can be used for previewing: • Maximum intensity projection (MIP): – maximum of sampled vaules – result resembles X-ray image • Local maximum intensity projection (LMIP): – first local maximum which is above a prescribed threshold Incorrect: translated in image plane Correct: translated in base plane base plane – approximates occlusion – faster & better(!) intensity MIP LMIP threshold 0 camera Ronald Peikert SciVis 2007 .α 0 ) . written with transparency Ti = 1 − α i b Cb = α bCb b Cb −1 = α b −1Cb −1 + α bCbTb −1 b Cb −2 = α b − 2Cb −2 + α b −1Cb −1Tb −2 + α bCbTb −1Tb −2 front-to-back compositing can be derived from the closed formula: Let Tf b denote the composite transparency of samples f.α i ∈ [0.Raycasting 3-10 SciVis 2007 .b Tf b = ∏T j j =f b C b b −3 = α b −3Cb −3 + α b − 2Cb −2Tb −3 + α b −1Cb −1Tb − 2Tb −3 + α bCbTb −1Tb − 2Tb −3 Then the simultaneous recursion for front-to-back compositing is: Cff = α f Cf Tf f = 1 − α f Cfb +1 = Cfb + α b +1Cb +1Tf b Tf b +1 = (1 − α b +1 )Tf b Advantage of front-to-back compositing: early ray termination when composite transparency falls below a threshold. reveal the closed formula for α-compositing: Cfb = ∑ α i Ci ∏T j i =f j =f b i −1 Ronald Peikert SciVis 2007 . Sato. . α-compositing (C0 . g.Raycasting 3-12 2 . LMIP.f+1. b )background αN = 1 α-compositing can be defined recursively: fast (1 parameter) lighting occlusion (transparency) Ronald Peikert fast parameter free full data range noise insensitive - fast (1 parameter) full data range noise insensitive (occlusion) - full data range noise insensitive lighting occlusion transparency 3-9 Let Cfb denote the composite color of samples f. dataset of a left kidney): Isosurface vs.1] 3 where the 0th sample is next to the camera and the Nth one is a (fully opaque) background sample: CN = (r .Raycasting 3-8 Compositing α-compositing Assume that each sample on a view ray has color and opacity: Comparison of techniques (Y.α N ) Ci ∈ [0.b Recursion formula for back-to-front compositing: b Cb = α bCb Cfb = α f Cf + (1 − α f ) Cfb+1 Ronald Peikert SciVis 2007 .f+1.Raycasting 3-11 Ronald Peikert SciVis 2007 . raycasting with MIP.…. (CN .Raycasting 3-7 Ronald Peikert SciVis 2007 .

Instead in the emission absorption model: emission-absorption • incident scattering is modeled by the emission function • loss by scattering can be thought to be part of the absorption. Ronald Peikert SciVis 2007 . Instead. The absorption function τ(x) is the probability that a photon traveling over a unit distance is lost by absorption.Raycasting 3-15 α i Ci = ε i Δx In general TF don't depend on spatial location. ∇s ( x ) . but completely ignores scattering.The emission-absorption model How realistic is α-compositing? The emission-absorption model (Sabella 1988) yields a basic volume rendering equation The emission-absorption model The emission-absorption model is based on Boltzmann's transport equation in statistical physics.Raycasting 3-18 standard application isosurface 3D edge detector Ronald Peikert SciVis 2007 .Raycasting 3-13 Ronald Peikert SciVis 2007 . Ronald Peikert SciVis 2007 . exception: for focus+context techniques Ronald Peikert SciVis 2007 . Examples: opacity opacity Example of a bivariate (=2D) transfer function: opacity opacity gradient magnitude ∇s ( x ) α3 voxel value voxel value gradient magnitude α2 α1 f1 f2 f3 voxel value s ( x ) SciVis 2007 . ∇s ( x ) . L ( x ) = ∫ ε ( x ′) e x xb − τ ( x ′′ )dx ′′ x x′ ∫ dx ′ The equation describes the radiance (power per unit area per solid angle [W/m2/sr]) arriving along a ray at the position x on this ray. ) α i = 1 − e −τ Δx i C ( s ( x ) .Raycasting 3-16 Transfer functions Transfer functions By choosing different opacity transfer functions different types of applications can be achieved. −τ j Δx Discrete version of emission-absorption model L ( x ) = ∑ ε i Δxe i =0 n − ∑ τ j Δx j =0 i −1 = ∑ ε i Δx ∏ e i =0 j =0 n i −1 Inputs of TF (one or more): • voxel value s ( x ) • gradient magnitude ∇s ( x ) Opacity transfer function α (s ( x ) . Color transfer function – or premultiplied: • higher derivatives of s ( x ) matches the α-compositing formula C = ∑ α i Ci ∏ (1 − α j ) b b f i =f j =f i −1 ) and gives interpretations of "opacity" and "color": C ( s ( x ) . ) The product Ci = α i Ci is called a premultiplied or associated color. In more general models τ(x) is an extinction function having both an absorption term and a scattering term. The emission function ε(x) describes the photons "emitted" by the volume along the ray.Raycasting 3-17 Ronald Peikert 3 . ∇s ( x ) .Raycasting 3-14 The emission-absorption model Transfer functions Transfer functions map raw voxel data to opacities and colors as needed for the α-compositing.

• The diffuse lighting can be applied to the entire volume dataset as a pre-processing since it is independent of the viewing direction. semi-automatic). • Reflection coefficients can be assigned by a separate transfer function ("materials" instead of colors only).Raycasting 3-24 4 .Raycasting 3-22 Transfer functions Transfer functions Example: classifications with different transfer functions (McGill Univ. Example: "virtual frog" dataset (Lawrence Berkeley Labs).Raycasting 3-19 Ronald Peikert SciVis 2007 . Example: color (RGB) air fat tissue bone f0 voxel value s ( x ) Ronald Peikert SciVis 2007 . It can be used as a normal vector for a Phong lighting (without rendering the isosurface itself).Raycasting voxel value s ( x ) 3-20 Transfer functions Transfer functions Better (but more expensive) classification than with a transfer function is obtained by segmentation (typically slice by slice. Example: temperature data for opacity and color TF (Nissan Res.Ctr.) In pre-classification.Raycasting 3-21 Ronald Peikert SciVis 2007 . the voxels can also be lit: • The gradient is perpendicular to the local isosurface. opacity gradient magnitude ∇s ( x ) The color transfer function allows to make a simple classification. Pre-classified volume data.Raycasting 3-23 Ronald Peikert SciVis 2007 . Volume rendering of segmented volume data (from VTK book).Transfer functions Transfer functions Example: bivariate transfer function for isosurface of constant "thickness".) Ronald Peikert SciVis 2007 . Ronald Peikert SciVis 2007 .

Engel. Stuttgart Ronald Peikert SciVis 2007 . diffuse lighting Pre. Transfer functions are applied to sampled data. the preintegrated opacity TF could be tabulated with d = x i +1 − x i for all possible combinations of (si.Raycasting 3-26 Pre. Pre-Classification: 1. Post-Classification: 1.vs. Raw data are interpolated to sample locations. post-classification x voxel s(x) α(s(x)) sample interi t polated Post-classification: P t l ifi ti Interpolation is in the correct space Additional samples can be interpolated on the fly to improve output quality view ray voxel value transfer function Ronald Peikert SciVis 2007 . for a sample interval [xi.vs. • • Pre-classification: • can be done as pre-processing.Raycasting 3-28 Preintegration Preintegration The discrete formula for opacity at a sample was The integral si + 1 αi = 1− e xi + 1 −τ i x si ∫ τ (s )ds = ∫ τ (s )ds − ∫ τ (s )ds 0 0 si + 1 si The continuous version.g. Ronald Peikert SciVis 2007 .Raycasting 3-27 Ronald Peikert SciVis 2007 .Pre.Raycasting 3-29 Ronald Peikert SciVis 2007 . d). si+1. especially if the sampling distance d is chosen constant. Results are interpolated to sample locations. xi+1]. current volume rendering implementations often use post-classification. U. 2. which is called a preintegrated opacity transfer function. is − can be evaluated by two lookups in a precomputed table of αi = 1− e − d si +1 − si si +1 xi ∫ τ (s ( x ))dx ∫ τ (s′)ds′ 0 s Assuming now s(x) to be linear between samples.vs. e. Transfer functions are applied to voxels 2. post-classification Preintegration Idea (Engel 2001): • 128 slices preclassification 128 slices postclassification simulate infinitely many interpolated samples between two successive samples si = s(xi ) and si+1 = s(xi+1 ) assuming: – – field s(x) varies linearly between samples transfer functions don't depend on derivatives • 284 slices postclassification 128 slices preintegrated Image credit: K. post-classification For quality reasons.Raycasting 3-25 Ronald Peikert SciVis 2007 .Raycasting 3-30 5 . we get αi = 1− e si ∫ τ ( s )ds Alternatively. segmentation.

3-31 Ronald Peikert SciVis 2007 . it can be tabulated for all combinations of (si.Raycasting 3-34 Raycasting hardware Some special features: • cropping • clipping planes some possible combinations of cropping and clipping planes Ronald Peikert SciVis 2007 .Raycasting Raycasting hardware Raycasting hardware volumePRO (1999. but also some raycasting implementations on GPUs have been done.Preintegration Raycasting hardware Today's GPUs are well suited for volume rendering. d). MERL): – PCI board – no pre-processing – 30 Hz for 2563 volume – orthographic raycasting – ray templates – shear-warp method shear warp – z-supersampling ASIC chip of VolumePRO vg500 board has 4 parallel pipelines with stages: • interpolation • gradient estimation • classification/shading • compositing Image is rendered in a single pass through the volume. Off-chip memory for slices (shown in blue) Example: with / without supersampling Ronald Peikert SciVis 2007 . In contrast. two examples of special raycasting hardware: The composite color of the same interval Ci = xi + 1 xi ∫ ε ( s( x ) ) e si + 1 − τ ( s ( x ' ) )dx ' xi ∫ x dx simplifies for linear s(x) to Ci = d si +1 − si si ∫ ε (s ) e − d si + 1 − si si ∫ τ ( s ')ds ' s d ds which is a preintegrated color transfer function. Again. si+1.Raycasting 3-32 SciVis 2007 . U. or it can be approximately calculated from tabluated values of (1997 U • VIZARD (1997.Raycasting 3-35 6 .Raycasting 3-33 Ronald Peikert SciVis 2007 . Tübingen): – FPGA-based system – long pre-processing – 10 Hz for 2563 volume – perspective view raycasting ∫ τ (s′)ds′ and ∫ ε (s′)ds′ 0 0 Ronald Peikert s s (moving the exponential term out of the integral). Object-space methods are more straight-forward.