raycasting
play

Raycasting SciVis 2008 - Raycasting Ronald Peikert Direct volume - PDF document

3-1 Raycasting SciVis 2008 - Raycasting Ronald Peikert Direct volume rendering Volume rendering (sometimes called direct volume rendering) stands for methods that generate images directly from 3D scalar data. "Directly" means: no


  1. 3-1 Raycasting SciVis 2008 - Raycasting Ronald Peikert

  2. Direct volume rendering Volume rendering (sometimes called direct volume rendering) stands for methods that generate images directly from 3D scalar data. "Directly" means: no intermediate geometry (such as an isosurface) is generated. Volume rendering techniques • depend strongly on the grid type • exist for structured and unstructured grids • are predominantly applied to uniform grids (3D images). 3-2 Ronald Peikert SciVis 2008 - Raycasting

  3. Direct volume rendering 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. 3-3 Ronald Peikert SciVis 2008 - Raycasting

  4. 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) ( j ) 3-4 Ronald Peikert SciVis 2008 - Raycasting

  5. Raycasting Sampling interval can be fixed or adjusted to voxels: uniform sampling uniform sampling voxel-by-voxel traversal voxel by voxel traversal (faster) Connectedness of "voxelized" rays: 6-connected 18-connected 26-connected (strongest) (weakest) 3-5 Ronald Peikert SciVis 2008 - Raycasting

  6. Ray templates A ray template (Yagel 1991) is a voxelized ray which by translating generates all view rays. R Ray templates speed up the sampling process, but are obviously t l t d th li b t b i l restricted to orthographic views. Algorithm: Algorithm: • Rename volume axes such that z is the one "most orthogonal" to the image plane. g p • 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 3-6 Ronald Peikert SciVis 2008 - Raycasting

  7. Ray templates Incorrect: translated in Correct: translated in image plane base plane base plane 3-7 Ronald Peikert SciVis 2008 - Raycasting

  8. 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 – approximates occlusion intensity MIP – faster & better(!) LMIP threshold 0 camera 3-8 Ronald Peikert SciVis 2008 - Raycasting

  9. Compositing Comparison of techniques (Y. Sato, dataset of a left kidney): Isosurface vs. raycasting with MIP, LMIP, α -compositing fast fast fast - (1 parameter) (1 parameter) - (1 parameter) (1 parameter) parameter free parameter free - full data range full data range full data range noise insensitive - noise insensitive noise insensitive - lighting lighting - occlusion - (occlusion) occlusion - transparency (transparency) - 3-9 Ronald Peikert SciVis 2008 - Raycasting

  10. α -compositing Assume that each sample on a view ray has color and opacity: [ ] [ ] ( ) ( ) 3 ∈ α ∈ α α � C 0,1 , 0,1 C , , , C , i i 0 0 N N where the 0 th sample is next to the camera and the N th one is a (fully opaque) background sample: = C ( , , ) r g b N background α = 1 N α -compositing can be defined recursively: b C Let denote the composite color of samples f , f +1,…, b f Recursion formula for back-to-front compositing: = α b C C b b b ( ) = α + − α b b C C 1 C + f f f f f 1 3-10 Ronald Peikert SciVis 2008 - Raycasting

  11. α -compositing = − α T 1 The first few generations, written with transparency i i = = α α b C C C C b b b = α + α b C C C T − − − − b 1 b 1 b 1 b b b 1 = α α + + α α + + α α b C C C C C C T T C T C T T T − − − − − − − − b 2 b 2 b 2 b 1 b 1 b 2 b b b 1 b 2 = α + α + α + α b C C C T C T T C T T T − − − − − − − − − − − − − b 3 b 3 b 3 b 2 b 2 b 3 b 1 b 1 b 2 b 3 b b b 1 b 2 b 3 reveal the closed formula for α -compositing: − = ∑ i i 1 1 b b ∏ α b C C T f i i j = = i f j f 3-11 Ronald Peikert SciVis 2008 - Raycasting

  12. α -compositing front-to-back compositing can be derived from the closed formula: b Let denote the composite transparency of samples f , f +1,…, b T f = ∏ b b T T f j = j f Then the simultaneous recursion for front-to-back compositing is: = α f C C f f f = − α f T 1 f f + = + α b 1 b b C C C T + + f f b 1 b 1 f ( ) + = − α 1 b b T 1 T + f b 1 f Advantage of front-to-back compositing: early ray termination when g g y y composite transparency falls below a threshold. 3-12 Ronald Peikert SciVis 2008 - Raycasting

  13. The emission-absorption model How realistic is α -compositing? The emission-absorption model (Sabella 1988) yields a basic volume rendering equation l d i ti ′ x − ∫ ( ) ′′ ′′ x τ = ∫ x dx b ( ) ( ) ( ( ) ) ∫ ′ ′ ′ ′ ε L x L x e dx d x x The equation describes the radiance (power per unit area per solid The equation describes the radiance (power per unit area per solid angle [W/m 2 /sr]) arriving along a ray at the position x on this ray. The emission function ε ( x ) describes the photons "emitted" by the ( ) p y volume along the ray. The absorption function τ ( x ) is the probability that a photon traveling over a unit distance is lost by absorption. 3-13 Ronald Peikert SciVis 2008 - Raycasting

  14. The emission-absorption model The emission-absorption model is based on Boltzmann's transport equation in statistical physics, but completely ignores scattering. In more general models τ ( x ) is an extinction function having both an I l d l ( ) i ti ti f ti h i b th absorption term and a scattering term. Instead, in the emission-absorption model: • incident scattering is modeled by the emission function incident scattering is modeled by the emission function • loss by scattering can be thought to be part of the absorption. 3-14 Ronald Peikert SciVis 2008 - Raycasting

  15. The emission-absorption model Discrete version of emission-absorption model − i 1 ∑ ∑ − τ τ Δ Δ − j x x n n n n i i 1 1 ( ) ∑ ∑ ∏ j − τ Δ = ε Δ = ε Δ x = L x xe x e j 0 j i i = = = i 0 i 0 j 0 matches the α -compositing formula f − b i 1 ( ( ) ) ∑ ∑ ∏ ∏ = α − α b C C 1 f f i i i i j j = = i f j f and gives interpretations of "opacity" and "color": e τ e τ − Δ Δ α = − i x i x 1 1 i α = ε Δ C x i i i � = = α α The product The product is called a premultiplied or associated color. C C C C is called a premultiplied or associated color i i i 3-15 Ronald Peikert SciVis 2008 - Raycasting

  16. Transfer functions Transfer functions map raw voxel data to opacities and colors as needed for the α -compositing. Inputs of TF (one or more): ( ) s x • voxel value ( ) ( ) ∇ ∇ s x • gradient magnitude di t it d ( ) s x • higher derivatives of ( ) ( ) ( ) ( ) α α ∇ ∇ � ( ( s s , s s , ) ) x x x x Opacity transfer function Opacity transfer function ( ) ( ) ∇ � C s ( x , s x , ) Color transfer function ( ) ( ) ( ) ( ) � ∇ ∇ � – or premultiplied: or premultiplied: C s C s ( ( x x , s s x x , ) ) In general TF don't depend on spatial location, exception: for focus+context techniques exception: for focus+context techniques 3-16 Ronald Peikert SciVis 2008 - Raycasting

  17. Transfer functions By choosing different opacity transfer functions different types of applications can be achieved. Examples: Examples: opacity opacity opacity voxel value voxel value gradient magnitude g g standard application isosurface 3D edge detector 3-17 Ronald Peikert SciVis 2008 - Raycasting

  18. Transfer functions Example of a bivariate (=2D) transfer function: opacity ( ) ∇ gradient magnitude s x α 3 α 2 α 1 f 1 f 2 f 3 voxel value ( ) s x 3-18 Ronald Peikert SciVis 2008 - Raycasting

  19. Transfer functions Example: bivariate transfer function for isosurface of constant "thickness". opacity ( ) ∇ gradient magnitude s x f 0 ( ) voxel value s x 3-19 Ronald Peikert SciVis 2008 - Raycasting

  20. Transfer functions The color transfer function allows to make a simple classification. Example: color (RGB) fat tissue bone air voxel value ( ) s x 3-20 Ronald Peikert SciVis 2008 - Raycasting

More recommend