Volume Rendering Reference Material The slides have used/adapted - - PowerPoint PPT Presentation
Volume Rendering Reference Material The slides have used/adapted - - PowerPoint PPT Presentation
Volume Rendering Reference Material The slides have used/adapted material from the following references: 1. Advanced Animation and Rendering Techniques by Watt and Watt 2. Slides by Prof Parag Chaudhuri of Course CS 775 on Volume Graphics 3.
Reference Material
The slides have used/adapted material from the following references:
- 1. Advanced Animation and Rendering Techniques by Watt and Watt
- 2. Slides by Prof Parag Chaudhuri of Course CS 775 on Volume Graphics
- 3. Slides by Prof Bong Soo Sohn of Lecture on Direct Volume Rendering
- 4. Lecture Slides on Contouring by Prof Tao Ju (Course CSE554)
Volume Rendering
Bicubic Parametric Patches Polygons 3D Structured Objects 2D Image
I x y ( , )
Conventional Rendering
Volume Rendering
V x y z ( , , )
Scalar Field:
Volume Rendering
Volume Rendering
V x y z ( , , ) V x y z ( , , )
Structured 3D Model 3D Scalar Field 3D Scalar Field 2D Scalar Image
Volume Rendering
- Polylines (2D) or
meshes (3D) that tile the object boundary
- Smoother appearance
- Less storage (no
interior pieces)
Binary picture Boundary mesh
Volume Rendering
- Creates a binary picture from a grayscale image
- How to create a smooth boundary at the threshold?
- Such boundary is known as an iso-contour (or iso-curve,
iso-surface, etc.)
Digital image Binary picture Boundary curve
Volume Rendering
- Iso-contour: set of points at a particular function value
- Given a continuous function f defined on every point in
the space
- An iso-contour is all points where f evaluates to be some
value c (called the iso-value)
- Iso-curves: iso-contours of 2D
functions
2 2
) , ( y x y x f + = 1 ) , ( = y x f
} ) , ( | } , {{ c y x f y x =
Volume Rendering
- Iso-surfaces: iso-contours of 3D functions
} ) , , ( | } , , {{ c z y x f z y x =
2 2 2
) , , ( z y x z y x f + + = 1 ) , , ( = z y x f
Volume Rendering
Black curves: iso-contours Red arrows: gradient directions Green dots: critical points
- Closed
- With a well-defined inside and
- utside
- Inside: points above the iso-
value
- Outside: points below the iso-
value
- Orthogonal to gradient directions
- In general, a manifold
Volume Rendering
Iso-value = Grid point (pixel) Grid edge Grid cell
- Input
- A grid where each grid
point (pixel or voxel) has a value (color)
- An iso-value (threshold)
- Output
- A closed, manifold, non-
intersecting polyline (2D)
- r mesh (3D) that
separates grid points above or below the iso- value
Volume Rendering
- For each grid cell with a sign
change
- Create one vertex on each grid
edge with a sign change
- Connect vertices by lines
Volume Rendering
- Creating vertices
- Assuming the underlying, continuous function is linear
- n the grid edge
- Linearly interpolate the positions of the two grid points
{x0,y0} {x1,y1 } f f0 f1 {x,y}
) ( ) (
1 1 1
y y t y y x x t x x f f f t ! + = ! + = ! =
+
- t
1-t
Volume Rendering
- Connecting vertices by lines
- Lines shouldn’t intersect
- Each vertex is used once
- So that the polyline is a closed
manifold
- Two approaches
- Do a walk around the grid cell
- Connect consecutive pair of vertices
- Or, using a pre-computed look-up
table
- 2^4=16 entries
- For each sign combination at the 4
corners, it stores the indices of the grid edges whose vertices make up the lines.
1 2 3 4 1 3 4 2
“0 0 0 1” {{2,4}} “0 0 1 1” {{3,4}} “1 0 0 1” {{1,3},{2,4}}
Volume Rendering
Volume Rendering
Volume Rendering
C D D C E F E C E G D , , C H E 1 1 3 2 1 3 2 1
Marching Square
- Select a cell
- Calculate inside/outside
state of each vertex
- Determine which edge is
intersected
- Move to next cell till all
cells are
Volume Rendering
? @ @ ? A B A ? A C @ , , ? D A 1 1 3 2 1 3 2 1 No intersection Contour intersects 2 edges (no ambiguity) Contour intersects 2 edges (ambiguity) Contour intersects 2 edges (no ambiguity)
Volume Rendering
No intersection Contour intersects 2 edges (no ambiguity) Contour intersects 2 edges (ambiguity) Contour intersects 2 edges (no ambiguity) ? @ @ ? A B A ? A C @ , , ? D A 1 1 3 2 1 3 2 1
Volume Rendering
No intersection Contour intersects 2 edges (no ambiguity) Contour intersects 2 edges (ambiguity) Contour intersects 2 edges (no ambiguity) ? @ @ ? A B A ? A C @ , , ? D A 1 1 3 2 1 3 2 1
Volume Rendering
No intersection Contour intersects 2 edges (no ambiguity) Contour intersects 2 edges (ambiguity) Contour intersects 2 edges (no ambiguity) ? @ @ ? A B A ? A C @ , , ? D A 1 1 3 2 1 3 2 1
Volume Rendering
Volume Rendering
Direction of march Current cube Previously dealt with New vertex
Volume Rendering
- To calculate surface normal, we need to determine gradient
vector, g (derivative of the density function).
- To estimate the gradient vector at the surface of interest, we
first estimate the gradient vectors at the vertices and interpolate the gradient at the intersection.
- The gradient at cube vertex (i , j, k), is estimated using central
differences along the three coordinate axes by:
D (i, j, k) is the density at pixel (i, j) in slice k. !x, !y, !z are lengths of the cube edges
Volume Rendering
Volume Rendering
Volume Rendering
y j =
y j = +1 V x y z k ( , , ) =
Polygon structure generated by “skimming”
Volume Rendering
Volume Rendering
- scalar field
– like temperature in room at each (x,y,z)
- many applications
– medical (MRI, CT, PET) – geophysical – fluid dynamics
Volume Rendering
Direct Volume Rendering
- 3D volume data are represented by a finite number of
cross sectional slices (hence a 3D raster)
- On each volume element (voxel), stores a data value (if
it uses only a single bit, then it is a binary data set. Normally, we see a gray value of 8 to 16 bits on each voxel.)
N x 2D arrayes = 3D array
Direct Volume Rendering
Based on the idea of ray tracing
- Trace from eat each pixel as a ray
into object space
- Compute color value along the ray
- Assign the value to the pixel
Direct Volume Rendering
- Maps voxel data values to optical properties
- Color/opacity map
- Emphasize or classify features of interest in the data
- Piecewise linear functions, Look-up tables, 1D, 2D
- GPU – simple shader functions, texture lookup tables
Voxel Data
- Density
- Temperature
Optical Properties
- Color
- Opacity
Direct Volume Rendering
- Stepping through the volume: a ray is cast into
the volume, sampling the volume at certain intervals
- The sampling intervals are usually equi-distant,
but don’t have to be (e.g. importance sampling)
- At each sampling location, a sample is
interpolated / reconstructed from the grid voxels
- popular filters are: nearest neighbor (box),
trilinear (tent), Gaussian, cubic spline
- Along the ray - what are we looking for?
Volume Rendering
Light Source
D x y z ( , , )
t1 t2 t !
Eye Point
D x t y t z t D t I x t y t z t I t ( ( ), ( ), ( )) ( ) ( ( ), ( ), ( )) ( ) = =
Density: Illumination: Light scattered along R in direction of eye from point at t: R
I t D t P ( ) ( ) cos!
Volume Rendering
Attenuation of light scattered from point t:
exp ( ) ! " # $ $ % & ' '
(
) D s ds
t t
1
Summing the intensity of light arriving at the eye along R from all of the elements:
B D s ds I t D t P dt
t t t t
= ! " # $ $ % & ' ' ( ) * + * ,
- *
. *
/ / exp
( ) ( ) ( ) cos 1
1 1 2
Volume Rendering
R
V x y z ( , , )
C R k R k ( , ) ( , ) !
C R ( )
Image Plane
Volume Rendering
Determining the color of a voxel: C i j k
( , , )
Calculated using the Phong model, assuming that the normal is given by the gradient:
!V x y z
i j k
( , , ) f1 f2 f3 f4 ! f 1 !f 2 ! f 3 !f 4 !( ) X V X ( )
Determining the opacity: !( , , )
i j k
Volume Rendering
Cin Cout C R k R k ( , ) ( , ) ! C C R k C R k R k
- ut
in
= ! + ( ( , )) ( , ) ( , ) 1 " "
Transparency Term Opacity Term
C R C R k R k R i
i k K k K
( ) ( , ) ( , ) ( ( , )) = ! " # $ % & '
= + =
( )
* * 1
1
kth voxel along R
Volume Rendering
Volume Rendering
Depth Max Average Accumulate First Intensity
Volume Rendering
Depth Intensity First
Volume Rendering
Depth Intensity Average
- Average: produces basically an X-ray picture
Volume Rendering
Depth Intensity Max
- Max: Maximum Intensity Projection
used for Magnetic Resonance Angiogram
Volume Rendering
Depth Intensity Accumulate
- Accumulate opacity while compositing colors: make transparent layers
visible! Levoy ‘88
Volume Rendering
color
- pacity
1.0
- bject (color, opacity)
color
- pacity
1.0 volumetric compositing
- bject (color, opacity)
Volume Rendering
color
- pacity
Interpolation kernel 1.0
- bject (color, opacity)
volumetric compositing
Volume Rendering
color c = c s !s(1 - !) + c
- pacity ! = ! s (1 - !) + !
1.0
- bject (color, opacity)
volumetric compositing Interpolation kernel
Volume Rendering
color
- pacity
1.0
- bject (color, opacity)
volumetric compositing
Volume Rendering
color
- pacity
1.0
- bject (color, opacity)
volumetric compositing
Volume Rendering
color
- pacity
1.0
- bject (color, opacity)
volumetric compositing
Volume Rendering
color
- pacity
1.0
- bject (color, opacity)
volumetric compositing
Volume Rendering
color
- pacity
1.0
- bject (color, opacity)
volumetric compositing
Volume Rendering
color
- pacity
- bject (color, opacity)
volumetric compositing
Volume Rendering
Volume Rendering
- 1. Raycast – once per pixel
- 2. Sample – uniform intervals along ray
- 3. Interpolate – trilinear interpolate, apply transfer function
- 4. Accumulate – integrate optical properties
Volume Rendering
- 1. Raycast – once per pixel
- 2. Sample – uniform intervals along ray
- 3. Interpolate – trilinear interpolate, apply transfer function
- 4. Accumulate – integrate optical properties
- Phong Shading Model
- Requires surface normal vector
- What’s the normal vector of a voxel? Gradient
- Central differences between neighboring voxels
N s L d L a
n h k I n l k I k I ) ˆ ˆ ( ) ˆ ˆ ( ! + ! + =
Resulting = Ambient + Diffuse + Specular
x back front x bottom top x left right I I grad 2 ) ( , 2 ) ( , 2 ) ( ) ( ! ! ! = " =
Volume Rendering
Volume Rendering
Volume Rendering
Volume Rendering
Volume Rendering
Volume Rendering
Volume Rendering
Lacroute’94
3D Texture Mapping
Consider ray casting … x y z (top view)
3D Texture Mapping
x z y
- Render every xz slice in the volume as a texture-mapped polygon
- The proxy polygon will sample the volume data
- Per-fragment RGBA (color and opacity) as classification results
- The polygons are blended from back to front
Use pProxy geometry for sampling
3D Texture Mapping
3D Texture Mapping
Use Image-space axis-aligned slicing plane: the slicing planes are always parallel to the view plane
3D Texture Mapping
Volume Rendering
Volume Rendering
- forward method
– splat voxels onto screen – must interpolate to get pixel values
- reverse method
– is ray-casting through volume – resample along ray – collect intensity/gradient info for pixel
Volume Rendering
Compositing Order
- front-to-back
– keep running product for the term – keep running sum of terms
- back-to-front