Mesh deformation algorithm

Foreword:

The author just needs to pre-develop the deformation algorithm of the discrete model Mesh because of the major needs of animation, simulation, etc., and to verify and study the scope of application, especially the performance, etc., don't spray while crossing the river by feeling the stones. It is rendering, animation, and engine. I am not very familiar with computational geometry and 3D reconstruction, especially for the deformation of some animations.
The deformation algorithm for a triangular mesh should satisfy the following two basic conditions

  1. Can be hidden behind the interface
  2. Efficient enough to meet interactive needs

For deformation, according to the description of deformation in Chapter 9 of "Polygon mesh processing", deformation can be roughly divided into two types:

  1. Space Deformations (Space Deformations) : That is, the deformation of the surface is implicit. Since the calculation does not depend on the triangular mesh surface S, it is not affected by mesh complexity and quality; eg FFD algorithm.
  2. **Surface-Based Deformations: **That is, calculations are performed on triangular meshes. This type of method can have a high degree of control and can control every vertex, but its robustness is not good, and its operating efficiency often depends on the complexity and quality of the grid; for example, the famous and most basic surface deformation "Laplace New Transformation", ARAP Transformation, etc.

Static FFD algorithm:

Basic theory: Bezier curve, curved surface, hypersurface; pay special attention to that B-spline curve is actually an extension of Bezier curve, B refers to Basic, or Bezier curve is a special case of B-spline curve, B-like The first curve solves the shortcoming of the Bezier curve that affects the whole body by a series of limited basis function combinations.
insert image description here
insert image description here

The classic control point deformation algorithm FFDs, the classic FFD algorithm is mainly used in the lattice modifier in Blender;

FFD is based on a 3rd degree Bezier hypersurface interpolation or 3rd degree cubic spline interpolation
:

  • Define the local coordinate system on the parallelepiped;
  • Computes the (s,t,u) coordinates of any point in the parallelepiped.
  • There is a control point P(l,m,n) on the parallelepiped to control the mesh grid.
  • Move the control point P around, causing the object to deform.
  • Get new positions based on Bezier hypercurves (basis functions for B-splines) or other types of polynomials.

A point in the STU coordinate system:
insert image description here
Deformation point:
insert image description here

Disadvantages of FFDs

  • The parallelepiped mesh shape constrains the deformation shape, and the control points cannot be arbitrary.
  • Random distribution of control points in space cannot be controlled.
  • The Bezier base function has a global influence and affects the Mesh.
  • Discontinuities in deformed space at lattice boundaries, how do overlapping lattices deform space?

So an extension to address these :

- B-spline basis FFD (Purgathofer).
- Extended FFD (Coquillart)
- deCasteljau FFD (Chang & Rockwood)
- Catmull-Clark FFD (McCracken & Joy)
- Dirichlet FFD (Moccozet and Thalmann)

Even extensions and distortions for FFD still exist

"If the displacement of a certain point is given as a constraint condition, the result will be flawed. We assume that there are N control points and M constraint coordinate points. We have limited the displacement of these M points, but we do not know the control points. How to move to get these M points!"

The problem.

Conclusion : Each model vertex can be obtained by weighting the position of the control point. The weight of each control point to each vertex depends on the coordinates of the vertex in the coordinate system of the control point (the deformation weight is still only related to the position), which is the weight of a B-spline basis function in classic FFD. Because the weights only depend on the initial geometry position, they can be precomputed, so the calculation is fast when deforming. But it is not suitable for fine adjustments, only for large-scale changes. For virtual clothes, it is easy to cause character clothes to be distorted; and it is impossible to judge the mapping relationship between a certain corner point and the actual deformation effect.

Attach the code implementation of Static Bezier function generator FFD .

Radial basis function algorithm

Radial Basis Function (RBF) basic theory: It is a real-valued function whose value depends only on the distance to the origin (the function value is a "real number", and cannot take imaginary numbers or ±∞). It can also be pressed to a certain center point c Among them, the function paradigm is generally Euclidean distance, but other distance functions can also be used, which can be used for the sum of many vector function bases to approximate a given function.
insert image description here
RBF deformation does not need to build additional bone joints, but adjusts the position of nearby model vertices by adjusting custom control points. The control method is simple and suitable for automatic processing. And without the constraints of FFD, it can only have a large area, and there are arbitrary fine-grained control points, which can meet our needs for low-mode control and high-mode clothing.

Algorithm principle:
RBF is the solution of a system of equations, assuming there are M discrete points xi in 3-dimensional space, then RBF can provide the overall smooth interpolation function F(x) in the discrete space. This function is the sum of the results of M radial basis functions G(ri), where ri is the distance between the estimated point and the original point:
insert image description here

