A cloth simulation method, device, electronic equipment, medium and product

By rastering the 2D fabric mesh and numerical system solution, the problem of difficulty and cost in high-resolution triangular mesh processing of traditional fabric simulation methods is solved, and a more efficient fabric simulation process is achieved.

CN118313177BActive Publication Date: 2024-11-08LINGDI (ZHEJIANG) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410743681.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-07
Publication Date
2024-11-08
Estimated Expiration
2044-06-07

AI Technical Summary

Technical Problem

Traditional fabric simulation methods have high implementation difficulty and calculation cost when dealing with high-resolution triangular mesh, especially when complex geometric shapes or irregular mesh.

Method used

By rastering the 2D fabric mesh, the top-level image level is formed, and its numerical system is solved, the top-level update value is obtained, and then mapped back to the 3D fabric mesh, avoiding the complexity of directly solving three-dimensional problems and simplifying Topological information is represented in uniform pixels.

Benefits of technology

It reduces the difficulty and calculation cost of fabric simulation engineering, improves simulation efficiency, and simplifies the solution complexity of numerical systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118313177B_ABST
    Figure CN118313177B_ABST
Patent Text Reader

Abstract

The present application provides a cloth simulation method, device, electronic device, medium and product. According to an example of the present application, the method may include: rasterizing a 2D cloth mesh to form a top-level image layer; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh; solving the numerical system of the top-level image layer to obtain the top-level update value of the 2D cloth mesh; the top-level update value is the update value of the 2D cloth mesh at the top-level image layer; based on the top-level update value, obtaining the final update value of the 3D cloth mesh.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to a cloth simulation method, device, electronic equipment, medium and product. Background Art

[0002] High-quality cloth simulation usually requires a high-resolution mesh to express fine wrinkle details. Cloth simulated with a high-resolution mesh has smooth and delicate wrinkles, while cloth simulated with a low-resolution mesh has a rough surface.

[0003] High-resolution cloth simulation is a common method to obtain high-quality cloth effects. Simulating fine-grained cloth wrinkle details usually requires using high-resolution triangle meshes as input data for physically based cloth simulation methods.

[0004] However, when dealing with high-resolution triangular meshes, the simulation effect of traditional cloth simulation methods depends on the geometric structure and quality of the mesh. For complex geometric shapes or irregular meshes, additional work is required to build a suitable multi-mesh hierarchy, which has high implementation difficulty and computational cost. Summary of the invention

[0005] In order to overcome the problems existing in the related art, the present application provides a cloth simulation method, device, electronic equipment, medium and product.

[0006] According to a first aspect of any embodiment of the present application, a cloth simulation method is provided, the method comprising:

[0007] rasterizing the 2D cloth mesh to form a top image level; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh;

[0008] Solving the numerical system at the top image level to obtain a top update value for the 2D cloth mesh; the top update value is an update value for the 2D cloth mesh at the top image level;

[0009] Based on the top-level update value, a final update value of the 3D cloth mesh is obtained.

[0010] According to a second aspect of any embodiment of the present application, a cloth simulation device is provided, the device comprising:

[0011] A rasterization processing module, used for rasterizing the 2D cloth mesh to form a top image layer; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh;

[0012] a numerical system solving module, configured to solve the numerical system at the top image level to obtain a top update value of the 2D cloth mesh; the top update value is an update value of the 2D cloth mesh at the top image level;

[0013] A final update value acquisition module is used to acquire a final update value of the 3D cloth mesh based on the top-level update value.

[0014] According to a third aspect of any embodiment of the present application, there is provided an electronic device, including:

[0015] processor;

[0016] a memory for storing processor-executable instructions;

[0017] The processor implements the method described in any embodiment of the present application by running the executable instructions.

[0018] According to a fourth aspect of any embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the method described in any embodiment of the present application is implemented.

[0019] According to a fifth aspect of any embodiment of the present application, a computer program product is provided, on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the method described in any embodiment of the present application is implemented.

[0020] The technical solution provided by this application may have the following beneficial effects:

[0021] According to the above embodiments, by rasterizing the 2D cloth mesh to form a top image level, solving the numerical system of the top image level, obtaining the top update value of the 2D cloth mesh at the top image level, obtaining the final update value of the 3D cloth mesh based on the top update value, mapping the first vertex attribute of the 3D cloth mesh to obtain the second vertex attribute of the 2D cloth mesh, avoiding the complexity of solving the three-dimensional problem, and, after the rasterization process, the topological information of the 3D cloth mesh is replaced by uniform pixels in a simpler top image level, simplifying the complexity of solving the numerical system, reducing the engineering implementation difficulty and calculation cost of the cloth simulation, and improving the efficiency of the cloth simulation.

[0022] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The accompanying drawings, which are incorporated in the specification and constitute a part of this application, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application.

[0024] Figure 1 is a schematic diagram of a low-resolution cloth simulation according to an exemplary embodiment of the present application;

[0025] Figure 2 is a schematic diagram of a high-resolution cloth simulation according to an exemplary embodiment of the present application;

[0026] Figure 3 is a flow chart of a cloth simulation method according to an exemplary embodiment of the present application;

