Advanced Computer Graphics Mesh Processing G. Zachmann University of Bremen, Germany cgvr.cs.uni-bremen.de Consistent Normal Orientation for Meshes § Problem: § Many models (especially, created with modelling tools) consist of many unconnected patches § Patches do not necessarily have consistent orientation of normals § Bad consequences: § Two-sided lighting is necessary (slightly slower than one-sided lighting) § BSP representation of polyhedra is easier to construct with consistent normals (see "Computational Geometry for CG") § And many more … G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 5 § Idea for solution: boundary coherence = patches with common boundaries should be oriented consistently or § This is fairly straight-forward to implement, provided we have complete neighborhood information (topology) § And assuming the mesh is closed G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 6 § General procedure: 1. Detect edges incident to only 1 polygon (boundary edges), or incident to more than 2 polygons (non-manifold edges) 2. Partition mesh into 2-manifold patches 3. Orient normals consistently within each patch (propagate consistent normal direction from one polygon to the next throughout a patch) 4. Determine patch-patch boundaries close to each other (i.e., that "should" be connected) 5. Propagate normal orientations across those boundaries, too G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 7 § More results: Before After G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 8 Mesh Smoothing § Frequent problem: meshes are a bit noisy Typical output of marching cubes Output from laser scanner after meshing Desired, smoothed mesh § Idea: "convolve" mesh with a filter (kernel), like Gaussian filter for images G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 9 Recap: Image Smoothing (Blurring) § Simple, linear filtering by convolution: § I = I (x,y) = input image J = J(x,y) = output image J(x, y ) = X I(x + i, y + j)H(i, j) i= k,...,+k j= k,...,+k § H is called a kernel, k = kernel width § Sequential algorithm to construct J: § Slide a k×k window across I § At every pixel of I, compute average of I inside window, weighted by H G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 10 § Examples: § Gaussian kernel H 1 16 1 2 1 2 4 2 1 2 1 § Box filter (= simple averaging): H 1 9 G. Zachmann 1 1 1 1 1 1 1 1 1 Advanced Computer Graphics SS 15 June 2016 Mesh Processing 11 Comparison Original Box G. Zachmann Gaussian Advanced Computer Graphics SS 15 June 2016 Mesh Processing 12 Digression: Edge Extraction Sobel 1 0 -1 2 0 -2 1 0 -1 Vertical edges (absolute value) G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 13 Sobel 1 2 1 0 0 0 -1 -2 -1 Horizontal edges (absolute value) G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 14 § Problem: we can't simply apply the convolution idea to meshes! § Why not? § Meshes don't have a canonical , tensor-structure-like parameterization! § I.e., usually there is no parameterization like x and y in the plane § Goal: filter without parameterization G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 15 Laplacian Smoothing § Idea: § Consider edges as springs § For a vertex v0, determine its position of least energy within its 1-ring § Energy of v0: 1 E = 2 v0 d X i =1 kvi vd v0 k2 v1 § Necessary condition for minimum: derivative equals zero dE = dv0 § Iterative procedure: G. Zachmann d X (vi v0 ) = 0 i =1 d X 1 0 v0 = vi d i =1 Advanced Computer Graphics SS 15 June 2016 Sometimes a.k.a. "umbrella operator" Mesh Processing 16 § Generalization by "influence" of adjacent vertices and "speed": kk X X P vv00 = w(v with wi = 1 , wi 0 = i (v i i vv 0 )0 ) , i=1 i=1 v00 = v0 + v0 § Simplest form of the weights: k 1X v0 = (vi d i =1 v0 ) where d = degree of v0 = number of neighbors § Better weights are wi = or 1 kvi v0 k wi = e kvi v0 k2 (see chapter "Object Representations" for more) G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 17 Comparison with Other Smoothing Operators G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 21 Laplace-Smoothing Causes Shrinking Original With noise After 4 iterations After 80 iterations G. Zachmann Advanced Computer Graphics After 10 iterations After 400 iterations SS 15 June 2016 Mesh Processing 22 A Simple Extension to Prevent Shrinking d § Like before, for every vi compute vj 1 1 X vi = (vj d vi vi vj 2 vi ) j2N (i) § Average all neighboring Δ's (including the own Δ): 1 X di = d vj j2N (i) § Push the new vertex towards the 1-ring equilibrium and outwards away from the local direction of contraction: vi0 = vi + ↵( vi G. Zachmann Advanced Computer Graphics SS di ) 15 June 2016 Mesh Processing 23 computer is digitization. From the cloudsurface of points his paper presentsgraphics a technique for smoothing polygonal meshes that avoids the well-known problem of scanned by digitizing devices like laser scanners or tactile eformation and shrinkage caused by many smoothing methods, like e.g. the Laplacian algorithm. The basic idea a surface description mayback be obtained connectto pushscanners, the vertices of the smoothed mesh towards by their previous locations. This technique can be also used Comparison ing the points in an appropriate manner into a surface n order to smooth unstructured point sets, by reconstructing a mesh, surface mesh to which the smoothing technique is e.g. a mesh of triangles. pplied. The key observation is that a surface mesh which is not necessarily topologically correct, but which can ficiently be reconstructed, is sufficient for that purpose. oduction l approach to acquire complex geometric models in er graphics is digitization. From the cloud of points by digitizing devices like laser scanners or tactile s, a surface description may be obtained by connectpoints in an appropriate manner into a surface mesh, esh of triangles. consequence is that the mesh has to be smoothed, with the goal to remove the noise. Smoothing with pushback Figure 2: From left to right: origin, noisy mesh, thr tions of our algorithm. Laplacian smoothing One approach to surface smoothing is the Lapl gorithm. Versions of Laplacian smoothing are e.g. k image processing and finite-element-meshing.1 2 3 4 sic idea in image processing is to replace the grey Unfortunately, the digitized points often do not reflect the a pixel with an average of the grey values of pixels correct location on the real surface, because of physical noise neighborhood. Similarly, the location of a vertex in added by the technical scanning device. The effect is that element mesh is corrected by calculating a new lo SS 15 June 2016 G. Zachmann Advanced Computer Graphics Mesh Processing the reconstructed surfaces often do not look satisfactory. The the locations of vertices in24the neigh Figure 2: From the left average to right:oforigin, noisy mesh, three itera- Figure 1: From left to right: origin, noisy mesh, three iterations of the Laplacian algorithm. Global Laplacian Smoothing § Given: mesh M = (V, E, F), V = {v1, …, vn}, vi = (xi, yi, zi) § Sought: mesh M' with vertices vi' such that § M' is smoother than M, and § M' approximates M § If M' was perfectly smooth (i.e., a plane), then 8i : X wij (vj0 vi0 ) = 0 (1) j2N (vi0 ) § Can be written as 3 systems of linear equations, one for x coords, one for y coords, one for z G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 25 0 1 x10 Bx 0 C 2C § Consider the x coords; write (1) as LB B .. C = 0 @.A xn0 8 > < 1 ,i = j where L is a n×n matrix, with Lij = wij , (i, j) 2 E > : 0 , else § Analogously construct a system of equations of y and z G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 26 § Avoiding shrinking: introduce the constraint that the barycenters of the new triangles are the same as the barycenters of the old ones 1 0 1 0 0 8(i, j, k) 2 F : (vi + vj + vk ) = (vi + vj + vk ) 3 3 0 1 x10 ✓ ◆ B 0C ✓ ◆ x2 C 0 § Write (1) and (2) as L B = B C B @ ... A b xn0 (2) (3) where B is a m×n matrix, m = number of triangles, and b is a column vector with m entries, with the k-th row corresponds to triangle Fk = (i1, i2, i3) and Bki = 1 for i = i1, i2, i3, 0 elsewhere, and bk = G. Zachmann 1 (x 3 i1 3 + xi2 + xi3 ) Advanced Computer Graphics SS 15 June 2016 Mesh Processing 27 § Solve (over-determined) system (3), which has the form Ax = c in the least squares sense: x = (AT A) 1 AT c § In real life, use a sparse solver, e.g., TAUCS or OpenNL § Results: fea is su Original G. Zachmann Smoothed (a ) Advanced Computer Graphics so the po (b ) SS 15 June 2016 Mesh Processing 28 po § Further problem: certain points should be retained § Solution: introduce constraints § Pick feature points vi1 , . . . , vik (a ) - Either by user, or by automatic salient point detectors (b ) Figure 2. Global Laplacian smoothed mesh § Add constraint vi0 = vil , l = 1, . . . , kwith 0 1 barycenter constraints. (a) the(4) origil § Add equations (4) to system (3): 0 0 nal1birdx1mesh; 0 the 1 smoothed mesh (b) L 0 Bx 0 Cconstraints barycenter with parameter 2C B @B A B . C = @b A 0=3. @ .. A C c 0 xn with = The positions of the vertices can be found by solving the where C is a matrix containing normal equation of Eq. 7, which is equivalent to minimizing following error function: in every row l just one 1 at position c , 1≤l≤k, il the P 0 2 0 2 2 kLX k + |v v | min and c = (xi1 , . . . , xik ) n n X0 n5F ¯ ¯2 2¯ 0 0 0 ¯ = (v + v + v ) (v + v + v ) l m n seperately l m n P + § Again, we do this for x-, y-, and z-coordinates hl>m>ni5I G. Zachmann Advanced Computer Graphics SS Note that the linear system is also defined for each com15ponent June 2016 MeshThe Processing 30 the of the coordinates {> |> and}. positions of vertices can be found by solving the linear system in Eq. 7 model of an “8” model with heavily added random noise; (b) the smoothed mesh with parameters = 5 and = 0=1. § More results: Model Eight (Fig. 3) Dog (Fig. 4) Dragon (Fig. 5) Venus (Fig. 6) Vertex N 1 1 1 Table 1. Running time shown in the paper. 6. Conclusions In this paper a novel tec noise in arbitrary mesh surf Noisy original Smoothed (a ) (b ) applied successfully. The La over the mesh surface in a g Figure 4. Denoising a scanned mesh of a dog smoothed by solving a spars model using our global Laplacian smoothing straints and barycenter cons approach: (a) the noisy mesh data; (b) the linear system to keep the fe smoothed mesh with parameters = 5 and to avoid the shrinkage and = 0=03. ing. The proposed approac it is non-iterative, fast and ef non-manifold meshes. We our approach over traditiona Noisy original Laplacian smoothing Bilateral smoothing Global smoothing (a) (b ) (c ) (d ) mental results. The presented approach Figure 6. Comparisons with other smoothing approaches. Observe the difference in details the provements andinextensions. 15 June 2016(b) the result denoised Zachmann Advanced Computer Graphics 31 area of G. the lip and eye: (a) the noisy Venus headSSmesh data; byProcessing the traditional Mesh used in our approach shou Laplacian smoothing approach; (c) the result using bilateral filtering approach in [11]; (d) the result Simplification § Simplification: Generate a coarse mesh from a fine mesh § While maintaining certain critera (will not be discussed further here) § Elementary operations: § Edge collapse: - All edges adjacent to the edge are required § Vertex removal: - All edges incident to the vertex are needed G. Zachmann Advanced Computer Graphics SS 15 June 2016 Mesh Processing 33