Introduction to Computer Graphics – Modeling (3) – April 30, 2020 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 𝐪 ∈ ℝ ! is inside/outside of the model 𝑔 𝐪 : ℝ ! ↦ true, false • The whole interior of the model: 𝐪 𝑔 𝐪 = true } ⊂ ℝ ! • Examples: 𝐪 !$% Sphere of radius 𝑠 centered at 𝐝 Box whose min & max corners are 𝑦 !"# , 𝑧 !"# , 𝑨 !"# & 𝑦 !$% , 𝑧 !$% , 𝑨 !$% r c 𝑔 𝐪 ≔ 𝐪 − 𝐝 < 𝑠 𝑔 𝑦, 𝑧, 𝑨 ≔ 𝑦 !"# < 𝑦 < 𝑦 !$% ∧ 𝑧 !"# < 𝑧 < 𝑧 !$% 𝐪 !"# ∧ 𝑨 !"# < 𝑨 < 𝑨 !$% 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: 𝑒 𝐪 : ℝ ! ↦ ℝ • Signed: positive è outside, negative è inside • Corresponding predicate describing the solid: 𝑔 𝐪 ≔ 𝑒(𝐪) < 0 Sphere of radius 𝑠 centered at 𝐝 𝑒 𝐪 ≔ 𝐪 − 𝐝 − 𝑠 • Zero isosurface è model surface: {𝐪 | 𝑒(𝐪) = 0} ⊂ ℝ ! 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 𝑟 5 𝑒 5 𝐪 = − 𝑠 5 𝑒 𝐪 = 𝑒 3 𝐪 + 𝑒 4 𝐪 + 𝑒 6 𝐪 + 𝑒 7 𝐪 c 1 𝐪 − 𝐝 5 c 2 𝑒 𝐪 = 𝑒 3 𝐪 + 𝑒 4 (𝐪) 𝑒 𝐪 = 𝑒 3 𝐪 − 𝑒 4 (𝐪) 8
Morphing by interpolating implicit functions 2 3 𝑒 3 𝒒 + 1 1 3 𝑒 3 𝒒 + 2 𝑒 3 𝒒 = 0 𝑒 4 𝒒 = 0 3 𝑒 4 𝒒 = 0 3 𝑒 4 𝒒 = 0 9
Modeling by combining implicit functions 10
More advanced blending • When blending two implicit functions, consider their gradient directions and choose different blending accordingly Traditional (simple sum) Proposed A gradient-based implicit blend [Gourmel,Barthe,Cani,Wyvill,Bernhardt,Grasberger,TOG13] 11
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 L , now expired J ) Marching Cubes: A High Resolution 3D Surface Construction Algorithm [Lorensen SIGGRAPH87] 12
Example of 3D modeling tool using implicit surfaces 13 Shapeshop; Sketch-based solid modeling with blobtrees [Schmidt,Wyvill,Sousa,Jorge,SBIM05]
Example of 3D modeling tool using implicit surfaces 14 A sketching interface for modeling the internal structures of 3d shapes [Owada,Nielsen,Nakazawa,Igarashi,SmartGraphics03]
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] 15
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] 16
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/ 17
CSG with surface representation only • Volumetric representation (=isosurface extraction using MC) è Approximation accuracy depends on grid resolution L • CSG with surface representation only è Exactly keep original mesh geometry J • Difficult to implement robust & efficient L • 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] 18 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 shooting winding number rays from outside Simplification and Repair of Polygonal Models Using Volumetric Techniques [Nooruddin TVCG03] 19 Robust Inside-Outside Segmentation using Generalized Winding Numbers [Jacobson SIGGRAPH13]
Surface reconstruction from point cloud 20
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 • Too noisy? è Denoising Typical Computer Vision problems 21
Surface reconstruction from point cloud • Input: N points : , 𝑗 ∈ 1, … , 𝑂 9 , 𝑜 5 8 , 𝑜 5 • Coordinate 𝐲 5 = 𝑦 5 , 𝑧 5 , 𝑨 5 & normal 𝐨 5 = 𝑜 5 • Output: function 𝑔(𝐲) satisfying value & gradient constraints • 𝑔 𝐲 5 = 0 𝑔 5 • 𝛂𝑔 𝐲 5 = 𝐨 5 • 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 22
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] 23
Interpolation using M oving L east S quares 24
Starting point: L east SQ uares • For now, assume the function as linear: 𝑔 𝐲 = 𝑏𝑦 + 𝑐𝑧 + 𝑑𝑨 + 𝑒 • Unknowns: 𝑏, 𝑐, 𝑑, 𝑒 𝐲 ≔ (𝑦, 𝑧, 𝑨) • Value constraints at data points 𝑦 3 𝑧 3 𝑨 3 1 𝑔 𝑔 𝐲 3 = 𝑏𝑦 3 + 𝑐𝑧 3 + 𝑑𝑨 3 + 𝑒 = 𝑔 3 3 𝑦 4 𝑧 4 𝑨 4 1 𝑔 𝑏 𝑔 𝐲 4 = 𝑏𝑦 4 + 𝑐𝑧 4 + 𝑑𝑨 4 + 𝑒 = 𝑔 4 4 𝑐 𝐝 𝐵 = 𝐠 ・・・ ・・・ ・・・ 𝑑 𝑒 𝑦 ; 𝑧 ; 𝑨 ; 1 𝑔 𝑔 𝐲 ; = 𝑏𝑦 ; + 𝑐𝑧 ; + 𝑑𝑨 ; + 𝑒 = 𝑔 ; ; • (Forget about gradient constraints for now) 25
Overconstrained System • #unknowns < #constraints (i.e. taller matrix) è cannot exactly satisfy all the constraints “normal equation” 𝐵 ⊺ 𝐵 ⊺ 𝐵 𝐝 𝐵 𝐝 = = 𝐠 𝐠 • Minimizing fitting error ; 𝐵 ⊺ 𝑩 𝐝 − 𝐠 4 = F 𝐝 = 𝐵 ⊺ 𝐵 "# 𝐠 5 4 𝑔 𝐲 5 − 𝑔 5<3 26
Geometric interpretation of LSQ 𝐬 𝐫 𝑒 𝑞 8 𝑟 8 𝑠 𝛾 8 𝛽 𝑞 9 𝑟 9 = 𝑠 9 𝛾 𝑞 : 𝑟 : 𝑠 : 𝐪 𝛽 • Project 𝐬 onto a plane spanned by 𝐪 & 𝐫 • Fitting error = projection distance 𝑒 4 = 𝛽𝐪 + 𝛾𝐫 − 𝐬 4 27
W eighted L east S quares • Each data point is weighted by 𝑥 3 • Importance, confidence, ... • Minimize the following fitting error: ; 4 F 𝑥 5 𝑔 𝐲 5 − 𝑔 5 5<3 𝑦 3 𝑧 3 𝑨 3 1 𝑔 𝑥 3 𝑥 3 3 𝑥 4 𝑦 4 𝑧 4 𝑨 4 1 𝑔 𝑏 𝑥 4 4 𝑐 𝐝 𝑋 𝐵 𝑋 = 𝐠 ・・・ ・・・ ・ ・ 𝑑 ・ ・ ・ ・ 𝑒 𝑦 ; 𝑧 ; 𝑨 ; 1 𝑔 𝑥 ; 𝑥 ; ; 28
W eighted L east S quares 𝑋 𝐵 𝐝 𝑋 = 𝐠 𝐵 ⊺ 𝑋 4 𝐝 = 𝐠 𝐵 ⊺ 𝑋 " 𝐵 #$ 29
M oving L east S quares • Weight 𝑥 " is a function of evaluation point 𝐲 : 𝑥 " 𝐲 = 𝑥( 𝐲 − 𝐲 " ) • Popular choices for the function (kernel): • 𝑥 𝑠 = 𝑓 #$ & /& & Larger the weight as 𝐲 is closer to 𝐲 5 ' • 𝑥 𝑠 = $ & () & • Weighting matrix 𝑋 is a function of 𝐲 è Coeffs 𝑏, 𝑐, 𝑑, 𝑒 are functions of 𝐲 𝑏(𝐲) 𝑐(𝐲) 𝐵 ⊺ 𝑋 𝐲 4 𝐠 𝑔 𝐲 = 𝑦 𝑧 𝑨 1 𝐵 ⊺ 𝑋 𝐲 ( 𝐵 )* 𝑑(𝐲) 𝑒(𝐲) 30
Recommend
More recommend