You are on page 1of 56

Geometric Modeling:

Explicit / Implicit Representations

Prof. Dr. Mario Botsch


Computer Graphics & Geometry Processing
Overview

• Surface representations
– Explicit vs. Implicit

• Explicit representations
– Triangle meshes

• Implicit representations
– Signed distance fields

• Conversions
– Explicit Implicit

2
Explicit vs. Implicit
T
• Explicit: f (x) = (r cos(x), r sin(x))
– Range of parametrization function
f ([0, 2π])

� F (x, y) < 0
• Implicit: F (x, y) = x2 + y 2 − r
– Kernel of implicit function
F (x, y) = 0
F (x, y) > 0

3
Explicit vs. Implicit
T
• Explicit: f (x) = (r???
cos(x), r sin(x))
– Range of parametrization function
– Piecewise approximation!


• Implicit: F (x, y) = ???
x2 + y 2 − r
– Kernel of implicit function
– Piecewise approximation!

4
Explicit vs. Implicit
• Explicit:
– Range of parametrization function
– Piecewise approximation!
– E.g. splines, triangle mesh
– Easy enumeration
– Easy geometry modification

• Implicit:
– Kernel of implicit function
– Piecewise approximation!
– E.g. scalar-valued 3D grid
– Easy in/out test
– Easy topology modification (CSG)
5
Overview

• Surface representations
– Explicit vs. Implicit

• Explicit representations
– Triangle meshes

• Implicit representations
– Signed distance fields

• Conversions
– Explicit Implicit

6
Polynomial Approximation

• Polynomials of degree p, elements of size h


– Approximation error is O(h p+1)

• Improve approximation quality by


– increasing p ... higher order polynomials
– decreasing h ... smaller / more segments

• Issues
– smoothness of the target data ( maxt f (p+1)(t) )
– smoothness conditions between segments

7
Spline Surfaces

• Piecewise polynomial approximation


!
n !
m
n m
f (u, v) = cij Ni (u) Nj (v)
i=0 j=0

8
Spline Surfaces

• Piecewise polynomial approximation

• Topological constraints
– Rectangular patches
– Regular control mesh

• Geometric constraints
– Large number of pathes
– Continuity between patches
– Trimming

9
Last Time

• Polygonal meshes for surface approximation

– approximation O(h2)

– arbitrary topology

– piecewise smooth surfaces

– adaptive refinement

– efficient rendering

10
Triangle Meshes

• Topology: vertices, edges, triangles


V = {v1 , . . . , vn }
E = {e1 , . . . , ek } , ei ∈ V × V
F = {f1 , . . . , fm } , fi ∈ V × V × V

• Geometry: vertex positions


3
P = {p1 , . . . , pn } , pi ∈ IR

11
Triangle Meshes

• Euler-Poincaré formula
|V| − |E| + |F| = 2(1 − g)

• Mesh statistics
– |F| ≈ 2 · |V|
– |E| ≈ 3 · |V|
– Avg. valence ≈ 6

12
Overview

• Surface representations
– Explicit vs. Implicit

• Explicit representations
– Triangle meshes

• Implicit representations
– Signed distance fields

• Conversions
– Explicit Implicit

13
Implicit Representations

• General implicit function:


– Interior: F(x,y,z) < 0 F (x, y) > 0
– Exterior: F(x,y,z) > 0
– Surface: F(x,y,z) = 0
F (x, y) < 0
• Special case
– Signed distance function (SDF)
– Gradient ∇F is surface normal F (x, y) = 0

14
Implicit Representations

• Level set of 2D function defines 1D curve

15
Signed Distance Function

• SDF of 2D circle?

• General shapes

16
SDF Discretization

• Regular cartesian 3D grid


– Compute signed distance at nodes
– Tri-linear interpolation within cells

F011 F111
F000 (1 − u) (1 − v) (1 − w) +
F010 F101 F100 u (1 − v) (1 − w) +
F010 (1 − u) v (1 − w) +
F001 (1 − u) (1 − v) w +
..
F110 .
F111 u v w
F000 F100

17
3-Color Octree

1048576 cells 12040 cells

18
Adaptively Sampled Distance Fields

12040 cells 895 cells

19
Binary Space Partitions

895 cells 254 cells

20
Regularity vs. Complexity

• Implicit surface discretizations


– Uniform, regular voxel grids
– Adaptive, 3-color octrees
• surface-adaptive refinement
• feature-adaptive refinement

– Irregular hierarchies
• binary space partition (BSP)

21
Regularity vs. Complexity

• Implicit surface discretizations


– Uniform, regular voxel grids O(h-3)
– Adaptive, 3-color octrees
• surface-adaptive refinement O(h-2)
• feature-adaptive refinement O(h-1)
– Irregular hierarchies
• binary space partition (BSP) O(h-1)

22
Literature
• Frisken et al, “Adaptively Sampled Distance Fields: A
general representation of shape for computer
graphics”, SIGGRAPH 2000

• Wu & Kobbelt, “Piecewise Linear Approximation of


Signed Distance Fields”, VMV 2003

23
Implicit Representations

• Natural representation for volumetric data, e.g.,


CT scans, density fields, etc.
• Advantageous when modeling shapes with
complex and/or changing topology (e.g. fluids)
• Very suitable representation for Constructive
Solid Geometry (CSG)

24
Constructive Solid Geometry

• Union
FC∪S (·) = min {FC (·) , FS (·)}

• Intersection
FC∩S (·) = max {FC (·) , FS (·)}