[0027] Figure 4 is a schematic diagram of a 3D cloth mesh according to an exemplary embodiment of the present application;

[0028] Figure 5 is a schematic diagram of a 2D cloth grid according to an exemplary embodiment of the present application;

[0029] Figure 6 is a schematic diagram of a background grid according to an exemplary embodiment of the present application;

[0030] Figure 7 is a schematic diagram of vertices of a 2D cloth mesh according to an exemplary embodiment of the present application;

[0031] Figure 8 is a schematic diagram of pixel attributes of a top image level according to an exemplary embodiment of the present application;

[0032] Fig. 9 is a schematic diagram of two adjacent image levels according to an exemplary embodiment of the present application;

[0033] Fig.10 is a flow chart of another cloth simulation method according to an exemplary embodiment of the present application;

[0034] Fig.11 is a structural schematic diagram of an electronic device according to an exemplary embodiment of the present application;

[0035] Fig.12 It is a block diagram of a cloth simulation device shown in the present application according to an exemplary embodiment. DETAILED DESCRIPTION

[0036] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0037] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0038] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0039] High-resolution cloth simulation enables high-quality cloth effects. Figure 1 , Figure 1 A schematic diagram showing a low-resolution cloth simulation. Figure 1 The cloth of the garment shown is simulated using a low-resolution mesh, and the surface of the cloth is rough and lacks fine wrinkle details. Figure 2 shows a schematic diagram of a high-resolution cloth simulation, Figure 2 The cloth of the garment shown was simulated using a high-resolution mesh, and the cloth has smooth and detailed wrinkles.

[0040] Currently, cloth simulation methods usually rely on the geometric structure of triangular meshes and the quality of the meshes. For complex geometric shapes or irregular meshes, additional work is required to build a suitable multi-mesh hierarchy, which has high implementation difficulty and computational cost.

[0041] In order to solve the above problems, the present application proposes a cloth simulation method. To further illustrate the present application, the following embodiments are provided:

[0042] See also Figure 3 , Figure 3The present application is a flowchart of a cloth simulation method according to an exemplary embodiment. The execution subject of the cloth simulation method can be a terminal device or a server, and the terminal device is a mobile terminal such as a computer, a tablet computer, a smart phone, a laptop computer, etc.

[0043] Taking the execution subject as a terminal device as an example, the cloth simulation method may include the following steps:

[0044] Step 302: rasterizing the 2D cloth mesh to form a top-level image layer; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh.

[0045] In this step, the terminal device can map the first vertex attribute of the 3D cloth mesh in the 3D geometric space to the 2D material space through linear interpolation, bilinear interpolation, trilinear interpolation and other methods to obtain the second vertex attribute of the 2D cloth mesh in the 2D material coordinate space.

[0046] Among them, the 3D cloth mesh is a triangular mesh structure that makes up the cloth in the 3D geometric space. The cloth in the 3D geometric space will deform. The 2D cloth mesh is a triangular mesh structure that makes up the cloth in the 2D material space. The initial shape and mesh topology information of the 2D cloth mesh are pre-prepared input data. The vertex and topology information in the 2D material space will not change.

[0047] The first vertex attribute is the vertex attribute of the 3D cloth mesh, which is used to describe the cloth's position, speed, error and other information in the 3D geometric space. The second vertex attribute is the vertex attribute of the 2D cloth mesh, which is used to describe the cloth's position, speed, error and other information in the 2D material space.

[0048] The terminal device rasterizes the 2D cloth mesh in the 2D material space to form a top-level image layer.

[0049] The top image level is used to represent the topological information of the 2D cloth mesh using uniform pixels. Each grid point in the top image level can be regarded as a pixel point, and the 2D material space where the top image level is located can be represented as an image.

[0050] See also Figure 4 , Figure 4 A schematic diagram of a 3D cloth mesh is shown. Taking the simulation of cloth in clothing as an example, Figure 4 The garment shown in the 3D geometric space is formed by sewing a plurality of cloth patterns, and a plurality of 3D cloth meshes constitute a cloth pattern.

[0051] See also Figure 5 , Figure 5A schematic diagram of a 2D cloth mesh is shown. Figure 4 Taking the 3D cloth mesh shown as an example, the terminal device maps the first vertex attribute of the 3D cloth mesh of the clothing in the 3D geometric space to the 2D material space to obtain the second vertex attribute of the 2D cloth mesh.

[0052] In 2D material space, every cloth pattern in 3D geometry space has a corresponding flat pattern, which is composed of 2D cloth meshes. The topological information of 2D cloth meshes in 2D material space is the same as that of cloth patterns in 3D geometry space.

[0053] Furthermore, before rasterizing the 2D cloth mesh, the terminal device sets a background mesh according to the side length of the 2D cloth mesh, and uses the background mesh to rasterize the 2D cloth mesh to form a top image layer.

[0054] The side length of the background grid can be expressed as the pixel size of the top image layer.

[0055] The background grid may be set, for example, by setting half of the smallest side length of the 2D cloth grid as the side length of the background grid; or by setting half of the average of the side lengths of the 2D cloth grid as the side length of the background grid. The embodiment of the present application does not impose any restrictions on this.

