Title: CS 655 Advanced Computer Graphics
1CS 655 Advanced Computer Graphics
- Volume Modeling and Rendering
2Goal
- To gain meaningful insight into multi-dimesional
data - Sometimes termed Scientific Visualization or
Visualization of Scientific Data (ViSC) - Employs methods of
- Computer graphics
- Image processing
- Computer vision
- others
3Data Acquisition
- Data can be gathered from
- Observations
- Simulations
- Data format
- 2D
- 3D
- Scalar
- Tensor
- Multi-valued
- etc.
4Visualizing Data
- Several techniques for visualizing the data
- Graphs
- Charts
- Contour plots
- Surface renderings
- Volume representations
- Problem
- Too much data!
- Data acquisition
- Supercomputers
- Satellite/Spacecraft scanners
- Radio astronomy telescopes
- MRI scanners
- etc.
5Applications
- Scientific Visualization used in
- Computational Fluid Dynamics
- Finite element analysis
- Astrophysics
- Space exploration
- Molecular Modeling
- Mathematics
- Medical imaging
- Weather forecasting
- etc.
6Data
- We typically have data values for some function
- over a 3D grid
7Volume Data Geometry
- Data can be in any type of 3D geometry
- Cartesian
- Regular
- Rectilinear
- Curvilinear
- Block Structured
- Hybrid
- Unstructured
8Volume Data Geometry
- Cartesian
- (i, j, k)
- Data elements are cubic and axis aligned
9Volume Data Geometry
- Regular
- (idx, jdy, kdz)
- Data elements are rectangular and axis aligned,
but not necessarily cubic
10Volume Data Geometry
- Rectilinear
- (xi, yj, zk)
- Data elements are rectangular and axis aligned,
but may vary in size
11Volume Data Geometry
- Curvilinear
- (xi,j,k, yi,j,k, zi,j,k)
- Non rectangular cells
- Usually hexahedral or rectangular
- Cells fit a volume or wrap around an object
(often used in Computational Fluid Dynamics)
12Volume Data Geometry
- Block Structured
- The combination of several curvilinear systems in
the same data volume - Used to overcome topology restrictions of a
single curvilinear system
13Volume Data Geometry
- Unstructured
- (xi, yj, zk)
- No geometric constraints are imposed
- Cells may be any shape
14Volume Data Geometry
- Hybrid
- A combination of structured and unstructured
15Data
- Often we have data with more than 3 dimensions
- How do we visualize that data?
- Aliasing can be a problem
- If the data comes from a simulation, we may be
able to oversample - If the data is collected, we just have to use
what we have
16Displaying Information
- Given the 3D grid of data, how do we display the
data so that it gives information to the viewer? - Several approaches have been used
- Contours over 2D slices
- Isosurface rendering
- Volume rendering
17Connect the Contours Method
- Take slices of the 3D volume and locate contours
for - for each zk slice
slice zk2
slice zk1
18Connect the Contours Method
- Join the contours between slices with triangular
polygon patches
slice zk2
slice zk1
19Problem with Connect the Contours
slice zk
Should this be interpreted as
or as
We dont know we need user input
20Isosurface Rendering
- Extension of contouring through 2D cells
to 3D voxels
21Isosurface Rendering
- Now we generate surface sections
- Can model surfaces with
- Polygon Patches
- Curved surface sections such as bicubic patches
- Polygon patches are typically used
- Fast
- Can be shaded to produce smooth surfaces
22Marching Cubes Algorithm
- An isosurface rendering technique presented by
Lorensen and Cline in 1987 - Idea
- Given a threshhold value, obtain polygon
isosurface patches over a 3D grid of cells by
processing the cells one by one across the grid - Tests for isosurface intersections with cells are
reduced by - Tabulating possible types of slices an isosurface
can make across a cell - Marching through cells, determining the
isosurface topology across each cell by matching
the cell pattern to one in the table
23Marching Cubes
- Idea
- Take a threshold value fs
- The values at each node fijk must be either
- For all adjacent vertices with opposite
relationship to fs, the surface defined by fs
must pass through the edge connecting those
vertices.
fijk
24Marching Cubes
- Possible configurations
- All 8 fijk fs
- All 8 fijk lt fs
- One fijk fs, all others lt fs
- Two adjacent fijk fs, all others lt fs
- Two diagonal, in the same XY plane
- Two diagonal, in the same XZ plane
- etc.
25Marching Cubes
- Since each cell has 8 vertices, there are 28
256 possible ways the vertex function can be
satisfied across the cube - The configurations have many symmetries
- Interchange of vertex state
- e.g., we get the same results if one fijk fs
or if one fijklt fs - Rotational Symmetry
- This reduces the number of possibilities to 15
is equivalent to
26Marching Cubes Cell Patterns
Pattern 0 all fijk lt fs or all fijk fs 0
polygons
Pattern 1 one fijk lt fs or one fijk fs 1
polygon
27Marching Cubes Cell Patterns
Pattern 3 two diagonal fijk lt fs or two
diagonal fijk fs in the same plane 2 polygons
Pattern 2 two adjacent fijk lt fs or two
adjacent fijk fs 2 polygons
28Marching Cubes Cell Patterns
Pattern 5 three vertices fijk lt fs or three
vertices fijk fs in the same plane 3 polygons
Pattern 4 two diagonal fijk lt fs or two
diagonal fijk fs not in the same plane 2
polygons
29Marching Cubes Cell Patterns
Pattern 7 three fijk lt fs or three fijk fs
not in the same plane 3 polygons
Pattern 6 three fijk lt fs or three fijk
fs two in the same plane 3 polygons
30Marching Cubes Cell Patterns
Pattern 9 four fijk lt fs any three in the same
plane 4 polygons
Pattern 8 four fijk lt fs in the same plane 2
polygons
31Marching Cubes Cell Patterns
Pattern 11 four fijk lt fs as shown 4 polygons
Pattern 10 four fijk lt fs two pairs on
opposing edges 4 polygons
32Marching Cubes Cell Patterns
Pattern 13 four fijk lt fs on opposite
corners 4 polygons
Pattern 12 four fijk lt fs as shown 4 polygons
33Marching Cubes Cell Patterns
Pattern 14 four fijk lt fs as shown 4 polygons
34Marching Cubes Vertex summary
- Vertex Summary
- 1 pattern with 0 or 8 vertices fs
- 1 pattern with 1 or 7 vertices fs
- 3 patterns with 2 or 6 vertices fs
- 3 pattern with 3 or 5 vertices fs
- 7 pattern with 4 vertices fs
35Marching Cubes Triangle summary
- Each isosurface intersection through a cell is
divided into 0 4 triangles - 0 or 8 vertices fs 0 triangles
- 1 or 7 vertices fs 1 triangle
- 2 or 6 vertices fs 2 triangles
- 3 or 5 vertices fs 3 triangles
- 4 vertices fs 2 or 4 triangles
36Marching Cubes
- We are also making the assumption that the
isosurface does not intersect any cell edge more
than once, i.e., we cant have
37Edge Table for Marching Cubes
- Label all of the edges and vertices of each cube
as follows
38Edge Table for Marching Cubes
- Maintain an edge table that specifies which edges
are intersected for a given index - For each cube, set up an eight bit code that
serves as the index into the table - Indexing into the table gives all edge
intersections for that cube - index
- Each bit of the index specifies whether
- the vertex is fs or lt fs
V8
V7
V6
V5
V4
V3
V2
V1
V7
E7
V8
E12
E11
V3
E3
V4
E6
E8
E2
E5
E4
V5
V6
E10
E9
E1
V1
V2
39Marching Cubes Algorithm
- Process cells across successive slices. For each
cell do - Determine the binary cell code
- Index into the edge intersection table to
determine which edges are intersected - Calculate actual intersection positions along the
edges using linear interpolation - Calculate normals at cell vertices and
interpolate to get triangle vertex normals - Render
40Calculating Normals
- Since the surface to be drawn is constant, i.e.,
- then the gradient component along the surface
tangential direction is zero. - Thus, the direction of the gradient is normal to
the surface - The gradient is the derivative of the function f
, - with
41Computing the Normal
- We estimate the gradient using central finite
differences - First, estimate gradient at the cube vertices
- Next, linearly interpolate to get gradient at
intersection - Central finite differences use neighbor values to
approximate gradients
We then divide the gradient by its length to get
a unit normal vector
42Computing the Normal
(i, j, k)
(i-1, j, k)
(i1, j, k)
If fi-1, j, k 36 fi, j, k 63
fi1, j, k 82 then
Then the x component of the normal at (i, j, k)
is given by
43Computing the normal
1. Compute gradients at cube vertices
2. Linearly interpolate gradients to get
normals at the intersection points
3. Render the triangle(s)
44Sample Marching Cubes Images
- Isosurfaces extracted from (a) MRI Head dataset
at a75 and (b) MRI Brain dataset at a30 (from
Zhang and Newman)
45- From Lorensen, Marching Through the Visible
Man, Proceedings of IEEE Visualization 1995
46- From Pekar et. al, Fast Detection of Meaningful
Isosurface for Volume Visualization, in
Proceedings of IEEE Visualization 2001
47Problem with Marching Cubes
- Ambiguity
- Cases 3, 6, 7, 10, 12, and 13 are ambiguous.
- For example, case 3
or
Could be
48Problem with Marching Cubes
- The ambiguities can cause holes in the resultant
surface - To remove ambiguities
- User input
- Difficult, tedious
- Use surrounding cell data to pick which option to
use
49Volume Rendering
- Display interior information of a 3D data set
instead of simply showing isosurfaces - Can extract particular values or properties, or
can accumulate values - SIGGRAPH 88 articles by
- Sabella
- Upson and Keeler
- Drebin and Carpenter
50Volume Rendering
- Basic Approach
- Cast rays from viewing position through pixel
into the data volume
Eye
Image plane
51Volume Rendering
- Follow the ray through the volume of data, return
back - The first data hit
- A particular data value
- An accumulation of data as the ray passes through
the volume - For example
- Seismic Data
- Along each ray, determine position and magnitude
of maximum value - Encode the info using grey scale or color range
and assign the corresponding intensity to the
pixel - Transparent Surface Layers
- e.g., tissue around bone
- Store multivalued data (density, opacity,
texture, etc.) - Accumulate intensities along path until either
- opacity 1 or the ray exits the data
52Ray Processing
- Intersection calculations with faces of data
cells (voxels) - need an efficient voxel traversal scheme
53Ray Processing
- Data Calculations
- Interpolate to intersection positions or
- Average over voxel or
- Search for particular values
- Initial ray entry position is on one of the
bounding faces of the data grid - easy to find first voxel
54Ray-Exit Intersection Calculations
- Given a ray with voxel entry position po and unit
direction vector traveling through a voxel
with outward normals Nk - Potential exit faces are those for which
N2
N3
N1
55Ray Intersection Calculations
- If the data grid is aligned with the screen
coordinate axes, - Then all we have to do is check the sign of each
component of to determine the three candidate
exit planes
56Ray Intersection Calculations
- Exit position on each candidate plane can be
expressed as - We can determine Sk from the plane equation
- Thus,
- And the smallest Sk gt 0 identifies the exit face
57Ray Intersection Calculations
- If the Nk are aligned with the coordinate axes,
this can be simplified - e.g., if one candidate plane is (1, 0, 0), then
for that plane - Where Po (xo, yo, zo), u (ux, uy, uz) and xk
is the value of the right boundary face for the
voxel - Other voxel traversal schemes are possible
- e.g. Can take trial exit plane as the one
perpendicular to the direction of largest
component of u
58Example
N2
P0 (0, 1, 0)
- u (1, -1, 0)
- Cube sides (-1, 1)
-
N3
N1
Nk are axis aligned, so
So N1 is the exit face
59Examples
60(No Transcript)
61Volume Rendering
Severe Storm