• Difference
FC\S (·) = max {FC (·) , −FS (·)}

25
CSG Example

26
CSG Example: Milling

27
Overview

• Surface representations
– Explicit vs. Implicit

• Explicit representations
– Triangle meshes

• Implicit representations
– Signed distance fields

• Conversions
– Explicit Implicit

28
Conversions

• Explicit to Implicit
– Compute signed distance at grid points
– Compute distance point-mesh
– Fast marching

• Implicit to Explicit
– Extract zero-level iso-surface F(x,y,z)=0
– Other iso-surfaces F(x,y,z)=C
– Medical imaging, simulations, measurements, ...

29
Signed Distance Computation

• Find closest mesh triangle


– Use spatial hierarchies (octree, BSP tree)

• Distance Point-Triangle
– Distance to plane, edge, or vertex
– See http://www.geometrictools.com

• Inside or outside?
– Based on interpolated surface normals

30
Signed Distance Computation

1. Closest point p = αpi + (1 − α)pj


2. Interpolated normal n = αni + (1 − α)nj
T
3. Inside if (q − p) n < 0
q nj

pj
n
p
ni
pi

31
Fast Marching Techniques
1. Initialize with exact distance in mesh’s vicinity
2. Fast-march outwards
3. Fast-march inwards

32
Literature
• Schneider, Eberly, “Geometric Tools for Computer
Graphics”, Morgan Kaufmann, 2002

• Sethian, “Level Set and Fast Marching Methods”,


Cambridge University Press, 1999

33
Conversions

• Explicit to Implicit
– Compute signed distance at grid points
– Compute distance point-mesh
– Fast marching

• Implicit to Explicit
– Extract zero-level iso-surface F(x,y,z)=0
– Other iso-surfaces F(x,y,z)=C
– Medical imaging, simulations, measurements, ...

34
2D: Marching Squares
1. Classify grid nodes as inside/outside
– Is F(xi,j) > 0 or < 0

2. Classify cell: 2 4 configurations


– In/out for each corner

3. Compute intersection points


– Linear interpolation along edges

4. Connect them by edges


– Look-up table for edge configuration

35
2D: Marching Squares

36
3D: Marching Cubes
1. Classify grid nodes as inside/outside
– Is F(xi,j,k) > 0 or < 0

2. Classify cell: 28 configurations


– In/out for each corner

3. Compute intersection points


– Linear interpolation along edges

4. Connect them by triangles


– Look-up table for path configuration
– Disambiguation by modified table [Montani 94]

37
Marching Cubes

• Classify grid nodes xi,j,k based on Fi,j,k = F(xi,j,k)


– Inside or outside

• Classify all cubes based on Fi,j,k


– Inside, outside, or intersecting

• Refined only intersected cells


– 3-color adaptive octree
– O(h-2) complexity

38
Intersection Points

• Linear interpolation along edges

xi,j,k · |Fi+1,j,k | + xi+1,j,k · |Fi,j,k |


|Fi,j,k | + |Fi+1,j,k |

39
Intersection Points

• Linear interpolation along edges

xi,j,k · |Fi,j+1,k | + xi,j+1,k · |Fi,j,k |


|Fi,j,k | + |Fi,j+1,k |

40
Intersection Points

• Linear interpolation along edges


xi,j,k · |Fi,j,k+1 | + xi,j,k+1 · |Fi,j,k |
|Fi,j,k | + |Fi,j,k+1 |

41
Intersection Points

• Linear interpolation along edges


• Lookup table for patch configuration

42
Marching Cubes
• Look-up table with 28 entries
– 15 representative cases shown
– Others follow by symmetry

43
Marching Cubes

• THE algorithm for isosurface extraction from


medical scans (CT, MRI)

44
Marching Cubes

• Sample points restricted to edges of regular grid


• Alias artifacts at sharp features

65×65×65

45
Increasing Resolution?

Does not remove alias problems!

46
Extended Marching Cubes

• Locally extrapolate distance gradient


• Place samples on estimated feature

65×65×65

47
Extended Marching Cubes

• Feature detection
– Classify into edges / corners
– Based on angle between normals ni

48
Extended Marching Cubes

• Feature sampling
– Intersect tangent planes (si, ni)
   
..   ..
 .T  x  T. 
n  · y  = n si 
 i  i 
.. z ..
. .

– Over- or under-determined system


– Solve by SVD pseudo-inverse

49
Extended Marching Cubes

• Feature sampling
– Intersect tangent planes (si, ni)
– Triangle fans centered at feature point

50
Extended Marching Cubes

Feature Feature Edge


Detection Sampling Flipping

51
Milling Simulation

257×257×257

52
CSG Modeling

65×65×65

53
Marching Cubes

+ Result is watertight, closed 2-manifold surface!


+ Easy to parallelize
- Uniform (over-)sampling (→ mesh decimation)

- Degenerate triangles (→ remeshing)


- MC does not preserve features

+ EMC preserves features, but...


– about 10% more triangles
– 20-40% computational overhead
54
Literature
• Lorensen & Cline, “Marching Cubes: A High
Resolution 3D Surface Construction Algorithm”,
SIGGRAPH 1987

• Montani et al, “A modified look-up table for implicit


disambiguation of Marching Cubes”, Visual Computer
1994

• Kobbelt et al, “Feature Sensitive Surface Extraction


from Volume Data”, SIGGRAPH 2001

55
Literature
• Polygon Mesh Processing
– Chapter 1

56

You might also like