[0056] See also Figure 6 , Figure 6 A schematic diagram of a background grid is shown. Exemplarily, the terminal device uses the background grid to Figure 5 The 2D cloth mesh shown is rasterized to obtain the top image level in 2D material space. The image size of the top image level can be determined by the bounding box size of the 2D cloth mesh.

[0057] As described above, by setting the background grid according to the side length of the 2D cloth grid, using the background grid, and rasterizing the 2D cloth grid to form a top-level image hierarchy, the user can be supported to flexibly construct the top-level image hierarchy according to specific needs, which has strong flexibility and adaptability.

[0058] Step 304: Solve the numerical system of the top image level to obtain the top update value of the 2D cloth mesh; the top update value is the update value of the 2D cloth mesh at the top image level.

[0059] In this step, the terminal device can use a solution method such as an iteration method, a conjugate gradient method, a Gaussian elimination method, or a multi-grid method to solve the numerical system of the top image level and obtain the top update value of the 2D cloth grid.

[0060] The numerical system is the mathematical equation system formed at the top image level after the 2D cloth mesh is discretized. The top update value is the update value of the 2D cloth mesh at the top image level. The update value is used to represent the deformation of the 2D cloth mesh at the image level, such as displacement, stress value, etc.

[0061] Iterative methods, for example, Jacobi iterative method, Gauss-Seidel iterative method, etc. Multi-grid methods, for example, geometric multi-grid method, arithmetic multi-grid method, etc.

[0062] Exemplarily, the terminal device can use a geometric multi-grid method to construct multiple image levels with different resolutions, solve the numerical systems of the multiple image levels, perform interpolation operations and constraint operations between the multiple image levels, and obtain the top-level update value of the 2D cloth grid at the top-level image level.

[0063] It can be understood that the solution methods of the numerical system illustrated in the present application are just some exemplary linear solution methods, and other linear solution methods or nonlinear solution methods can also be used, and the embodiments of the present application do not limit this.

[0064] Step 306: Based on the top-level update value, obtain the final update value of the 3D cloth mesh.

[0065] In this step, the terminal device maps the top-level update value of the 2D cloth mesh at the top-level image level back to the 3D cloth mesh based on the top-level update value, obtains the final update value of the 3D cloth mesh, and obtains the simulation effect of the 3D cloth mesh in the next frame.

[0066] The final update value is used to represent the deformation of the 3D cloth mesh in the 3D geometric space.

[0067] Furthermore, the terminal device uses linear interpolation, bilinear interpolation, trilinear interpolation and other methods to map the top-level update value of the 2D cloth mesh at the top-level image level to the vertices of the 2D cloth mesh to obtain the attribute update value of the 2D cloth mesh.

[0068] The attribute update value is an update value of the second vertex attribute on the 2D cloth mesh after solving the mathematical equation system on the 2D cloth mesh.

[0069] See also Figure 7 , Figure 7 A schematic diagram of the vertices of a 2D cloth mesh is shown. Any vertex of the 2D cloth mesh will inevitably be surrounded by four pixels on the top image level. Taking the vertex q of the 2D cloth mesh as an example, the vertex q falls among the four pixels h, i, j and k on the top image level, and the centroid coordinates corresponding to the vertex q are calculated as δ, ε, ζ, θ.

[0070] The terminal device can calculate the simulated second vertex attribute by linear interpolation using the following formula (1):

[0071] (1)

[0072] The terminal device uses linear interpolation, bilinear interpolation, trilinear interpolation and other methods to map the first vertex attribute of the 3D cloth mesh to obtain the second vertex attribute of the 2D cloth mesh and obtain a second mapping matrix.

[0073] Based on the attribute update value of the 2D cloth mesh and the second mapping matrix, the terminal device maps the simulated second vertex attribute back to the vertex of the 3D cloth mesh through the second mapping matrix to obtain the final update value of the 3D cloth mesh.

[0074] The second mapping matrix is ​​used to represent the mapping relationship between the first vertex attribute of the 3D cloth mesh and the second vertex attribute of the 2D cloth mesh. The final update value is the displacement of the first vertex attribute of the 3D cloth mesh after simulation.

[0075] The terminal device can calculate the final update value according to the following formula (2):

[0076] (2)

[0077] in, Represents the final updated value, Indicates the updated value of a property. Represents the transpose of the second mapping matrix. The transpose of the second mapping matrix is ​​calculated according to the Galerkin method. The transpose of the second mapping matrix is ​​used to represent the mapping relationship between the second vertex attribute of the 2D cloth mesh and the first vertex attribute of the 3D cloth mesh.

[0078] As described above, by mapping the top-level update values ​​to the vertices of the 2D cloth mesh, the attribute update values ​​of the 2D cloth mesh are obtained, and based on the attribute update values ​​and the second mapping matrix, the final update values ​​of the 3D cloth mesh are obtained, thereby ensuring the consistency of solutions between the top-level image level, the 2D cloth mesh, and the 3D cloth mesh, which helps to maintain the accuracy of physical properties during the simulation process.

