discrete space, voxelization and distance fields jian huang, cs 594, spring 2002
TRANSCRIPT
![Page 1: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/1.jpg)
Discrete Space, Voxelization and Distance Fields
Jian Huang, CS 594, Spring 2002
![Page 2: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/2.jpg)
Papers
• Huang et al, ‘Accurate Voxelization of Polygonal Meshes’, IEEE Symposium on Volume Visualization, 1998
• Huang et al, ‘CDFR’, IEEE Conference on Visualization, 2001
![Page 3: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/3.jpg)
Discrete 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.
![Page 4: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/4.jpg)
Discrete Space
• The aggregate of all voxels is a tessellation of 3D Euclidean space.
• A voxel’s 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
![Page 5: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/5.jpg)
N-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.
![Page 6: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/6.jpg)
N-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
![Page 7: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/7.jpg)
N-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 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
![Page 8: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/8.jpg)
Separability• 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
![Page 9: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/9.jpg)
Separability• Let A, B and C be three disjoint sets of voxels. A is
said to N-separate B and C if any N-path between a voxel in B and a voxel in C meets A
• Separability is a topological property
4-separating and 8-separating curves
![Page 10: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/10.jpg)
Minimality• 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).
![Page 11: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/11.jpg)
Voxelization
• To convert continuous surface representations (e.g. polygon mesh, parametric surfaces) into voxel representations
• Need to preserve separability and minimality
![Page 12: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/12.jpg)
Pixelizing 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:
![Page 13: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/13.jpg)
Voxelizing 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) <= t
![Page 14: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/14.jpg)
Voxelizing 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:
![Page 15: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/15.jpg)
Distance 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.
![Page 16: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/16.jpg)
• 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
Getting a Distance Field (1)
Chamfer distance
![Page 17: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/17.jpg)
Getting 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
![Page 18: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/18.jpg)
Hierarchical 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
![Page 19: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/19.jpg)
Disadvantages 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
![Page 20: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/20.jpg)
Volume 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
![Page 21: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/21.jpg)
Impasse
• 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 <0.1% of an object’s
dimension
![Page 22: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/22.jpg)
Observation
• 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
![Page 23: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/23.jpg)
Need 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 ‘what’s the thickness of an interior point, pnt,’ we only have to deal with the corresponding local voxel
![Page 24: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/24.jpg)
CDFR
• 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
![Page 25: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/25.jpg)
Base 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
![Page 26: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/26.jpg)
CDFR
• 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– Don’t have the distance information for other locations
in the span of each voxel
![Page 27: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/27.jpg)
How 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
![Page 28: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/28.jpg)
Constructing 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
![Page 29: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/29.jpg)
Distance 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
![Page 30: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/30.jpg)
Answering 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
![Page 31: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/31.jpg)
• 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]
Extracting a Distance Contour
![Page 32: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/32.jpg)
On Convex Test Models
• 32x32x32 CDFR, 5123 conventional res
![Page 33: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/33.jpg)
On Concave Test Models
• 32x32x32 CDFR, 5123 conventional res
![Page 34: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/34.jpg)
On Practical Parts
• 128x128x128 CDFR, 10243 conventional res
![Page 35: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/35.jpg)
On Practical Parts
• 128x128x128 CDFR,10243 conventional res
![Page 36: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/36.jpg)
Storage 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 + 4*triangle_cnt) bytes
![Page 37: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/37.jpg)
CDFR 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
![Page 38: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/38.jpg)
Testing Platform
• SGI Octane with 300MHz R12000 processor, 512 MB memory
![Page 39: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/39.jpg)
Contour 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
![Page 40: Discrete Space, Voxelization and Distance Fields Jian Huang, CS 594, Spring 2002](https://reader031.vdocuments.site/reader031/viewer/2022032703/56649d1a5503460f949ef167/html5/thumbnails/40.jpg)
The 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.