Introduction to Computer Graphics – Modeling (3) – April 27, 2017 Kenshi Takayama
Solid modeling 2
Thin shapes represented Unorientable Solid models by single polygons • Clear definition of “inside” & “outside” at any 3D point Open boundaries (holes) Self-intersections Non-solid cases Klein bottle • Main usage: 3D printing Physics simulation 3
Predicate function of a solid model • Function that returns true/false if a 3D point 𝐪 ∈ ℝ 3 is inside/outside of the model 𝑔 𝐪 : ℝ 3 ↦ true, false • The whole interior of the model: 𝐪 𝑔 𝐪 = true } ⊂ ℝ 3 • Examples: 𝐪 max Sphere of radius 𝑠 centered at 𝐝 Box whose min & max corners are 𝑦 min , 𝑧 min , 𝑨 min & 𝑦 max , 𝑧 max , 𝑨 max r c 𝑔 𝐪 ≔ 𝐪 − 𝐝 < 𝑠 𝑔 𝑦, 𝑧, 𝑨 ≔ 𝑦 min < 𝑦 < 𝑦 max ∧ 𝑧 min < 𝑧 < 𝑧 max 𝐪 min ∧ 𝑨 min < 𝑨 < 𝑨 max 4
C onstructive S olid G eometry (Boolean operations) Union 𝐵 ∩ 𝐶 ∖ 𝐷 ∪ 𝐸 ∪ 𝐹 𝑔 𝐵∪𝐶 𝐪 ≔ 𝑔 𝐵 (𝐪) ∨ 𝑔 𝐶 (𝐪) Intersection 𝑔 𝐵∩𝐶 𝐪 ≔ 𝑔 𝐵 (𝐪) ∧ 𝑔 𝐶 (𝐪) Subtraction 𝑔 𝐵∖𝐶 𝐪 ≔ 𝑔 𝐵 (𝐪) ∧ ¬𝑔 𝐶 (𝐪) A B C CSG Tree D E 5
Solid model represented by S inged D istance F ield • Shortest distance from 3D point to model surface: 𝑒 𝐪 : ℝ 3 ↦ ℝ • Signed: positive outside, negative inside • Corresponding predicate describing the solid: 𝑔 𝐪 ≔ 𝑒(𝐪) < 0 Sphere of radius 𝑠 centered at 𝐝 𝑒 𝐪 ≔ 𝐪 − 𝐝 − 𝑠 • Zero isosurface model surface: {𝐪 | 𝑒(𝐪) = 0} ⊂ ℝ 3 r • Aka. “implicit” or “volumetric” representation c • Isosurface normal matches with direction of gradient 𝛂𝑒(𝐪) 6
Examples of implicit functions Not necessarily distance functions Torus with major & minor radii R & a 7
Examples of implicit functions: Metaballs c 4 c 3 𝑟 𝑗 𝑒 𝑗 𝐪 = − 𝑠 𝑒 𝐪 = 𝑒 1 𝐪 + 𝑒 2 𝐪 + 𝑒 3 𝐪 + 𝑒 4 𝐪 c 1 𝑗 𝐪 − 𝐝 𝑗 c 2 𝑒 𝐪 = 𝑒 1 𝐪 + 𝑒 2 (𝐪) 𝑒 𝐪 = 𝑒 1 𝐪 − 𝑒 2 (𝐪) 8
Morphing by interpolating implicit functions 1 3 𝑒 1 𝒒 + 2 2 3 𝑒 1 𝒒 + 1 𝑒 1 𝒒 = 0 𝑒 2 𝒒 = 0 3 𝑒 2 𝒒 = 0 3 𝑒 2 𝒒 = 0 9
Modeling by combining implicit functions 10
Visualizing implicit functions: Marching Cubes • Extract isosurface as triangle mesh • For every lattice cell: (1) Compute function values at 8 corners (2) Determine type of output triangles based on the sign pattern • Classified into 15 using symmetry (3) Determine vertex positions by linearly interpolating function values (Once patented , now expired ) Marching Cubes: A High Resolution 3D Surface Construction Algorithm [Lorensen SIGGRAPH87] 11
Ambiguity in Marching Cubes Discontinuous faces across neighboring cells New rules to resolve ambiguity The asymptotic decider: resolving the ambiguity in marching cubes [Nielson VIS91] 12
Marching Tetrahedra • Use tetrahedra instead of cubes • Fewer patterns, no ambiguity Simpler implementation • A cube split into 6 tetrahedra • (Make sure consistent splitting across neighboring cubes) • Some techniques to improve mesh quality http://paulbourke.net/geometry/polygonise/ Regularised marching tetrahedra: improved iso-surface extraction [Treece C&G99] 13
Isosurface extraction preserving sharp edges Grid size: 65 × 65 × 65 Improved version ( uses function gradient as well ) Marching Cubes Improved version Marching Cubes ( only uses function values ) Feature Sensitive Surface Extraction from Volume Data [Kobbelt SIGGRAPH01] Dual Contouring of Hermite Data [Ju SIGGRAPH02] http://www.graphics.rwth-aachen.de/IsoEx/ 14
CSG with surface representation only • Volumetric representation (=isosurface extraction using MC) Approximation accuracy depends on grid resolution • CSG with surface representation only Exactly keep original mesh geometry • Difficult to implement robust & efficient • Floating point error • Exactly coplanar faces • Notable advances in recent years Fast, exact, linear booleans [Bernstein SGP09] Exact and Robust (Self-)Intersections for Polygonal Meshes [Campen EG10] Mesh Arrangements for Solid Geometry [Zhou SIGGRAPH16] 15 https://libigl.github.io/libigl/tutorial/tutorial.html#booleanoperationsonmeshes
Mesh repair Decide inside/outside Volumetric representation Surface representation based on generalized Decide inside/outside by winding number shooting rays from outside Simplification and Repair of Polygonal Models Using Volumetric Techniques [Nooruddin TVCG03] 16 Robust Inside-Outside Segmentation using Generalized Winding Numbers [Jacobson SIGGRAPH13]
Surface reconstruction from point cloud 17
Measuring 3D shapes Range Scanner (LIDAR) Depth Camera Structured Light • Obtained data: point cloud • 3D coordinate • Normal (surface orientation) Multi-View Stereo • Normals not available? Normal estimation Typical Computer Vision problems • Too noisy? Denoising 18
Surface reconstruction from point cloud • Input: N points z , 𝑗 ∈ 1, … , 𝑂 • Coordinate 𝐲 𝑗 = 𝑦 𝑗 , 𝑧 𝑗 , 𝑨 𝑗 & normal 𝐨 𝑗 = 𝑜 𝑗 y , 𝑜 𝑗 x , 𝑜 𝑗 • Output: function 𝑔(𝐲) satisfying value & gradient constraints • 𝑔 𝐲 𝑗 = 0 𝑔 𝑗 • 𝛂𝑔 𝐲 𝑗 = 𝐨 𝑗 • Zero isosurface 𝑔 𝐲 = 0 output surface • “Scattered Data Interpolation” • M oving L east S quares • R adial B asis F unction Important to other fields (e.g. Machine Learning) as well 19
Two ways for controlling gradients • Additional value constraints at offset locations • Simple • Directly include gradient constraint in the mathematical formulation (Hermite interpolation) • High-quality Value+gradient constraints Hermite interpolation Simple offsetting Modelling with implicit surfaces that interpolate [Turk TOG02] Hermite Radial Basis Functions Implicits [Macedo CGF10] 20
Interpolation using M oving L east S quares 21
Starting point: L east SQ uares • For now, assume the function as linear: 𝑔 𝐲 = 𝑏𝑦 + 𝑐𝑧 + 𝑑𝑨 + 𝑒 • Unknowns: 𝑏, 𝑐, 𝑑, 𝑒 𝐲 ≔ (𝑦, 𝑧, 𝑨) • Value constraints at data points 𝑦 1 𝑧 1 𝑨 1 1 𝑔 𝑔 𝐲 1 = 𝑏𝑦 1 + 𝑐𝑧 1 + 𝑑𝑨 1 + 𝑒 = 𝑔 1 1 𝑦 2 𝑧 2 𝑨 2 1 𝑏 𝑔 𝑔 𝐲 2 = 𝑏𝑦 2 + 𝑐𝑧 2 + 𝑑𝑨 2 + 𝑒 = 𝑔 2 2 𝑐 𝐝 𝐵 = ・・・ ・・・ ・・・ 𝐠 𝑑 𝑒 𝑦 𝑂 𝑧 𝑂 𝑨 𝑂 1 𝑔 𝑔 𝐲 𝑂 = 𝑏𝑦 𝑂 + 𝑐𝑧 𝑂 + 𝑑𝑨 𝑂 + 𝑒 = 𝑔 𝑂 𝑂 • (Forget about gradient constraints for now) 22
Overconstrained System • #unknowns < #constraints (i.e. taller matrix) cannot exactly satisfy all the constraints “normal equation” 𝐵 ⊺ 𝐵 ⊺ 𝐵 𝐝 𝐵 𝐝 = = 𝐠 𝐠 • Minimizing fitting error 𝑂 𝐵 ⊺ 𝑩 𝐝 − 𝐠 2 = 𝐝 𝐵 ⊺ 𝐵 −1 = 𝐠 2 𝑔 𝐲 𝑗 − 𝑔 𝑗 𝑗=1 23
Geometric interpretation of LSQ 𝐬 𝐫 𝑒 𝑞 x 𝑟 x 𝑠 x 𝛾 𝛽 𝑞 y 𝑟 y 𝑠 = y 𝛾 𝑞 z 𝑟 z 𝑠 z 𝐪 𝛽 • Project 𝐬 onto a plane spanned by 𝐪 & 𝐫 • Fitting error = projection distance 𝑒 2 = 𝛽𝐪 + 𝛾𝐫 − 𝐬 2 24
W eighted L east S quares • Each data point is weighted by 𝑥 𝑗 • Importance, confidence, ... • Minimize the following fitting error: 𝑂 2 𝑥 𝑗 𝑔 𝐲 𝑗 − 𝑔 𝑗 𝑗=1 𝑥 1 𝑦 1 𝑧 1 𝑨 1 1 𝑥 1 𝑔 1 𝑥 2 𝑦 2 𝑧 2 𝑨 2 1 𝑏 𝑥 2 𝑔 2 𝑐 𝐝 = 𝑋 𝐵 ・・・ 𝑋 ・・・ 𝐠 𝑑 𝑒 𝑥 𝑂 𝑦 𝑂 𝑧 𝑂 𝑨 𝑂 1 𝑔 𝑥 𝑂 𝑂 25
W eighted L east S quares 𝑋 𝐵 𝐝 𝑋 = 𝐠 𝐵 ⊺ 𝑋 2 𝐝 = 𝐠 𝐵 ⊺ 𝑋 2 𝐵 −1 26
M oving L east S quares • Weight 𝑥 𝑗 is a function of evaluation point 𝐲 : 𝑥 𝑗 𝐲 = 𝑥( 𝐲 − 𝐲 𝑗 ) • Popular choices for the function (kernel): Larger the weight as • 𝑥 𝑠 = 𝑓 −𝑠 2 /𝜏 2 𝐲 is closer to 𝐲 𝑗 1 • 𝑥 𝑠 = 𝑠 2 +𝜗 2 • Weighting matrix 𝑋 is a function of 𝐲 Coeffs 𝑏, 𝑐, 𝑑, 𝑒 are functions of 𝐲 𝑏(𝐲) 𝑐(𝐲) 𝐵 ⊺ 𝑋 𝐲 2 𝐠 𝐵 ⊺ 𝑋 𝐲 2 𝐵 −1 𝑔 𝐲 = 𝑦 𝑧 𝑨 1 𝑑(𝐲) 𝑒(𝐲) 27
Introducing gradient (normal) constraints • Consider linear function represented by each data point: 𝑗 + 𝐲 − 𝐲 𝑗 ⊺ 𝐨 𝑗 𝑗 𝐲 = 𝑔 • Minimize fitting error to each 𝑗 evaluated at 𝐲 : 𝑂 2 𝑥 𝑗 𝐲 𝑔 𝐲 − 𝑗 𝐲 𝑗=1 𝑦 𝑧 𝑨 1 1 𝐲 𝑥 1 (𝐲) 𝑥 1 (𝐲) 𝑦 𝑧 𝑨 1 2 𝐲 𝑥 2 (𝐲) 𝑏 𝑥 2 (𝐲) 𝑐 = ・・・ ・・・ 𝑑 𝑒 𝑥 𝑂 (𝐲) 𝑦 𝑧 𝑨 1 𝑥 𝑂 (𝐲) 𝑂 𝐲 Interpolating and Approximating Implicit Surfaces from Polygon Soup [Shen SIGGRAPH04] 28
Recommend
More recommend