[0079] The cloth simulation method of this embodiment performs rasterization processing on the 2D cloth mesh to form a top-level image level, solves the numerical system of the top-level image level, obtains the top-level update value of the 2D cloth mesh at the top-level image level, obtains the final update value of the 3D cloth mesh based on the top-level update value, maps the first vertex attribute of the 3D cloth mesh to obtain the second vertex attribute of the 2D cloth mesh, avoids the complexity of solving the three-dimensional problem, and after the rasterization processing, the topological information of the 3D cloth mesh is replaced by uniform pixels in the simpler top-level image level, simplifies the complexity of solving the numerical system, reduces the engineering implementation difficulty and calculation cost of the cloth simulation, and improves the efficiency of the cloth simulation.

[0080] In the above-mentioned embodiment, it is introduced that after rasterizing the 2D cloth mesh, the numerical system of the top image level is solved to obtain the top update value, and the top update value is mapped back to the 3D cloth mesh to obtain the final update value of the 3D cloth mesh. In the following embodiment, how to obtain the numerical system of the top image level will be described in detail, and it can be applied to any of the above embodiments.

[0081] In one embodiment, a 3D cloth mesh in a 3D geometric space is obtained by stitching a cloth pattern in a corresponding 2D material space. In the 2D material space, two vertices having a stitching relationship share the vertex attributes of the same vertex in the 3D geometric space. Therefore, a mapping relationship between the 3D cloth mesh and the 2D cloth mesh needs to be constructed.

[0082] For example, there are n vertices on the 3D cloth mesh and m vertices on the 2D cloth mesh. Then the second mapping matrix , map the first vertex attribute of the 3D cloth mesh to the 2D cloth mesh, and obtain the second vertex attribute of the 2D cloth mesh.

[0083] Among them, the second mapping matrix needs to satisfy , represents the transpose of the second mapping matrix, and I represents the identity matrix.

[0084] The terminal device can calculate the second vertex attribute according to the following formula (3):

[0085] (3)

[0086] in, represents the second vertex attribute, represents the first vertex attribute, and D represents the second mapping matrix.

[0087] The terminal device maps the second vertex attribute to the pixel attribute of the top image level by using a method such as linear interpolation, bilinear interpolation, or trilinear interpolation to obtain a first mapping matrix.

[0088] The pixel attribute is a second vertex attribute of the 2D cloth mesh stored in pixels at the top image level. The first mapping matrix is ​​used to represent a mapping relationship between the second vertex attribute of the 2D cloth mesh and the pixel attribute at the top image level.

[0089] See also Figure 8 , Figure 8 A schematic diagram of the pixel properties of a top image level is shown. For example, the pixel size of the top image level is the minimum side length of the 2D cloth mesh Half the size of a pixel .

[0090] A pixel at the top image level A triangle that falls on a 2D cloth mesh Internally, a, b, and c are three vertices in the 2D cloth mesh, and the corresponding center of gravity coordinates can be calculated .

[0091] The terminal device can calculate the pixel attributes of the pixel point by linear interpolation using the following formula (4):

[0092] (4)

[0093] The values ​​of pixels in the top image level that do not fall within the triangle are 0, thereby obtaining a first mapping matrix from the second vertex attribute of the 2D cloth mesh to the pixel attribute of the top image level.

[0094] As described above, by mapping the first vertex attribute of the 3D cloth mesh to the 2D cloth mesh, obtaining the second vertex attribute, and mapping the second vertex attribute to the pixel attribute of the top image level, obtaining the first mapping matrix, the geometric image corresponding to the top image level can use pixel points to store the information of the 3D cloth after deformation, and can also use the pixel size to represent the reference undeformed information, thereby further reducing the complexity of the subsequent numerical system solution.

[0095] In one embodiment, the terminal device maps a first numerical system corresponding to the 3D cloth mesh into a 2D material space to obtain a second numerical system of the 2D cloth mesh.

[0096] The first numerical system is a large-scale linear equation group generated by a physical simulation system in a 3D geometric space, and the second numerical system is a numerical system generated by mapping the first numerical system onto a 2D cloth grid.

[0097] The terminal device can obtain the second numerical system according to the following formula (5):

[0098] (5)

[0099] in, The system matrix representing the 2D cloth mesh, Represents the property update value of the 2D cloth mesh, Represents the second vertex attribute.

[0100] The terminal device can calculate the system matrix of the 2D cloth grid according to the following formula (6):

[0101] (6)

[0102] in, The system matrix representing the 2D cloth mesh, represents the second mapping matrix, represents the transpose of the second mapping matrix, is the system matrix of the input 3D cloth mesh and is a symmetric matrix.

[0103] The terminal device converts the second numerical system to the top image level through the first mapping matrix according to the second numerical system and the first mapping matrix, and obtains the numerical system of the top image level.

[0104] The terminal device can calculate the numerical system of the top image layer according to the following formula (7):

[0105] (7)

[0106] in, The system matrix representing the top-level image hierarchy, represents the top-level update value of the top-level image layer, Represents pixel attributes of the top image level.

[0107] The terminal device can calculate the pixel attributes of the top image layer according to the following formula (8):

[0108] (8)

[0109] in, represents pixel attributes at the top image level, represents the first mapping matrix, Represents the second vertex attribute.

