Title: Discrete Space, Voxelization and Distance Fields
1Discrete Space, Voxelization and Distance Fields
- Jian Huang, CS 594, Spring 2002
2Papers
- Huang et al, Accurate Voxelization of Polygonal
Meshes, IEEE Symposium on Volume Visualization,
1998 - Huang et al, CDFR, IEEE Conference on
Visualization, 2001
3Discrete Space
- A 3D discrete space Z3 is a set of integer grid
points in a 3D - Euclidean space denoted by S. A 3D grid point is
a zero dimensional object defined by its
Cartesian coordinate (x,y,z). - The Voronoi neighborhood of grid point p is the
set of all points in the Euclidean space that are
closer to p than to any other grid point. - The Voronoi neighborhood of a 3D grid point is a
unit cube around it, known also as a voxel.
4Discrete Space
- The aggregate of all voxels is a tessellation of
3D Euclidean space. - A voxels value is mapped into the set 0,1
- voxels assigned the value 1'' are called
black'' or non-empty'' voxels - those assigned the value 0'' are called white''
or empty'' voxels
5N-Adjacency
- In 3D discrete space
- Two voxels are 26-adjacent if they share a vertex
or an edge or a face - 26 such adjacent voxels for any voxel
- Two voxels are 18-adjacent if they share an edge
or a face - 18 such adjacent voxels for any voxel
- Two voxels are 6-adjacent if they share a face
- 6 such adjacent voxels for any voxel
- In 2D discrete space, similarly, 4-adjacency and
8-adjacency.
6N-Neighborhood
- The set of 2D pixels that are N-adjacent to the
dark pixel where N ÃŽ 4, 8 - The set of 3D voxels that are N-adjacent to the
voxel at the center where N ÃŽ 6, 18, 26
7N-Path
- An N-path is a sequence of black voxels such that
consecutive pairs are N-adjacent - Two black voxels are said to be N-connected in S
if there exists a connecting N-path consisting
only of black voxels - A (closed) N-curve is an N-path P that either
contains a single voxel or each voxel in P has
exactly two N-adjacent voxels also in P - An open N-curve is an N-curve with two exceptions
called endpoints, each of which has only one
N-adjacent voxel in P
8Separability
- In continuous space, it is impossible to pass
from the region enclosed by a curve to the region
outside the curve without crossing the curve
itself. - In discrete space, however, the opposite is
possible. - To avoid this discrepancy, define opposite types
of connectivity for white and black sets. - Opposite types in 2D space are 4 and 8
- In 3D space, 6 is opposite to 26 and 18
9Separability
- Let A, B and C be three disjoint sets of voxels.
A is said to N-separate B and C if any N-path P
between a voxel in B and a voxel in C meets A - Separability is a topological property
4-separating and 8-separating curves
10Minimality
- A voxel belonging to an N-separating surface is
called an N-simple voxel if deleting it will not
affect the surface separability. - A surface is N-minimal if it does not contain any
N-simple voxels
Examples of a 4-minimal curve (left), 8-simple
point (center), and a 4-simple point (right).
11Voxelization
- To convert continuous surface representations
(e.g. polygon mesh, parametric surfaces) into
voxel representations - Need to preserve separability and minimality
12Pixelizing a Line
- For 4-separable or 8-separable, assuming the
normal vector is normalized, need to include all
pixels with distance to the line between
13Voxelizing a Plane
- For 6-separable or 26-separable, assuming the
normal vector is normalized, all voxels with
distance to the line between abs(Ax By Cz
D) lt t
14Voxelizing a Polygon Mesh
- Edges and vertices needs special handling for
separability and minimality - Let t denote the desired connectivity distance,
either t6 or t26. - Rc L/2 for 6-separability, for 26-separability
15Distance Field
- Discrete distance field
- Each element in a distance field specifies its
minimum distance to a surface geometry - Positive and negative distances are used to
distinguish outside and inside of the shape - negative values on the outside
- positive values on the inside.
16Getting a Distance Field (1)
- First, voxelize the 3D mesh to a binary surface
volume Kaufman, Cohen, Huang - Second, run a distance transform on the surface
volume to obtain a solid distance volume - Euclidean Distance
- Chamfer Distance
- Face, edge, vertex sharing
- Manhattan Distance
- Face sharing
Chamfer distance
17Getting a Distance Field (2)
- Brute force For every voxel in the volume,
compute the minimal distance to the geometric
surface - Euclidean distance
- Doable with triangle meshes, but hard problem in
general - Time consuming
18Hierarchical Distance Field
- Distance fields can be stored hierarchically in
Quadtree or Octree structures - Aka adaptively sampled distance field (ADF)
- Use a smaller voxel size in areas of higher
details
19Disadvantages of Conventional Distance Fields
- Need to choose an initial volume resolution (the
high limit of error tolerance) - When the user picks a tighter tolerance, have to
do everything from scratch again - The conventional distance volume is aliased
- Real data sets are not smooth, thus not
band-limited
20Volume Anti-aliasing
- Non binary pre-filtered volume Sramek
Kaufmann - Need higher order smoothing filters for
reconstruction - No idea how much detail is gone in geometric
sense - Not exactly sure about how geometric details are
defined - Corners
- Holes
21Impasse
- Sampling rate is limited
- Distance fields of complex geometric models are
not band-limited - Impasse would desire to keep all the geometric
details in a volumetric distance field - Geometric details at lt0.1 of an objects
dimension
22Observation
- In spatial domain, if all that we want to capture
are the distances to a set of finite polygons - Place an anchor point somewhere, and record the
distances from the anchor to each of the finite
polygons
23Need New Distance Field Representation
- Generalize volume representation from a
discretization of a continuous domain entity to a
spatial data structure - Try to build a spatial data structure
- Every voxel to have all the information necessary
to capture the exact local distance field within
the span of that voxel - To answer a query of whats the thickness of an
interior point, pnt, we only have to deal with
the corresponding local voxel
24CDFR
- The spatial data structure is named CDFR
- A Complete Distance Field Representation
- In the CDFR, deal with signed Euclidean distances
from 3D points to finite triangles only - Each spatial point has a base triangle, which is
used to determine the sign of the distance value
25Base Triangle
- Need to decide which triangle is the base
triangle of a point, pnt - If pnt is closest to a triangle which pnt
orthogonally projects into, then this triangle is
the base triangle - Otherwise, if pnt is closest to 2 triangles
sharing an edge, then compute pntproj on this
edge, connect pnt and pntproj to form a vector V
- Otherwise, pnt is closest to several triangles
sharing a common vertex, connect pnt and this
vertex to form the vector V
26CDFR
- In a CDFR, the center of each voxel serves as an
anchor point that captures information for the
local distance field in its span - First idea each voxel stores the id of the base
triangle of its center and the corresponding
signed distance - Not enough
- Dont have the distance information for other
locations in the span of each voxel
27How much information do we need on each voxel?
- Theorem (please refer to paper)
- No triangle can be the base triangle to any
location in the span of a voxel, v, if its
distance to the center of v is larger than - thickness(v) sqrt(3) x voxel_size
28Constructing a CDFR
- First, pick an initial volume resolution
- Only affect the performance, not accuracy
- Second, voxelize the geometry into a surface
volume - On each surface voxel, store those triangles that
intersect that voxel - We store on each voxel a list of tuples
- triangle_id, signed distance
//CDD tuples - Third, an iterative contour-by-contour distance
transform to obtain the final solid CDFR
29Distance Transform
- Loop
- Each voxel not on the surface volume inherits the
CDD list from its 26-neighbors - For all the new triangles that it sees, compute
its distance to each new triangle - Update the curr_min_dist
- Discard all CDD tuples that have a distance
larger than - curr_min_dist sqrt(3)voxelsize
- This loop ends until no new updates take place in
the CDFR
30Answering a Query
- What is the minimal distance from an arbitrary 3D
point to the surface geometry - Find out which voxel the point resides in, grab
all triangles on that voxel - Compute the distance values from that point to
all those triangles - The distance value with the minimal absolute
value is what we want
31Extracting a Distance Contour
- A Dividing Cube algorithm
- Extract a point-based distance contour of
thickness, t, with an error tolerance, E. - Traverse the CDFR, grab all voxels with
min_distance in the range - Subdivide these voxels to size
- Compute the thickness values of all the
sub-voxels and extract all sub-voxels whose
thickness are within t - E/2, t E/2
32On Convex Test Models
- 32x32x32 CDFR, 5123 conventional res
33On Concave Test Models
- 32x32x32 CDFR, 5123 conventional res
34On Practical Parts
- 128x128x128 CDFR, 10243 conventional res
35On Practical Parts
- 128x128x128 CDFR,10243 conventional res
36Storage Size
- Only store CDFR for surface and interior voxels.
For exterior voxels, just store a tag denoting
empty. - CDD list for each voxel takes
- (5 4triangle_cnt) bytes
37CDFR Storage Size and Construction Time
- Connector, 242 triangles, (6.9, 2.0, 2.9) inches
- Brevi, 1812 triangles, (38.1, 34.9, 96.0) inches
Voxel Cnt (K) Avg tri/surf voxel Avg tri/int voxel CDFR Size (KB) Time (sec)
128 con 319 1.95 2.91 970 8
256 con 2,322 1.43 2.53 7,548 82
128 brevi 373 3.01 4.66 3,459 52
256 brevi 2,659 1.96 3.69 25,260 448
38Testing Platform
- SGI Octane with 300MHz R12000 processor, 512 MB
memory
39Contour Extraction Time
- Depends on which thickness you pick
- For instance brevi at 4 inches
- Higher CDFR resolution, trade storage for shorter
extraction time.
Extraction time (sec) 512 f-res 768 f-res 1024 f-res
128 CDFR 23.66 74.65 174.79
256 CDFR 9.25 28.29 64.46
40The Engine Cylinder Head
- Can build a 250-res 37MBytes CDFR in 30 min
- Can extract 0.137 mm accuracy at 8.5 mm thickness
within 11 min (470K points, 1988x3500x1218)
2 frames/sec rendering of the point-based model
and sorted triangle mesh in semi-transparent mode.