Where ai is a constant coefficient, c0, c1, c2, c3 are polynomial coefficients. Because M discrete control points X1 to XM are known, M F(Xi)=Fi can be constructed. From this, M+4 linear equations F=GA can be constructed and solved, where F= (F1 , F2 , …, FM , 0, 0, 0, 0) , A = ( a1 , a2 , …, aM , c0 , c1 , c2 , c3 ), and G is a (M+4, M+4) matrix. After solving the linear equations to get all the parameters, and then input the new X= (x, y, z) coordinate value, the corresponding spatial basis function interpolation result can be obtained.
The performance of RBF needs to calculate the distance between the input point (clothes high modulus 1W+ vertices) and all control points (body low modulus 400+) in the calculation process, so the number of control points and solution points will affect the calculation efficiency; and After the model is deformed, a post-processing process is also required to recalculate the vertex normals, otherwise it will affect the model topology and rendering correctness !

Algorithm performance verification : radial basis function (RBF) simulation experiment Download and install PyGeM to see the simulation of RBF in Houdini in the fourth section. I have never used Houdini here, and it is not free, but I know someone who has studied and used it. Even though the low model of the human body is about 400+ vertices, the rbf running control point with hundreds of points is still stuck! It is not a solution for running runtime at all, but only for single-frame migration of mesh deformation. PC (I9 9900k) runs the runtime with dcc, and the runtime is stuck; the example of Maya also has RBF MayaPlugins, as shown in the figure below, 400 controls 6000 vertices, and the PC computer I7 9700KF.
insert image description here

insert image description here

Wrap algorithm principle:

It manipulates Mesh deformation to affect another Mesh deformation

  • D: The mesh that needs to be modified by the wrapping algorithm deformer.
  • R: Clone makes a copy of D.
  • r: The affected radius around the mesh.
  • local: A scalar controlling the locality of the deformation.
  • f:insert image description here

Algorithm binding: Model R has a control point K, and the weight function F(P,k)=F(dist(P,k))local affected by the wrapping algorithm at model point P, P is in the local coordinate system of control point k Calculated in.
Deformation: Each vertex of mesh D is a control point k. When P is bound to a control point, the calculation of P is based on the local coordinate system; the overall deformation of P point is the weighted average of all control vertices based on their influence deformation function.

insert image description here

The two deformations described later are Triangulated Surface Mesh Deformation.

Simple Laplace deformation:

Mesh Deformation with Laplacian coordinates (Laplacian Deformation), the previously mentioned FFD is based on free deformation, while surface deformation is differential deformation, which wants to solve sparse matrices. The essence of Laplacian mesh deformation is the process of encoding and decoding local detail features of the mesh model. The encoding process refers to the conversion of the Euclidean space coordinates of the vertices to the Laplacian coordinates. Laplacian coordinates contain the local details of the grid, so the Laplacian grid deformation algorithm can better maintain the local details of the grid model. The decoding process refers to the reverse calculation of Euclidean space coordinates through differential coordinates, which is essentially a process of solving a linear system. Laplace gives a triangular mesh model M=(V,E,F) with n vertices, V is the set of vertices, E is the set of edges, F is the set of triangular faces, and the set of vertex V and adjacent vertices The Laplacian coordinates at vi are insert image description here
where, δi is the Laplacian coordinates of vertex vi, L(·) is the Laplacian operator of the grid, ωij is the weight of point vj relative to point vi, and Σωij=1. The weights use cotangent-based weights (cotangent weights), which are the mean of the cotangents of the opposite corners of the two adjacent triangles of the edge:insert image description hereinsert image description here

Using cotangent weights, this deformation method preserves local details as much as possible. Laplace has three properties: linear transformation, translation invariance, and rotation transformation sensitivity.
According to the nature of Laplace coordinates, it is sensitive to rotation, so the local information of the grid will be rotated and distorted, and the rotation scale is larger. , the distortion will be very severe and it will be distorted. To realize the feature-preserving deformation of the mesh model, the Laplace coordinates of the original mesh cannot be directly used to reconstruct the deformed mesh model, but the direction of the differential coordinates should be reset and the model should be reconstructed.

For details, please see: Graphics Processing (3) Simple Laplacian Mesh Deformation - Siggraph 2004_hjimce's Blog - CSDN Blog
Or: Editing 3D Models with Mathematics (1) - Mesh Deformation with Laplacian Coordinates - Know

As-Rigid-As-Possible algorithm

For the principle of ARAP algorithm and its detailed explanation,
please refer to [5] and [6]. convergence. However, ARAP also has defects such as not being able to maintain the volume of the model, and when the model is very fine, the solution will be unstable, etc.

The most important thing is the algorithm implementation of underground cgal:
Tim CGAL surface deformation use (Laplace, ARAP deformation) tutorial ;

References:

1. Deformation FFDs, wires, wraps papers
2. Computer graphics ten: Bezier curve and Bezier surface - Zhihu
3. Radial basis function RBF three-dimensional mesh deformation
4. Model deformation from FFD to RBF
5. Use Mathematics editing 3D model (2) - As-Rigid-As-Possible
6, animation deformation Linear rotation-invariant coordinates and As-Rigid-As-Possible algorithm

Guess you like

Origin blog.csdn.net/chenweiyu11962/article/details/130437525