[0110] The terminal device can calculate the system matrix of the top-level image layer according to the following formula (9):

[0111] (9)

[0112] in, The system matrix representing the top-level image hierarchy, represents the first mapping matrix, represents the transpose of the first mapping matrix, The system matrix representing the 2D cloth mesh.

[0113] Taking the Jacobi iteration method, Gauss-Seidel iteration method and other iteration methods as an example, when the terminal device solves the numerical system of the top image level at the top image level, it first sets the top update value The initial value is , and then perform subsequent iterative solution process to obtain the top-level update value of the top-level image level.

[0114] in, represents the first mapping matrix, Indicates the initial value of the attribute update value of the 2D cloth mesh. The initial value of the attribute update value is based on The initial value is obtained, The initial value of can be set to 0 or based on prior information.

[0115] As described above, by mapping the first numerical system corresponding to the 3D cloth grid into the 2D space, the second numerical system of the 2D cloth grid is obtained, and according to the second numerical system and the first mapping matrix, the numerical system of the top image level is obtained, so that the numerical system of the top image level can provide a complete description of the entire image level structure and information, and the large-scale linear equations generated by the physical simulation system in the 3D geometric space are mapped into the 2D space. The numerical system of the image level is easier to solve, thereby greatly reducing the computing cost and improving the processing speed.

[0116] In one embodiment, the terminal device may use a multi-grid method to solve the numerical system at the top image level to obtain the top-level update value of the 2D cloth grid.

[0117] Specifically, the terminal device uses a preset multiple to double the side length of the background grid of the top image level to obtain the background grid of the next level, until the background grid reaches the preset level, and a multi-level background grid is obtained. The terminal device uses the multi-level background grid to rasterize the 2D cloth grid to form multiple image levels with different resolutions.

[0118] The side length of the background grid can be expressed as the pixel size of the corresponding image level. The background grid of the top image level is the first background grid among the multi-level background grids, and the side length of the background grid of the top image level is the smallest among the multi-level background grids.

[0119] The preset multiple is the multiple of the side length of the background grid of two adjacent levels, for example: 2 times, 3 times, etc. The preset level is the level of the background grid, and also the level of the image level, for example: 4 layers, 5 layers, etc. The preset level is usually set to 4 to 5 levels.

[0120] Multiple image levels are used to represent the topological information of a 2D cloth mesh at image levels of different resolutions. The top image level is the image level with the highest resolution among the multiple image levels, that is, the top image level is the image level with the smallest pixel size among the multiple image levels.

[0121] Each grid point in the image layer can be regarded as a pixel, and different pixel sizes represent different resolutions. The 2D material space where each image layer is located can be represented as an image.

[0122] Since the image corresponding to each image level is a uniform square grid, the terminal device can use linear interpolation, bilinear interpolation, trilinear interpolation and other methods to construct an interpolation matrix between two adjacent image levels.

[0123] See also Fig. 9 , Fig. 9 A schematic diagram of two adjacent image levels is shown. For example, the higher image level The pixel size is , the image level of the next level The pixel size is .

[0124] Image Level Each pixel on the image can be The one-to-one correspondence is found above, and at the image level On but not at the image level The pixels above can be obtained by The pixels on the image are linearly interpolated to establish an interpolation matrix between two adjacent image levels. According to the Galerkin method, the constraint matrix corresponding to the interpolation matrix is ​​obtained.

[0125] The interpolation matrix is ​​used to represent the mapping relationship from the low-resolution image level to the high-resolution image level. The constraint matrix is ​​the transpose of the interpolation matrix, and the constraint matrix is ​​used to represent the mapping relationship from the high-resolution image level to the low-resolution image level.

[0126] The terminal device uses iterative methods such as the Jacobi method and the symmetric Gauss-Seidel method, starting from the top image level as the first image level, performs error smoothing calculations on the numerical system of the first image level, and obtains an updated value in the first image level.

[0127] Taking the first image level as the image level of the lth level as an example, the terminal device uses an iterative method to calculate the numerical system of the first image level. Perform error smoothing calculation to obtain the updated value in the first image level .

[0128] The terminal device can calculate the residual corresponding to the updated value according to the following formula (10):

[0129] (10)

[0130] in, represents the residual corresponding to the updated value of the first image level, represents the pixel attributes of the first image level, represents the system matrix of the first image level, Indicates the updated value of the first image level.

[0131] The terminal device constrains the update value in the first image level to the second image level based on the interpolation matrix and the constraint matrix between the first image level and the second image level until the second image level reaches the bottommost image level.

[0132] The first image level is an image level adjacent to the second image level, and the resolution of the first image level is higher than the resolution of the second image level. The bottommost image level is an image level with the lowest resolution among the multiple image levels.

[0133] Continuing to take the case where the first image level is the image level of the lth level as an example, and the second image level is the image level of the l+1th level, the terminal device can calculate the system matrix of the second image level according to the following formula (11):

[0134] (11)

[0135] in, represents the system matrix of the first image level, represents the system matrix of the second image level, represents the interpolation matrix between the first image level and the second image level, Represents the constraint matrix between the first image level and the second image level.

[0136] The terminal device may calculate the pixel attributes of the second image level according to the following formula (12):

