Download Polygonization of Implicit Surfaces

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Surface tension wikipedia , lookup

Low-energy electron diffraction wikipedia , lookup

Sessile drop technique wikipedia , lookup

Ultrahydrophobicity wikipedia , lookup

Adhesion wikipedia , lookup

Organ-on-a-chip wikipedia , lookup

Bio-MEMS wikipedia , lookup

Nanochemistry wikipedia , lookup

Transcript
Polygonization of Implicit Surfaces
Kenneth E. Hoff III
Computational Geometry Presentation
Sept ‘98
Overview
•
•
•
•
•
Define implicit surfaces
Why polygonize?
Why are they more difficult to render than “explicit” surfaces?
Why use them?
General framework for polygonization:
–
–
–
–
1D implicit “surfaces” (pts) : root-finding
2D implicit “surfaces” (contour lines)
Potential Problems
Application of framework to 3D
What is an implicit surface?
•
•
The set of points X that satisfies the implicit equation: f(X)=0
Points that satisfy the “property” defined by the implicit function f:
– sphere : pts at a specific distance from a point
– map height contour : pts at a specific height on a topographical map
•
•
Also called iso-surfaces or contour surfaces
The sign of the implicit function indicates whether a point is inside or outside
the surface (we use + to indicate inside)
Polygonization : Explicit vs. Implicit Definitions
•
Why polygonize?
– to obtain an efficient representation for rendering
•
Explicit functions
– Simple, direct polygonization
– Parametric surfaces:
• Vector-valued function so output is a surface point
• Just iterate through domain points to tesselate the surface
•
Implicit functions
–
–
–
–
More difficult to polygonize
Reduces to solving the implicit equation - multiple-root finding
Scalar-valued function so just gives a single value for any point in space.
Zero-set (or root) defines the surface
Implicit Surfaces are difficult to render. Why use them?
•
•
•
Simpler collision queries
Simpler CSG operations (union, difference, intersection)
Allows simple blending between primitive surfaces
– only changes f (polygonization method need not be modified)
•
Easy to apply free-form deformations
– only transforms input point to f (polygonization method need not be modified)
– have to invert the deformation M: f(M-1*x)=0
– “analytically” deformed
•
“Blobby” models, MetaBalls, etc.
1D Implicit “Surfaces” : 1D root-finding
•
•
•
•
f(x)
Given a function f, we wish to find the set of x
values (1D points) that satisfy f(x)=0
From calculus, the Intermediate Value
Theorem states: “as x varies from a to b, the
continuous function f takes on every value
between f(a) and f(b)”
If f(a) and f(b) have opposite signs, then the
root is said to be “bracketed” in the interval
[a,b]
BUT, how did we find a and b?
f(a)
x
f(b)
a
b
1D : How to bracket the root(s)
•
•
•
•
•
f(x)
Uniformly subdivide 1D point domain into cells.
Evaluate f for each cell boundary point
Cells enclosed by two grid pts that evaluate to
opposite signs contain at least one root
Is a non-uniform sampling better? Maybe, but
more difficult in higher dimensions.
How much of the domain do we subdivide?
+
+
x
a
b
-
1D : Finding the point domain subdivision boundaries
Small cells may bracket a root, but how much of the domain must be subdivided?
– Already know the extents of the implicit surface defined by f
– Conservatively guess the boundaries - inefficient and unreliable
– Use method that does not require domain subdivision
1D : Finding the bracketed root
•
•
If cell size is small enough, perhaps either boundary value may be close
enough to the root
OR use bisection search : depends on the intermediate value theorem
–
–
–
–
Recursively subdivide intervals bounded by grid pts evaluating to opposite signs
Continue until cell is below some threshold size
Boundaries or center value is considered “close enough” to the root of f
Why not start the uniform subdivision at this threshold size? Excessive evaluation
of grid pts.
+
+
+
-
-
a
b
a
b
a
b
2D Implicit “Surfaces” : Finding the boundary curve
•
•
Given a surface defined by f(X)=0 where X
= (x,y)
Bracket roots by subdividing 2D point
domain into rectangular cells
– Again, how much of the space should be
subdivided
•
•
•
Evaluate f at all grid pts
Roots are bracketed in cells that have grid
pt evaluations of opposite sign
The surface passes through cells containing
bracketed roots
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
2D : Find the surface passing through a bracketing cell
•
•
•
Similar to 1D, if cell subdivision is considered
small enough, simply find where the surface
intersects the edges of the cell and connect the
intersection points with a line.
Only search for crossings along edges whose
endpoints evaluate to opposite signs
OR perform adaptive subdivision
-
-
-
+
2D : Find the surface edge crossing
•
•
Given an edge whose endpoints evaluate to opposite signs
Use bisection search along the edge to find the intersection point
-
-
+
+
+
+
2D : Adaptive-subdivision
•
•
•
•
•
Recursively subdivide cells containing a surface
crossing down to a threshold cell size
Find surface crossings through smallest cells :
bisection search of crossed edges, connect
intersections
Since the adaptive subdivision is converged to a
threshold cell size for all areas containing the
boundary, adjacent cells containing the surface
are all the same size - no cracks and no
adjacency info is required; just dump the line
segments!
Again, we perform adaptive subdivision rather
than uniformly subdivide down to the threshold
size to avoid excessive evaluations of the
implicit function
Can we do better? Evaluate only for the
smallest, surface-crossing cells.
-
-
-
-
+
-
+
+
-
-
-
-
+
-
+
+
-
+
-
+
+
2D : Continuation methods
•
•
•
•
•
•
Assume the the domain space is uniformly subdivided into cells at the
threshold size, but do not perform any function evaluations
Find a single starting “seed” point that lies on the surface (use ray-casting, etc)
Find cell containing the seed point
“Grow” the set of cells across the surface
Evaluate adjacent grid pts to find next surface crossing cells (or use
constrained dynamics)
Do we even need a uniform subdivision (domain mesh)?
2D : Using particle systems to avoid meshing
Relaxation (Turk91):
• Distribute pts fairly evenly over surface
• Repeatedly iterate over all pts maintaining a certain neighbor distance
Adaptive Repulsion (Witkin94):
• Find any pt on the surface (seed pt)
• Give pt a large “sphere of influence”
• Pts with spheres of influence over a threshold size are split - fissioning
• Split pts have smaller spheres of influence
• Pts within another pt’s sphere of influence are repelled across surface
• Pts with sphere of influence below another threshold size are destroyed
Potential Problems
•
•
•
•
Bounding the Domain Space
Discretization Error
Disconnected Components
Ambiguous Surface-Crossing Cells
Potential Problem #1 : Bounding the Domain Space
•
•
•
May not completely contain the object
May miss disconnected components
Will result in “clipping”
Potential Problem #2 : Discretization Error
•
Too large uniform cell size:
– May not be able to converge (entirely miss the surface)
•
Too large adaptive threshold cell size:
– Misses small, completely-contained features
– Coarse resolution model
– Incorrect topology:
• ambiguous cells
• connects or breaks components
•
•
Too small cells sizes are inefficient and more susceptible to numerical error
Particle systems are an attempt to avoid this problem - no meshing!
Potential Problem #3 : Disconnected Components
•
•
Uniform cell subdivision may find them, but inefficiently
Particle system and continuation methods may miss them
– must have a seed pt on each component
•
•
Related to discretization error
Sometimes results from ambiguous cell polarity configurations
Potential Problem #4 : Ambiguous Surface-Crossing Cells
•
•
•
•
Many cell vertex polarity configurations are ambiguous
Possible to polygonize in different arrangements
May even result in disjoint polygons
Solutions:
– Detect and recursively subdivide
– Choose a consistent convention (e.g. always join positive pts)
– Use simplices (triangulate)
•
Also, related to discretization error
Review before going to 3D. . .
Method 1: Uniform Spatial Subdivision
•
•
•
Uniformly subdivide domain space into cells
Evaluate implicit function at grid pts to find surface crossing cells
Polygonize surface crossing cells
Method 2: Adaptive Spatial Subdivision
•
•
•
Start with Method 1
Adaptively subdivide surface crossing cells to threshold size
Polygonize surface crossing “leaf” cells
Method 3: Continuation
•
•
•
Find any pt on the surface (seed pt)
Find cell containing seed pt at threshold size
Grow surface crossing cells in directions determined by crossed cell boundaries
Method 4: Particle Systems
•
•
Distribute pts evenly and perform relaxation iterations
OR perform adaptive repulsion and fissioning
3D Implicit Surface Polygonization using Spatial Subdivision
Conceptually identical to 1D and 2D version:
• Given a surface defined by f(X)=0 where X = (x,y,z)
• Subdivide 3D space into uniform cells
• Evaluate implicit function for all grid points
• Find surface-crossing cells (check polarity of cell vertices)
• Subdivide surface-crossing cells to threshold size
• Search for surface-crossing along edges of opposite polarity
• Polygonize the cell based on the edge intersections - much more difficult in 3D
3D : Polygonizing a Surface-Crossing Cell
The most difficult part. . .
•
Finding cell polygon vertices
– Algorithmic method
– Table lookup (based on vertex polarities)
– Resolving ambiguities
•
Triangulating the cell polygon
3D : Finding cell polygon face vertices
Algorithmic method:
• Begin with any edge-surface intersection point (1)
• Proceed to negative corner (white open pts) and then clockwise about the cube
face (w.r.t outside) until another intersection point is found (2)
• Repeat for each subsequent face (34, 45, 51)
3D : Finding cell polygon face vertices
Table Lookup:
• Cube table lookup: 8 verts, 256 entries
• Tetrahedron table lookup: 4 verts, 16 entries
– Requires tetrahedral decomposition of the cube
– Tetrahedral subdivision is more difficult
3D : Finding cell polygon face vertices
Tetrahedral decomposition of the cube:
• Different ways to decompose: 5, 6, or 12 tetrahedra
• Adjacency problems: 5 must alternate, 6 and 12 is ok, but more expensive
• Even 24 is possible to avoid bias
3D : Finding cell polygon face vertices
Resolving ambiguities:
• many ambiguous polarity configurations
• resolve by subdividing, using tetrahedral decomposition, or by being
consistent (e.g. always join positive pts)
3D : Triangulating the cell polygon
•
•
•
non-coplanar
preserve aspect ratio
may insert new points
2
3
1
4
5
2
3
1
4
5
3D : Continuation Methods
Same as in 2D:
• Start with a seed pt and its containing cell
• Visit adjacent cells through surface crossing cube faces (faces that have
opposite vertex polarities)
• Grow until surface is covered
• Polygonize each cell
3D : Particle Systems
Similar to 2D:
• Use relaxation if we have a uniform distribution
– more expensive starting conditions
•
Use adaptive repulsion if we wish to “grow” across
the surface
– starts with a single point
– better for interactive applications
ASIDE: Ray Intersection with Implicit Surface
•
Particle system methods require ability to push particles around on the surface
–
–
–
–
Usually a random direction is chosen in the tangent plane
Requires gradient of implicit function
Jumping in random direction causes new position to be off of the surface
We know the gradient at the new position, so we have a ray (start is at new pt, dir is
along gradient towards the surface)
– RAY CASTING!
•
•
•
•
•
Ray defined by r(t) = S + Dt where S is ray start, D is ray direction, t is step in
units of length of D along ray
Implicit equation is defined as f(X)=0 where X is a point on the surface if
f(X)=0
Point along ray is defined by r(t), so substitute into f(X): f(r(t))=f(S+Dt)=0
This reduces to the 1D implicit equation f(t)=0
Solution(s) t of this equation correspond to the distance along the ray to a point
that lies on the surface. . .
ASIDE: Ray Intersection with Implicit Surface
•
•
•
•
•
We need only find the smallest positive root t of the 1D implicit equation
f(t)=0
We have the gradient vector-valued function: [ fx(X), fy(X), … ] that gives the
direction (in the domain) of maximum change in value of the implicit function
for a particular point (in the domain)
The domain of f(t) is [0,] since we are only concerned with intersections in
front of the ray start pos
We can try a variety of methods to find the root: uniform step size starting at
t=0, adaptive step size, Newton iterations (use directional derivative)
To use Newton’s methods, we need the derivative at particular t values: f’(t),
but we only have the gradient for pts in the implicit function domain: use the
directional derivative in the ray direction to get f’(t):
–
–
–
–
Given a t value for which we want f’(t):
Find pt in implicit function domain: r(t)=S+Dt
Evaluate gradient at r(t): G(t) = [ fx(r(t)), fy(r(t)), … ]
f’(t) = “directional derivative in ray dir w.r.t. G(t)” = DG(t)
References
Bloomenthal, Jules. Introduction to Implicit Surfaces. Morgan Kaufmann Publishers, Inc. San
Francisco, CA. 1997.
Bloomenthal, Jules. Polygonization of Implicit Surfaces. Computer Aided Geometric Design, Nov. 1988,
vol 5, p 341-355.
Witken, Andrew P. and Paul S. Heckbert. Using Particles to Sample and Control Implicit Surfaces.
SIGGRAPH ‘94, 1994, p 269-277.
Bloomenthal, Jules. Interactive Techniques for Implicit Modeling. Computer Graphics 24, 2 (Mar. 1990),
p 109-116.
Sclaroff, Stan and Alex Pentland. Generalized Implicit Functions for Computer Graphics. SIGGRAPH
‘91, July 1991, p 247-250.
Stander Barton T. and John C. Hart. Guaranteeing the Topology of Implicit Surface Polygonization for
Interactive Modeling. SIGGRAPH ‘97, 1997, p 279-286.
Lorenson, William E. and Harvey E. Cline. Marching Cubes: A High Resolution 3D Surface
Construction Algorithm. SIGGRAPH ‘87, July 1987, p 163-169.
Ning, Paul and Jules Bloomenthal. An Evaluation of Implicit Surface Tilers. IEEE Computer Graphics
and Applications. November 1993, p 33-41.
Turk, Greg. Generating Textures on Arbitrary Surfaces Using Reaction-Diffusion. SIGGRAPH ‘91,
July 1991, p 289-298.
Szeliski, Richard and David Tonnesen. Surface Modeling with Oriented Particle Systems. SIGGRAPH
‘92, July 1992, p 185-194.