Spring 2019 CSCI 621: Digital Geometry Processing 2.1 Explicit & Implicit Surfaces Hao Li http://cs621.hao-li.com 1
Administrative • Exercise 1 discussion: Next Time! • Hao Li (Instructor) • Office Hour: Tue 12:30 PM - 1:30 PM, SAL 244 • Zeng Huang (TA) • Office Hour: TBD, PHE 108 • zenghuan@usc.edu 2
Last Time Polygonal meshes are • Effective representations • Flexible • Efficient, simple, enables unified processing 3
Last Time Connection between Meshes and Graphs • Formalism (valence, connections, subgraph, embedding…) • Definitions (boundary, regular edge, singular edge, closed mesh) • triangulation → triangle mesh B A E F D C I H G K J 4
Last Time Topology • Genus, Euler characteristic • Euler Poincaré formula V − E + F = 2(1 − g ) • Average valence of triangle mesh: 6 • Triangles: F = 2V, E = 3V • Quads: F = V, E = 2V connected k=1 handle ≤ 2k edge loops 5
Last Time 2-Manifold Surface f ( D ✏ [ u, v ]) = D � [ f ( u, v )] • Local Neighborhood is disk-shaped • Guarantees meaningful neighbor enumeration • Non-manifold 6
Last Time Data Structures • Face-Based • Edge-Based, edges always have two faces • Halfedge-Based 7
When is a Triangle Mesh a Manifold? • Every Edge incident to 1 or 2 Triangles • Faces incident to a vertex form closed or open fan closed fan open fan 8
Outline • Surface Representations • Explicit Surfaces • Implicit Surfaces • Conversion 9
Explicit vs. Implicit f ( x ) = ( r cos( x ) , r sin( x )) T Explicit: f ([0 , 2 π ]) • Range of parameterization function x 2 + y 2 − r � F ( x, y ) = Implicit: F ( x, y ) < 0 • Kernel of implicit function F ( x, y ) = 0 F ( x, y ) > 0 10
Explicit vs. Implicit f ( x ) = ( r cos( x ) , r sin( x )) T Explicit: ? • Range of parameterization function • Piecewise approximation x 2 + y 2 − r � F ( x, y ) = Implicit: ? • Kernel of implicit function • Piecewise approximation 11
Explicit vs. Implicit Explicit: • Range of parameterization function • Piecewise approximation • Splines, triangle mesh, points • Easy enumeration • Easy geometry modification Implicit: • Kernel of implicit function • Piecewise approximation • Scalar-valued 3D grid • Easy in/out test • Easy topology modification 12 12
Examples: Fluid Simulation 13
Examples: Collisions 14
Examples: 3D Reconstruction Zippering Poisson Reconstruction 15
Examples: Kinect Fusion 1. Capture 2. Align 3. Fuse http://msdn.microsoft.com/en-us/library/dn188670.aspx 16
Outline • Surface Representations • Explicit Surfaces • Implicit Surfaces • Conversion 17
Polynomial Approximation Polynomials are computable functions p p c i t i = � � f ( t ) = c i φ i ( t ) ˜ i =0 i =0 Taylor expansion up to degree p p 1 i ! g ( i ) (0) h i + O ⇤ h p +1 ⇥ � g ( h ) = i =0 Error for approximation by polynomial f g f ( t i ) = g ( t i ) , 0 ≤ t 0 < · · · < t p ≤ h p 1 � h ( p +1) ⇥ ⇤ ( p + 1)! max f ( p +1) | f ( t ) − g ( t ) | ≤ ( t − t i ) = O i =0 18
Spline Surfaces Piecewise polynomial approximation n m � � c ij N n i ( u ) N m f ( u, v ) = j ( v ) i =0 j =0 19
Spline Surfaces Piecewise polynomial approximation Geometric constraints • Large number of patches • Continuity between patches • Trimming Topological constraints • Rectangular patches • Regular control mesh 20
Polygon Meshes Polygonal meshes are a good compromise O ( h 2 ) • Piecewise linear approximation → error is • Error inversely proportional to #faces • Arbitrary topology surfaces • Piecewise smooth surfaces • Adaptive sampling • Efficient GPU-based rendering/processing 21
Triangle Meshes M = ( { v i } , { e j } , { f k } ) v i ∈ R 3 geometry e i , f i ⊂ R 3 topology 22
Outline • Surface Representations • Explicit Surfaces • Implicit Surfaces • Conversion 23
Implicit Representations Level set of 2D function defines 1D curve 24
Implicit Representations Level set of 3D function defines 2D surface 25
Implicit Representations F ( x, y ) > 0 General implicit function: F ( x, y, z ) < 0 • Interior: F ( x, y ) < 0 F ( x, y, z ) > 0 • Exterior: F ( x, y, z ) = 0 • Surface: F ( x, y ) = 0 Gradient is orthogonal to level set r F Special case • Signed distance function (SDF) • Gradient is unit surface normal r F 26
Signed Distance Function SDF of a circle? General shapes 27
SDF Discretization Regular cartesian 3D grid • Compute signed distance at nodes • Tri-linear interpolation within cells F 011 F 111 F 000 (1 − u ) (1 − v ) (1 − w ) + u (1 − v ) (1 − w ) + F 100 F 010 F 101 F 010 (1 − u ) v (1 − w ) + F 001 (1 − u ) (1 − v ) w + . . . F 110 F 111 u v w F 000 F 100 28
3-Color Octree 3 Colors: interior,exterior,boundary 1048576 cells 12040 cells 29
Adaptively Sampled Distance Fields 12040 cells 895 cells 30
Binary Space Partitions 895 cells 254 cells 31
Regularity vs. Complexity Implicit surface discretizations O ( h − 3 ) • Uniform, regular voxel grids • Adaptive, 3-color octrees O ( h − 2 ) • Surface-adaptive refinement O ( h − 1 ) • Feature-adaptive refinement • Irregular hierarchies O ( h − 1 ) • Binary space partition (BSP) 32
Literature • Frisken et al., “Adaptively Sampled Distance Fields: A general representation of shape for computer graphics”, SIGGRAPH 2000 • Wu & Kobbel, “Piecewise Linear Approximation of Signed Distance Fields”, VMV 2003 33
Implicit Representations • Natural representation for volumetric data : 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) 34
CSG Example Union F C ∪ S ( · ) = min { F C ( · ) , F S ( · ) } Intersection F C ∩ S ( · ) = max { F C ( · ) , F S ( · ) } Difference F S \ C ( · ) = max { − F C ( · ) , F S ( · ) } 35
CSG Example 36
CSG Example: Milling 37
Outline • Surface Representations • Explicit Surfaces • Implicit Surfaces • Conversion 38
Conversion Explicit to Implicit • Compute signed distance at grid points • Compute distance point-mesh • Fast marching Implicit to Explicit F ( x, y, z ) = 0 • Extract zero-level iso-surface F ( x, y, z ) = C • Other iso-surfaces • Medical imaging, simulations, measurements, … 39
Signed Distance Computation Find closest mesh triangle • Use spatial hierarchies (octree, BSP tree) Distance point-triangle • Distance to plane, edge, or vertex • http://www.geometrictools.com Inside or outside? • Based on interpolated surface normals 40
Signed Distance Computation p = α p i + (1 − α ) p j • Closest point n = α n i + (1 − α ) n j • Interpolated normal ( q − p ) > n < 0 • Inside if n j q p j n p n i p i 41
Fast Marching Techniques • Initialize with exact distance in mesh’s vicinity • Fast-march outwards • Fast-march inwards 42
Literature • Schneider, Eberly, “Geometric Tools for Computer Graphics”, Morgan Kaufmann, 2002 • Sethian, “Level Set and Fast Marching Methods”, Cambridge University Press, 1999 43
Conversion Explicit to Implicit • Compute signed distance at grid points • Compute distance point-mesh • Fast marching Implicit to Explicit F ( x, y, z ) = 0 • Extract zero-level iso-surface F ( x, y, z ) = C • Other iso-surfaces • Medical imaging, simulations, measurements, … 44
2D: Marching Square 1. Classify grid nodes as inside/outside • Is or ? F ( x i,j ) > 0 < 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 45
2D: Marching Square ? 46
3D: Marching Cubes 1. Classify grid nodes as inside/outside • Is or F ( x i,j,k ) > 0 < 0 2. Classify cell: 2 8 configurations • In/out for each corner 3. Compute intersection points • Linear interpolation along edges 4. Connect them by edges • Look-up table for path configuration • Disambiguation by modified table [Montani ’94] 47
3D: Marching Cubes F i,j,k = F ( x i,j,k ) Classify grid nodes based on x i,j,k • Inside or outside Classify all cubes based on F i,j,k • Inside, outside, or intersecting Refined only intersected cells • 3-color adaptive octree O ( h − 2 ) • complexity 48
Intersection Points Linear interpolation along edges x i,j,k · | F i +1 ,j,k | + x i +1 ,j,k · | F i,j,k | | F i,j,k | + | F i +1 ,j,k | 49
Intersection Points Linear interpolation along edges x i,j,k · | F i,j +1 ,k | + x i,j +1 ,k · | F i,j,k | | F i,j,k | + | F i,j +1 ,k | 50
Intersection Points Linear interpolation along edges x i,j,k · | F i,j,k +1 | + x i,j,k +1 · | F i,j,k | | F i,j,k | + | F i,j,k +1 | 51
Recommend
More recommend