[0137] (12)

[0138] in, represents the pixel attributes of the second image level, represents the constraint matrix between the first image level and the second image level, Residual representing the updated value of the first image level.

[0139] The terminal device sets the update value of the second image level The initial value of is zero, the second image level is taken as the first image level, the next image level adjacent to the second image level is taken as the second image level, and error smoothing calculation and downward constraint are performed layer by layer until the second image level reaches the bottommost image level.

[0140] When the second image level reaches the bottom image level, Numerical system Perform precise solution to obtain the lowest image level Update value of .

[0141] The terminal device starts from taking the bottommost image level as the second image level, and interpolates the updated value in the second image level into the first image level based on the interpolation matrix between the first image level and the second image level.

[0142] The terminal device may calculate the interpolated update value in the first image level according to the following formula (13):

[0143] (13)

[0144] in, represents the updated value after interpolation in the first image level, represents the updated value in the first image level, represents the updated value in the second image level, Represents the interpolation matrix between the first image level and the second image level.

[0145] The terminal device uses the interpolated update value in the first image level as the initial value, uses the iterative method, and performs error smoothing calculation on the numerical system of the first image level again to obtain the updated update value in the first image level.

[0146] The terminal device uses the first image level as the second image level, and the previous image level adjacent to the first image level as the first image level, and performs upward interpolation and error smoothing calculations layer by layer until the first image level reaches the top image level, thereby obtaining the top-level update value in the top image level.

[0147] The terminal device performs error smoothing calculations, constraints and interpolation on multiple image levels according to a preset number of iterations, updates the top-level update value in the top-level image level, and obtains an accurate top-level update value.

[0148] The preset number of iterations is the number of iterations for error smoothing calculation, constraint and interpolation for multiple image levels, which is usually set within five times.

[0149] As described above, by using the multi-grid numerical system solution method in the image space, a rapid solution to the physical simulation system of high-resolution cloth is achieved, which improves the accuracy of the numerical system solution and further improves the efficiency of cloth simulation.

[0150] To further introduce the process of cloth simulation method, Fig.10 A flowchart of another cloth simulation method is shown, and the cloth simulation method may include the following steps:

[0151] Step 1002: According to the side length of the 2D cloth mesh, set the background mesh corresponding to the top image level.

[0152] In this step, the terminal device uses half of the minimum side length of the 2D cloth mesh as the background mesh corresponding to the top image level.

[0153] Step 1004: Setting a multi-level background grid based on a preset multiple and a background grid corresponding to the top image level.

[0154] In this step, the terminal device starts from the background grid corresponding to the top image level, and doubles the side length of the background grid of the next adjacent level to obtain a multi-level background grid.

[0155] Step 1006: Using the multi-level background grid, rasterize the 2D cloth grid to form multiple image levels.

[0156] In this step, the terminal device uses a multi-level background grid to rasterize the 2D cloth grid to form multiple image levels with different resolutions.

[0157] Step 1008: The terminal device maps the first numerical system corresponding to the 3D cloth mesh into the 2D material space to obtain the second numerical system of the 2D cloth mesh.

[0158] Step 1010: The terminal device maps the first vertex attribute of the 3D cloth mesh to the 2D cloth mesh to obtain the second vertex attribute.

[0159] Step 1012: Map the second vertex attribute to the pixel attribute of the top image level to obtain a first mapping matrix.

[0160] In this step, the terminal device maps the second vertex attribute to the pixel attribute of the top image level through linear interpolation to obtain a first mapping matrix.

[0161] Step 1014: Obtain a numerical system of the top image level according to the second numerical system and the first mapping matrix.

[0162] In this step, the terminal device converts the second numerical system through the first mapping matrix to obtain the numerical system of the top image level.

[0163] Step 1016: construct an interpolation matrix and a constraint matrix between two adjacent image levels.

[0164] In this step, the terminal device constructs an interpolation matrix between two adjacent image levels through linear interpolation, and obtains a constraint matrix corresponding to the interpolation matrix according to the Galerkin method.

[0165] Step 1018: Perform error smoothing calculation on the numerical system of the first image level to obtain an updated value in the first image level.

[0166] In this step, the terminal device uses an iterative method to perform error smoothing calculations on the numerical system of the first image level to obtain an updated value in the first image level.

[0167] Step 1020: Constrain the update value in the first image level to the second image level based on the interpolation matrix and the constraint matrix between the first image level and the second image level.

[0168] In this step, the terminal device constrains the update value in the first image level to the second image level based on the interpolation matrix and the constraint matrix between the first image level and the second image level. The information in the first image level is transferred to the second image level through the interpolation matrix and the constraint matrix.

[0169] Step 1022: Starting from the top image level, repeat steps 1018 to 1020 until the second image level reaches the bottom image level.

[0170] In this step, the terminal device starts from the top image level, repeats steps 1018 to 1020, and performs constraint operations layer by layer until the second image level reaches the bottom image level.

[0171] Step 1024: The terminal device interpolates the update value in the second image level into the first image level based on the interpolation matrix between the first image level and the second image level.

[0172] Step 1026: Based on the iteration method and the interpolated update value in the first image level, perform error smoothing calculation on the numerical system of the first image level.

[0173] In this step, the terminal device uses the interpolated update value in the first image level as the initial value, uses an iterative method, and performs error smoothing calculation on the numerical system of the first image level again to obtain the updated update value in the first image level.

[0174] Step 1028: Starting from the bottommost image level, repeat steps 1024 to 1026 until the first image level reaches the top image level.

[0175] In this step, the terminal device starts from the bottommost image level, repeats steps 1024 to 1026, and performs difference operations layer by layer until the first image level reaches the top image level.

[0176] Step 1030: The terminal device repeats steps 1018 to 1028 according to a preset number of iterations, performs error smoothing calculations, constraints and interpolation on multiple image levels, and obtains a top-level update value.

[0177] Step 1032: Map the top-level update values ​​to the vertices of the 2D cloth mesh to obtain the attribute update values ​​of the 2D cloth mesh.

[0178] In this step, the terminal device maps the top-level update value to the vertices of the 2D cloth mesh through linear interpolation to obtain the attribute update value of the 2D cloth mesh.

[0179] Step 1034: Based on the attribute update value and the second mapping matrix, obtain the final update value of the 3D cloth mesh.

[0180] In this step, the terminal device maps the attribute update value back to the vertices of the 3D cloth mesh through the second mapping matrix to obtain the final update value of the 3D cloth mesh.

[0181] Fig.11 1 is a schematic diagram of a structure of an electronic device according to an exemplary embodiment of the present application. The electronic device may be, for example, a mobile phone, a computer, a digital broadcast terminal, a message transceiver device, a game console, a tablet device, a personal digital assistant, a server, a smart home appliance, etc. Fig.11At the hardware level, the electronic device includes a processor 1102, an internal bus 1104, a network interface 1106, a memory 1108, and a non-volatile memory 1110, and may also include hardware required for other services. The processor 1102 reads the corresponding computer program from the non-volatile memory 1110 into the memory 1108 and then runs it, forming a fabric simulation device at the logical level. Of course, in addition to the software implementation, this application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0182] Fig.12 is a block diagram of a cloth simulation device according to an exemplary embodiment of the present application. Fig.12 The device may include: a rasterization processing module 1202, a numerical system solving module 1204 and a final update value obtaining module 1206, wherein:

[0183] The rasterization processing module 1202 is used to perform rasterization processing on the 2D cloth mesh to form a top image layer; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh;

[0184] The numerical system solving module 1204 is used to solve the numerical system of the top image level to obtain the top update value of the 2D cloth mesh; the top update value is the update value of the 2D cloth mesh at the top image level;

[0185] The final update value acquisition module 1206 is used to acquire the final update value of the 3D cloth mesh based on the top-level update value.

[0186] In one example, the final update value acquisition module 1206, when used to obtain the final update value of the 3D cloth mesh based on the top-level update value, includes: mapping the top-level update value to the vertices of the 2D cloth mesh to obtain the attribute update value of the 2D cloth mesh; obtaining the final update value of the 3D cloth mesh based on the attribute update value and a second mapping matrix; the second mapping matrix is ​​used to represent the mapping relationship between the first vertex attribute of the 3D cloth mesh and the second vertex attribute of the 2D cloth mesh.

[0187] In one example, the rasterization processing module 1202, when used to perform rasterization processing on a 2D cloth mesh to form a top-level image level, includes: performing rasterization processing on the 2D cloth mesh to form multiple image levels; the numerical system solving module 1204, when used to solve the numerical system of the top-level image level to obtain the top-level update value of the 2D cloth mesh, includes: performing error smoothing calculation on the numerical system of the first image level to obtain the update value in the first image level; based on the interpolation matrix and the constraint matrix between the first image level and the second image level, approximating the update value in the first image level; beamed to the second image level until the second image level reaches the bottom image level; wherein the first image level is an image level adjacent to the second image level, and a resolution of the first image level is higher than a resolution of the second image level; the bottom image level is an image level with the lowest resolution among the multiple image levels; based on the interpolation matrix, the update value in the second image level is interpolated to the first image level until the first image level reaches the top image level; according to a preset number of iterations, error smoothing calculations, constraints and interpolation are performed on the multiple image levels to obtain the top update value.

[0188] In one example, the numerical system solving module 1204, before being used to solve the numerical system of the top image level to obtain the top update value of the 2D cloth mesh, further includes: mapping the first numerical system corresponding to the 3D cloth mesh into the 2D material space to obtain the second numerical system of the 2D cloth mesh; acquiring the numerical system of the top image level according to the second numerical system and a first mapping matrix; the first mapping matrix is ​​used to represent the mapping relationship between the second vertex attribute and the pixel attribute of the top image level.

[0189] In one example, the numerical system solving module 1204, before being used to obtain the numerical system of the top image level according to the second numerical system and the first mapping matrix, further includes: mapping the first vertex attribute of the 3D cloth mesh to the 2D cloth mesh to obtain the second vertex attribute; mapping the second vertex attribute to the pixel attribute of the top image level to obtain the first mapping matrix.

[0190] In one example, the rasterization processing module 1202, before being used to rasterize the 2D cloth mesh to form a top-level image level, further includes: setting a background grid according to the side length of the 2D cloth mesh; the rasterization processing module 1202, when being used to rasterize the 2D cloth mesh to form multiple image levels, includes: using the background grid to rasterize the 2D cloth mesh to form the top-level image level.

[0191] In one example, the solution method of the numerical system includes: an iteration method, a conjugate gradient method, a Gaussian elimination method or a multi-grid method.

[0192] The implementation process of the functions and effects of each unit in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, and will not be repeated here.

[0193] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying creative labor.

[0194] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of a cloth simulation device to implement any of the methods described in the above embodiments.

[0195] The non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc., and the present application does not limit this.

[0196] In an exemplary embodiment, a computer program product including a computer program / instructions is also provided. The computer program / instructions can be executed by a processor of a cloth simulation device to implement any of the methods described in the above embodiments.

[0197] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0198] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the inventions claimed herein. The present application is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

[0199] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A cloth simulation method, characterized in that: The method comprises: rasterizing the 2D cloth mesh to form a top image level; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh; Solving the numerical system at the top image level to obtain a top update value for the 2D cloth mesh; the top update value is an update value for the 2D cloth mesh at the top image level; Based on the top-level update value, obtaining a final update value of the 3D cloth mesh; Solving the numerical system of the top image level to obtain the top update value of the 2D cloth mesh includes: A geometric multi-grid method is used to construct multiple image levels with different resolutions, solve the numerical systems of the multiple image levels, perform interpolation operations and constraint operations between the multiple image levels, and obtain the top-level update value.

2. The cloth simulation method according to claim 1, characterized in that: The obtaining, based on the top-level update value, a final update value of the 3D cloth mesh comprises: Mapping the top-level update values ​​to the vertices of the 2D cloth mesh to obtain attribute update values ​​of the 2D cloth mesh; A final update value of the 3D cloth mesh is obtained based on the attribute update value and a second mapping matrix; the second mapping matrix is ​​used to represent a mapping relationship from the first vertex attribute to the second vertex attribute.

3. The cloth simulation method according to claim 1, characterized in that: Solving the numerical system of the top image level to obtain the top update value of the 2D cloth mesh includes: Performing error smoothing calculation on the numerical system of the first image level to obtain an updated value in the first image level; constraining an update value in the first image level to the second image level based on an interpolation matrix and a constraint matrix between the first image level and the second image level until the second image level reaches a bottommost image level; wherein the first image level is an image level adjacent to the second image level, a resolution of the first image level is higher than a resolution of the second image level; and the bottommost image level is an image level with the lowest resolution among the multiple image levels; interpolating updated values ​​in the second image level into the first image level based on the interpolation matrix until the first image level reaches the top image level; According to a preset number of iterations, error smoothing calculations, constraints and interpolations are performed on the multiple image levels to obtain the top layer update value.

4. The cloth simulation method according to claim 1, characterized in that: Before solving the numerical system of the top image level to obtain the top update value of the 2D cloth mesh, the method further includes: Mapping a first numerical system corresponding to the 3D cloth mesh into a 2D material space to obtain a second numerical system of the 2D cloth mesh; The numerical system of the top image level is obtained according to the second numerical system and the first mapping matrix; the first mapping matrix is ​​used to represent the mapping relationship between the second vertex attribute and the pixel attribute of the top image level.

5. The cloth simulation method according to claim 4, characterized in that: Before acquiring the numerical system of the top image level according to the second numerical system and the first mapping matrix, the method further includes: Mapping the first vertex attribute to the 2D cloth mesh to obtain the second vertex attribute; The second vertex attribute is mapped into a pixel attribute of the top image level to obtain the first mapping matrix.

6. The cloth simulation method according to claim 1, characterized in that: Before rasterizing the 2D cloth mesh to form a top image level, the method further includes: According to the side length of the 2D cloth mesh, a background mesh is set; The 2D cloth mesh is rasterized to form a top-level image layer, including: The 2D cloth mesh is rasterized using the background mesh to form the top image level.

7. A cloth simulation device, characterized in that: The device comprises: A rasterization processing module, used for rasterizing the 2D cloth mesh to form a top image layer; wherein the second vertex attribute of the 2D cloth mesh is obtained by mapping the first vertex attribute of the 3D cloth mesh; a numerical system solving module, configured to solve the numerical system at the top image level to obtain a top update value of the 2D cloth mesh; the top update value is an update value of the 2D cloth mesh at the top image level; A final update value acquisition module, used for acquiring a final update value of the 3D cloth mesh based on the top-level update value; The numerical system solving module is specifically used to use a geometric multi-grid method to construct multiple image levels with different resolutions, solve the numerical systems of the multiple image levels, perform interpolation operations and constraint operations between the multiple image levels, and obtain the top-level update value.

8. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor implements the cloth simulation method according to any one of claims 1 to 6 by running the executable instructions.

9. A computer-readable storage medium having computer instructions stored thereon, characterized in that: When the instruction is executed by the processor, the cloth simulation method according to any one of claims 1 to 6 is implemented.

10. A computer program product having a computer program / instructions stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the cloth simulation method according to any one of claims 1 to 6 is implemented.