Cloth posture determination method, device and equipment and readable storage medium

The background grid is obtained by uniformly dividing the two-dimensional planes of the fabric model, which solves the problem of inefficient calculation efficiency caused by the complex topology of the fabric vertex in the fabric model, and realizes efficient fabric simulation and real-time pose determination.

CN119672246APending Publication Date: 2025-03-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311229376.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-21
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the existing fabric simulation technology, the fabric vertex topology in the fabric model is complex, resulting in inefficient calculation of fabric vertex motion information, affecting the real-time performance of the simulation.

Method used

By uniformly dividing the two-dimensional planes of the fabric model presenting flattened state, a background grid is obtained, and the objective function is constructed based on the elastic energy function of the background grid and the motion information of the grid vertices, and the objective function is solved to obtain the motion information of the grid vertices, thereby determining the posture of the fabric model.

Benefits of technology

The topological structure of the fabric model is simplified, the computing efficiency is improved, and the real-time performance of fabric simulation is enhanced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119672246A_ABST
    Figure CN119672246A_ABST
Patent Text Reader

Abstract

The invention discloses a cloth posture determination method, device and equipment and a readable storage medium, and belongs to the technical field of cloth simulation. The method comprises the steps that a two-dimensional plane where a cloth model in a flattened state is located is evenly divided, and background grids are obtained; obtaining first motion information of each grid vertex in the background grid; acquiring an elastic energy function of the background grid; constructing a to-be-solved target function based on the elastic energy function of the background grid and the first motion information of each grid vertex; solving the objective function to obtain second motion information of each grid vertex; and determining first attitude information of the cloth model based on the second motion information of each grid vertex. The motion of the cloth model is simulated through the background grid, and the topological structure of the background grid is simple, so that the efficiency of calculating the second motion information of the grid vertex can be accelerated, the attitude of the cloth model can be quickly determined, and the real-time performance is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present application relate to the technical field of cloth simulation, and in particular to a method, device, equipment and readable storage medium for determining a cloth posture. Background Art

[0002] With the development of science and technology, fabric simulation technology has been widely used in game development, animation production, fashion design and other fields. Fabric simulation technology is a technology that simulates the state changes of fabric such as stretching and twisting in different environments by determining the posture information of fabric during movement.

[0003] In the related art, a cloth model can be constructed according to the three-dimensional modeling technology, and the cloth model includes multiple cloth vertices. Then, a differential equation for describing the force on the cloth vertices is constructed and solved. In the solution process, energy transfer is required according to the topological structure of the cloth vertices to obtain the motion information of the cloth vertices, and the posture information of the cloth model is determined based on the motion information of the cloth vertices.

[0004] Generally speaking, each cloth vertex in a cloth model will be topologically divided into multiple triangular facets, and the shape and size of the triangular facets are not fixed, which leads to a complex topological structure of the cloth vertices and inefficient calculation of the motion information of the cloth vertices, affecting the real-time performance of the cloth simulation. Summary of the invention

[0005] The present application provides a method, device, equipment and readable storage medium for determining cloth posture, which can simulate the movement of the cloth model through the background grid, speed up the calculation efficiency and improve the real-time performance of the cloth simulation. The technical solution includes the following contents.

[0006] In one aspect, a method for determining a cloth posture is provided, the method comprising:

[0007] The two-dimensional plane where the cloth model in a flattened state is located is evenly divided to obtain a background grid;

[0008] Acquire first motion information of each mesh vertex in the background mesh, where the first motion information of the mesh vertex represents a motion state of the mesh vertex at a first moment;

[0009] Acquire an elastic energy function of the background grid, where the elastic energy function of the background grid is used to describe the energy stored in the background grid when it has the elastic properties of the cloth model;

[0010] Acquire an elastic energy function for constraining the background mesh and an objective function of the first motion information of each mesh vertex;

[0011] Solving the objective function to obtain second motion information of each mesh vertex, where the second motion information of the mesh vertex represents a motion state of the mesh vertex at a second moment after the first moment;

[0012] Based on the second motion information of each mesh vertex, first posture information of the cloth model is determined.

[0013] On the other hand, a device for determining a cloth posture is provided, the device comprising:

[0014] A division module is used to evenly divide the two-dimensional plane where the cloth model in a flattened state is located to obtain a background grid;

[0015] An acquisition module, used for acquiring first motion information of each mesh vertex in the background mesh, wherein the first motion information of the mesh vertex represents a motion state of the mesh vertex at a first moment;

[0016] The acquisition module is further used to acquire the elastic energy function of the background grid, where the elastic energy function of the background grid is used to describe the energy stored in the background grid when it has the elastic properties of the cloth model;

[0017] The acquisition module is further used to acquire an elastic energy function for constraining the background mesh and an objective function of the first motion information of each mesh vertex;

[0018] A solution module, used for solving the objective function to obtain second motion information of each mesh vertex, wherein the second motion information of the mesh vertex represents a motion state of the mesh vertex at a second moment after the first moment;

[0019] The determination module is used to determine the first posture information of the cloth model based on the second motion information of each mesh vertex.

[0020] In a possible implementation, the cloth model includes multiple cloth vertices; the acquisition module is used to, for any mesh vertex, determine the first motion information of the cloth vertex as the first motion information of the any mesh vertex when the any mesh vertex overlaps with a cloth vertex; when the any mesh vertex does not overlap with a cloth vertex, determine the cloth vertex related to the any mesh vertex from the multiple cloth vertices, interpolate the first motion information of the cloth vertex related to the any mesh vertex, and obtain the first motion information of the any mesh vertex.

[0021] In a possible implementation, the background mesh includes a plurality of mesh facets, any one of the mesh facets includes a plurality of mesh vertices, any one of the mesh facets includes at least one triangular facet and a vertex of any one of the triangular facets is the mesh vertex;

[0022] The acquisition module is used to determine the elastic energy density of any triangular facet based on the tensile strength of the any triangular facet and the first position information of each mesh vertex in the any triangular facet, wherein the elastic energy density of any triangular facet represents the elastic energy stored in the any triangular facet; and determine the elastic energy function of the background mesh based on the elastic energy density of each triangular facet.

[0023] In a possible implementation, the acquisition module is used to determine the area and first deformation gradient of any triangular facet based on the first position information of each mesh vertex in any triangular facet; determine the second deformation gradient of any triangular facet based on the first deformation gradient of any triangular facet, and the second deformation gradient of any triangular facet represents the deformation gradient after numerical constraints are imposed on the first deformation gradient of any triangular facet; determine the elastic energy density of any triangular facet based on the tensile strength, area, first deformation gradient and second deformation gradient of any triangular facet.

[0024] In a possible implementation, there are two edges in any of the triangular patches that are perpendicular to each other and equal in length; the acquisition module is used to determine the length of a target edge based on the first position information of each mesh vertex in any of the triangular patches, wherein the target edge is one of the two edges that are perpendicular to each other and equal in length; based on the length of the target edge, determine the area of ​​any of the triangular patches; based on the length of the target edge and the first position information of each mesh vertex in any of the triangular patches, determine the first deformation gradient of any of the triangular patches.

[0025] In one possible implementation, the acquisition module is used to perform singular value decomposition on the first deformation gradient of any triangular facet to obtain a first orthogonal matrix, a first diagonal matrix, and a second orthogonal matrix; replace the first diagonal matrix with a second diagonal matrix, wherein the second diagonal matrix represents a matrix after numerical constraints are imposed on the first diagonal matrix; and determine the second deformation gradient of any triangular facet based on the first orthogonal matrix, the second diagonal matrix, and the second orthogonal matrix.

[0026] In a possible implementation, the acquisition module is used to acquire the bending strength and average curvature of the cloth model; and determine the elastic energy function of the background mesh based on the bending strength, average curvature of the cloth model and the elastic energy density of each triangular facet.

[0027] In a possible implementation, the acquisition module is used to determine the reference position of each mesh vertex based on the first motion information of each mesh vertex and the gravitational acceleration, where the reference position of any mesh vertex is used to describe the position of any mesh vertex after movement under the influence of gravity; determine the reference energy function of the background mesh used to constrain the cloth mass corresponding to the cloth model and the reference position of each mesh vertex; and construct the objective function based on the reference energy function of the background mesh and the elastic energy function of the background mesh.

[0028] In a possible implementation, the solution module is used to solve the elastic energy function of the background mesh according to the first motion information of each mesh vertices to obtain the first value of the second deformation gradient of each triangular facet; and solve the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second motion information of each mesh vertex.

[0029] In a possible implementation, the first motion information of each mesh includes first position information of each mesh vertex, and the second motion information of each mesh includes second speed and second position information of each mesh vertex;

[0030] The solving module is used to solve the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second position information of each mesh vertex; based on the first position information and the second position information of each mesh vertex, determine the second speed of each mesh vertex.

[0031] In a possible implementation, the solving module is further used to solve the elastic energy function of the background mesh according to the second motion information of each mesh vertex to obtain a second value of the second deformation gradient of each triangular facet;

[0032] The solving module is further used to solve the objective function according to the second value of the second deformation gradient of each triangular facet to obtain third motion information of each mesh vertex, wherein the third motion information of the mesh vertex represents the motion state of the mesh vertex at a third moment after the second moment;

[0033] The determination module is further used to determine the second posture information of the cloth model based on the third motion information of each mesh vertex.

[0034] In a possible implementation, the cloth model includes multiple cloth vertices; the determination module is used to, for any cloth vertex, determine the second motion information of the one mesh vertex as the second motion information of the any cloth vertex when the any mesh vertex overlaps with a cloth vertex; when the any mesh vertex does not overlap with a cloth vertex, determine the mesh vertex related to the any cloth vertex from the multiple mesh vertices, interpolate the second motion information of the mesh vertex related to the any cloth vertex, and obtain the second motion information of the any cloth vertex; and determine the first posture information of the cloth model based on the second motion information of each cloth vertex.

[0035] In a possible implementation, the determination module is used to determine, for any cloth patch included in the cloth model, second motion information of a reference point on the any cloth patch based on second motion information of at least two cloth vertices in the any cloth patch, wherein the any cloth patch includes multiple cloth vertices; and determine first posture information of the cloth model based on the second motion information of each cloth vertex and the second motion information of each reference point.

[0036] On the other hand, an electronic device is provided, comprising a processor and a memory, wherein the memory stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the electronic device implements any of the above-mentioned methods for determining a cloth posture.

[0037] On the other hand, a computer-readable storage medium is provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor so that an electronic device can implement any of the above-mentioned methods for determining a cloth posture.

[0038] On the other hand, a computer program is also provided, wherein the computer program is at least one, and the at least one computer program is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned methods for determining a cloth posture.

[0039] On the other hand, a computer program product is also provided, wherein at least one computer program is stored in the computer program product, and the at least one computer program is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned methods for determining a cloth posture.

[0040] The technical solution provided by this application brings at least the following beneficial effects:

[0041] In the technical solution provided by the present application, the two-dimensional plane where the cloth model in the flattened state is located is evenly divided to obtain a background grid, and an objective function is constructed based on the elastic energy function of the background grid and the first motion information of each grid vertex in the background grid, and the objective function is solved to obtain the second motion information of each grid vertex, so as to achieve the motion simulation of the cloth model through the background grid. Since the background grid is obtained by even division, the shape and size of each grid vertex in the background grid are the same, and the topological structure of the background grid is simple, which can speed up the efficiency of calculating the second motion information of the grid vertex. Afterwards, the first posture information of the cloth model is determined based on the second motion information of each grid vertex, so as to achieve the transmission of the motion result of the background grid back to the cloth model, thereby quickly and accurately obtaining the posture of the cloth model, and ensuring the real-time performance of the cloth simulation. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0043] Figure 1 It is a schematic diagram of an implementation environment of a method for determining a cloth posture provided in an embodiment of the present application;

[0044] Figure 2 is a flow chart of a method for determining a cloth posture provided in an embodiment of the present application;

[0045] Figure 3 is a schematic diagram of a background grid provided in an embodiment of the present application;

[0046] Figure 4 is a flow chart of another method for determining a cloth posture provided in an embodiment of the present application;

[0047] Figure 5 It is a structural schematic diagram of a device for determining a cloth posture provided in an embodiment of the present application;

[0048] Figure 6 It is a structural diagram of a terminal device provided in an embodiment of the present application;

[0049] Figure 7 It is a structural diagram of a server provided in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0051] In the field of cloth simulation technology, the posture information of cloth during movement is often determined to simulate the state changes of cloth such as stretching and twisting in different environments. It has been widely used in game development, animation production, clothing design and other scenarios.

[0052] In the related art, a cloth model can be constructed according to the three-dimensional modeling technology, and the cloth model includes multiple cloth vertices. Then, a differential equation for describing the force on the cloth vertices is constructed and solved. In the solution process, energy transfer is required according to the topological structure of the cloth vertices to obtain the motion information of the cloth vertices, and the posture information of the cloth model is determined based on the motion information of the cloth vertices.

[0053] Since each cloth vertex in the cloth model is topologically formed into multiple triangular facets, and the shape and size of the triangular facets are not fixed, the topological structure of the cloth vertex is complex, and the efficiency of calculating the motion information of the cloth vertex is low, which affects the real-time performance of the cloth simulation. In this regard, an embodiment of the present application provides a method for determining the cloth posture, which can simulate the motion of the cloth model through a background grid to speed up the calculation efficiency.

[0054] Figure 1 is a schematic diagram of an implementation environment of a method for determining a cloth posture provided in an embodiment of the present application, such as Figure 1 As shown, the implementation environment includes a terminal device 101 and a server 102. The method for determining the cloth posture in the embodiment of the present application can be executed by the terminal device 101, or by the server 102, or by the terminal device 101 and the server 102 together.

[0055] The terminal device 101 can be a smart phone, a game console, a desktop computer, a tablet computer, a laptop computer, a smart TV, a smart car device, an intelligent voice interaction device, a smart home appliance, etc. The server 102 can be a single server, or a server cluster consisting of multiple servers, or any one of a cloud computing platform and a virtualization center, which is not limited in the embodiments of the present application. The server 102 can be connected to the terminal device 101 through a communication network. The server 102 can have functions such as data processing, data storage, and data transmission and reception, which are not limited in the embodiments of the present application. The number of terminal devices 101 and servers 102 is not limited and can be one or more.

[0056] In a possible implementation, the terminal device 101 sends the initial posture information of the cloth model to the server 102 through the communication network. The server 102 determines the real-time posture information of the cloth model based on the initial posture information of the cloth model, and sends the real-time posture information of the cloth model to the terminal device 101 through the communication network. The real-time posture information of the cloth model includes the first posture information, the second posture information, the third posture information, etc. of the cloth model mentioned below.

[0057] Optionally, the server 102 determines the real-time posture information of the cloth model based on the initial posture information of the cloth model according to steps S1 to S7 as shown below.

[0058] Step S1, obtaining the initial posture information of the cloth model.

[0059] Step S2, based on the initial posture information of the cloth model, determine the motion information of each mesh vertex in the background mesh. It can be understood that the motion information of the mesh vertex mentioned here corresponds to the first motion information of the mesh vertex mentioned below, which can be seen in the relevant description below and will not be repeated here.

[0060] Step S3, obtaining the elastic energy function of the background grid.

[0061] Step S4, constructing an objective function based on the motion information of each mesh vertex and the elastic energy function of the background mesh.

[0062] Step S5, based on the motion information of each mesh vertex, solve the elastic energy function of the background mesh to obtain a solution result. The solution result corresponds to the first value of the second deformation gradient of each triangular facet mentioned below, which can be seen in the relevant description below and will not be repeated here.

[0063] Step S6, solving the objective function based on the solution result to obtain the motion information of each mesh vertex after the motion time. It can be understood that the motion information of the mesh vertex mentioned here corresponds to the second motion information of the mesh vertex mentioned below, which can be seen in the relevant description below and will not be repeated here.

[0064] Step S7, based on the motion information of each mesh vertex, determine the real-time posture information of the cloth model. It can be understood that the real-time posture information of the cloth model mentioned here corresponds to the first posture information of the cloth model mentioned below, which can be seen in the relevant description below and will not be repeated here.

[0065] On the one hand, the server 102 sends the real-time posture information of the cloth model to the terminal device 101 through the communication network. On the other hand, the server 102 executes steps S5 to S7 again. At this time, the solution result in step S5 corresponds to the second value of the second deformation gradient of each triangular facet mentioned below, the motion information of the mesh vertex mentioned in step S6 corresponds to the third motion information of the mesh vertex mentioned below, and the real-time posture information of the cloth model mentioned in step S7 corresponds to the second posture information of the cloth model mentioned below.

[0066] Next, the server 102 sends the real-time posture information of the cloth model to the terminal device 101 again through the communication network, and executes steps S5 to S7, and so on. That is, the server 102 will cyclically execute steps S5 to S7 to determine the motion information of the mesh vertices in real time, and determine the posture information of the cloth model based on the motion information of the mesh vertices, so as to ensure the real-time performance of the cloth simulation process.

[0067] by Figure 2 Taking the flowchart of a method for determining a cloth posture provided by an embodiment of the present application as an example, for the convenience of description, the terminal device or server that executes the method for determining a cloth posture in the embodiment of the present application is referred to as an electronic device, and the method can be executed by an electronic device. Figure 2 As shown, the method includes the following steps.

[0068] Step 200, evenly divide the two-dimensional plane where the cloth model in a flattened state is located to obtain a background grid.

[0069] In the embodiment of the present application, the cloth model is a model for characterizing cloth, which can be obtained by modeling through three-dimensional modeling technology. The cloth model includes multiple cloth vertices and multiple cloth patches, a cloth patch is in the shape of a geometric patch, and the vertices of the cloth patch are cloth vertices. Generally, the geometric patches presented by the cloth patch are triangular patches. Since the cloth model can be of any shape, size, etc., the distribution of cloth vertices in the cloth model can be of any topological form, and the cloth patches in the cloth model are not regularly distributed. Any cloth patch can present any size, any shape, etc. For example, the cloth patch can present a right triangle, an acute triangle, an obtuse triangle, an isosceles triangle, etc.

[0070] The two-dimensional plane where the cloth model in the flattened state is located can be evenly divided to obtain a background grid. The background grid includes multiple grid vertices and multiple grid facets, a grid facet is in the shape of a geometric facet, and the vertices of the grid facets are grid vertices. Since the background grid is obtained by even division, the grid facets in the background grid are regularly distributed, that is, any two grid facets have the same size, shape, etc. Optionally, the shape of the grid facet is a square.

[0071] See also Figure 3 , Figure 3 : is a schematic diagram of a background grid provided in an embodiment of the present application. The outer periphery of the cloth model in a flattened state is in the shape of a rectangle, the center is hollowed out, and the hollowed-out geometric shape presents an irregular shape. The two-dimensional plane where the cloth model in a flattened state is located is evenly divided to obtain a background grid, and the background grid includes a plurality of quadrilaterals of the same shape and size.

[0072] Step 201 : obtaining first motion information of each mesh vertex in the background mesh, where the first motion information of the mesh vertex represents the motion state of the mesh vertex at the first moment.

[0073] In an embodiment of the present application, it is necessary to first obtain the first motion information of each mesh vertex in the background mesh. The first motion information of the mesh vertex includes but is not limited to at least one motion parameter such as the first position information, the first speed, the first acceleration, and the first momentum of the mesh vertex. These motion parameters are used to describe the motion made by the mesh vertex at the first moment, where the first moment is an arbitrary moment.

[0074] The embodiments of the present application do not limit the method for obtaining the first motion information of the mesh vertices. Exemplarily, the first motion information of the mesh vertices is randomly generated. Or, the first motion information of the mesh vertices is input by the user. Or, when the cloth model collides with the object model, the motion information of the cloth vertices in the cloth model will change, and the motion information of the mesh vertices in the background mesh will also change with the change of the motion information of the cloth vertices. In other words, the motion information of the mesh vertices is related to the motion information of the cloth vertices. Based on this, the electronic device can obtain the initial posture information of the cloth model. The initial posture information of the cloth model can describe the shape, distortion, stretching and other postures of the cloth model when the cloth model collides with the object model. The initial posture information of the cloth model includes the first motion information of each cloth vertex, and the first motion information of the mesh vertex is determined based on the first motion information of the cloth vertex.

[0075] The object model may be any model. For example, the object model may be a sand model, a snow pile model, an elastic body model, a cloth model, a hair model, etc. If a cloth model collides with another cloth model, the collision may be called an inter-cloth collision; if a part of a cloth model collides with another part of the cloth model, the collision may be called a cloth self-collision; if a cloth model collides with an object model other than the cloth model, the collision may be called a cloth-other-object collision.

[0076] In a possible implementation, the cloth model includes multiple cloth vertices. Step 201 includes: for any mesh vertex, when any mesh vertex overlaps with a cloth vertex, determining the first motion information of a cloth vertex as the first motion information of any mesh vertex; when any mesh vertex does not overlap with a cloth vertex, determining a cloth vertex related to any mesh vertex from multiple cloth vertices, interpolating the first motion information of the cloth vertex related to any mesh vertex, and obtaining the first motion information of any mesh vertex.

[0077] like Figure 3 As shown, after the two-dimensional plane where the flattened cloth model is located is evenly divided to obtain a background mesh, the background mesh includes multiple mesh vertices. Since the cloth model includes multiple cloth vertices, a cloth vertex may overlap with a mesh vertex or may not overlap with any mesh vertex.

[0078] If a cloth vertex overlaps with a mesh vertex, the first motion information of the cloth vertex is the first motion information of the mesh vertex. If a cloth vertex does not overlap with any mesh vertex, the multiple cloth vertices located around a mesh vertex in the flattened cloth model are the cloth vertices related to the mesh vertex, and the first motion information of the mesh vertex is obtained by interpolating the first motion information of the cloth vertices related to the mesh vertex. The first motion information of the mesh vertex is determined by the first motion information of the cloth vertex, so that the background mesh has the motion performance of the cloth model, so that the background mesh can simulate the motion of the cloth model, and then determine the posture of the cloth model.

[0079] The first motion information of the cloth vertex includes but is not limited to at least one motion parameter such as the first position information, the first velocity, the first acceleration, and the first momentum of the cloth vertex, and the motion of the cloth vertex is described by these motion parameters. The embodiment of the present application does not limit the method for obtaining the first motion information of the cloth vertex, nor does it limit the method for interpolating the first motion information of each cloth vertex. Exemplarily, at least one method such as the nearest neighbor interpolation method, the bilinear interpolation method, and the quadratic B-spline interpolation method is used to interpolate the first motion information of each cloth vertex.

[0080] Step 202 : obtaining an elastic energy function of the background mesh, where the elastic energy function of the background mesh is used to describe the energy stored in the background mesh when it has the elastic properties of the cloth model.

[0081] In an embodiment of the present application, the electronic device can determine the elastic energy function of the background mesh based on the elastic performance parameters of the cloth model and the first motion information of each mesh vertex. Through the elastic energy function of the background mesh, the elastic energy stored in the background mesh is simulated when the background mesh has the elastic performance of the cloth model, so that the background mesh can simulate the traction between the cloth vertices in the cloth model, thereby simulating the change of the posture of the cloth model. The embodiment of the present application does not limit the elastic performance parameters of the cloth model. For example, the elastic performance parameters of the cloth model include tensile strength, elastic modulus, etc.

[0082] In a possible implementation, the background mesh includes a plurality of mesh patches. It is understandable that, since the mesh patch includes a plurality of mesh vertices, and any three mesh vertices in the mesh patch can constitute a triangular patch, the mesh patch includes at least one triangular patch. For example, when the shape of the mesh patch is a square, a mesh patch can be folded into two triangular patches. For any mesh patch included in the background mesh, the any mesh patch includes a plurality of mesh vertices, any mesh patch includes at least one triangular patch, and the vertex of any triangular patch is a mesh vertex. In this case, step 202 includes steps 2021 to 2022 (not shown in the figure).

[0083] Step 2021, for any triangular facet, based on the tensile strength of any triangular facet and the first position information of each mesh vertex in any triangular facet, determine the elastic energy density of any triangular facet, and the elastic energy density of any triangular facet represents the elastic energy stored in any triangular facet.

[0084] In the embodiment of the present application, the tensile strength of the triangular facet is used to characterize the critical value of the transition of the triangular facet from uniform plastic deformation to local concentrated plastic deformation when the triangular facet has the elastic properties of the cloth model. Simply put, the tensile strength of the triangular facet is the maximum load-bearing capacity of the triangular facet under static tensile conditions, that is, the resistance to the maximum uniform plastic deformation of the triangular facet. In the embodiment of the present application, the tensile strength of any triangular facet is the tensile strength of the set cloth model, based on which, the tensile strength of any two triangular facets is consistent.

[0085] The electronic device can obtain the first motion information of each mesh vertex, and the first motion information of any mesh vertex includes the first position information of the mesh vertex, and the first position information of the mesh vertex is the coordinate of the mesh vertex in three-dimensional space. Based on this, the electronic device can determine the first position information of each mesh vertex in any triangle patch.

[0086] Next, the electronic device determines the elastic energy density of any triangular facet based on the tensile strength of the triangular facet and the first position information of each mesh vertex in the triangular facet. The elastic energy density of the triangular facet is used to characterize the elastic energy stored in the elastic material per unit area when the area of ​​the triangular facet is taken as the unit area. Since the triangular facet has the elastic properties of the cloth model, the triangular facet is an elastic material and can store a certain amount of elastic energy.

[0087] Optionally, step 2021 includes steps A1 to A3 (not shown in the figure).

[0088] Step A1, determining the area and the first deformation gradient of any triangular facet based on the first position information of each mesh vertex in any triangular facet.

[0089] In the embodiment of the present application, the length of each edge in the triangular patch can be determined based on the first position information of each mesh vertex in the triangular patch, so that the shape and size of the triangular patch can be determined. On the one hand, the area of ​​the triangular patch is determined based on the length of each edge in the triangular patch, and the size of the triangular patch in two-dimensional space is described by the area of ​​the triangular patch. On the other hand, the first deformation gradient of the triangular patch is determined based on the length of each edge in the triangular patch and the first position information of each mesh vertex in the triangular patch, and the deformation mode of the triangular patch is described by the first deformation gradient of the triangular patch.

[0090] Optionally, there are two edges in any triangular face that are perpendicular to each other and equal in length; step A1 includes: determining the length of a target edge based on the first position information of each mesh vertex in any triangular face, the target edge being one of two edges that are perpendicular to each other and equal in length; determining the area of ​​any triangular face based on the length of the target edge; determining the first deformation gradient of any triangular face based on the length of the target edge and the first position information of each mesh vertex in any triangular face.

[0091] It is understandable that if there are two sides in a triangular patch that are perpendicular to each other and have equal lengths, it means that the shape of the triangular patch is an isosceles right triangle. The electronic device can determine the length of each side in the triangular patch based on the first position information of each mesh vertex in the triangular patch, and select two equal lengths from the lengths of each side to obtain the length of the target side.

[0092] Assume that the first position information of the three mesh vertices of the triangle patch f is When the shape of the triangular face is an isosceles right triangle, it satisfies s represents the length of the target edge. If the mesh patch is square, s also represents the edge length of the mesh patch.

[0093] On the one hand, the area of ​​the triangle can be determined based on the length s of the target edge On the other hand, the length s of the target edge and the first position information of each mesh vertex in the triangle patch can be used to calculate the Determine the first deformation gradient of the triangle

[0094] Step A2: determining a second deformation gradient of any triangular facet based on the first deformation gradient of any triangular facet, wherein the second deformation gradient of any triangular facet represents a deformation gradient after numerical constraints are imposed on the first deformation gradient of any triangular facet.

[0095] In the embodiment of the present application, the first deformation gradient of the triangular facet can be numerically constrained to obtain the second deformation gradient of the triangular facet, and the deformation mode of the triangular facet under the deformation constraint is described by the second deformation gradient of the triangular facet. It can be understood that there are many ways to numerically constrain the first deformation gradient of the triangular facet. A possible implementation method is shown below, and other implementation methods are not described here one by one.

[0096] Optionally, step A2 includes: performing singular value decomposition on the first deformation gradient of any triangular face to obtain a first orthogonal matrix, a first diagonal matrix and a second orthogonal matrix; replacing the first diagonal matrix with a second diagonal matrix, the second diagonal matrix representing the matrix after numerical constraints are imposed on the first diagonal matrix; and determining the second deformation gradient of any triangular face based on the first orthogonal matrix, the second diagonal matrix and the second orthogonal matrix.

[0097] In the embodiment of the present application, the first deformation gradient F of the triangular face can be f Perform singular value decomposition (SVD) to obtain the first orthogonal matrix U, the first diagonal matrix ∑ and the second orthogonal matrix V T , that is, F f =U∑V T Among them, the first orthogonal matrix U is an M×M matrix, the first diagonal matrix ∑ is an M×N matrix, and the second orthogonal matrix V T It is an N×N matrix, where M and N are both positive integers, and M and N may be the same or different.

[0098] Next, the constraint function is used to constrain the first diagonal matrix along the main direction (i.e., the direction corresponding to the singular vector) to obtain the second diagonal matrix. Optionally, the constraint function is a clamp() function, through which a known maximum and minimum value can be used to constrain the strain range. In this way, the first diagonal matrix ∑ is replaced by the second diagonal matrix J. Optionally, the second diagonal matrix satisfies

[0099] Afterwards, the first orthogonal matrix U, the second diagonal matrix J and the second orthogonal matrix V T , determine the second deformation gradient R of any triangle f , that is, R f =UJV T .

[0100] Step A3, determining the elastic energy density of any triangular facet based on the tensile strength, area, first deformation gradient and second deformation gradient of any triangular facet.

[0101] In the embodiment of the present application, the tensile strength of the triangular face can be calculated according to the following formula (1): Area A f , the first deformation gradient F f and the second deformation gradient R f , determine the elastic energy density e of the triangle patch f (X).

[0102]

[0103] Among them, SU 3x2 ={[z1,z2]∈Mat 3×2 :z1⊥z2,||z1||=||z2||=1}. Mat is the abbreviation of matrix, so Mat 3×2 Represents a 3×2 matrix, SU 3x2 Including multiple Mat 3×2 A Mat 3×2 Used to describe an isosceles right triangle with sides z1 and z2 that are perpendicular to each other and have length 1.

[0104] It should be noted that There is an analytical solution. The elastic energy density of the triangle is a function related to the second deformation gradient of the triangle. The relationship between the second deformation gradient of the triangle and the elastic energy density of the triangle is constrained by the tensile strength, area and first deformation gradient of the triangle.

[0105] It should be noted that the above formula (1) is designed based on projective dynamics. In practical applications, other principles can also be used to design the elastic energy density of the triangular facet, which will not be repeated in the embodiments of this application.

[0106] Step 2022: Determine the elastic energy function of the background mesh based on the elastic energy density of each triangular facet.

[0107] In the embodiment of the present application, the elastic energy density of each triangular facet can be added to obtain the elastic energy function of the background mesh. Optionally, the elastic energy function E of the background mesh els (X) is shown in the following formula (2).

[0108]

[0109] It should be noted that if the cloth model does not have a bending effect, the above formula (2) can be used to construct the elastic energy function of the background grid. If the cloth model has a bending effect, the following implementation method can be used to construct the elastic energy function of the background grid.

[0110] Exemplarily, step 2022 includes: obtaining the bending strength and average curvature of the cloth model; and determining the elastic energy function of the background mesh based on the bending strength, average curvature and elastic energy density of each triangular facet of the cloth model.

[0111] In the embodiment of the present application, the bending strength of the cloth model is used to describe the maximum stress that the cloth model can withstand when it breaks under the bending load or reaches a specified bending moment. The bending strength of the cloth model can reflect the bending resistance of the cloth and measure the bending performance of the cloth. The average curvature of the cloth model is used to describe the curvature of the curved surface of the cloth model embedded in the surrounding space.

[0112] The embodiment of the present application does not limit the method for obtaining the bending strength and average curvature of the cloth model. For example, the electronic device can obtain a configuration file of the cloth model, which includes the bending strength and average curvature of the cloth model, or the electronic device can determine the bending strength and average curvature of the cloth model according to the cloth material, or the electronic device can obtain the bending strength and average curvature of the cloth model input by the user.

[0113] The bending strength C of the cloth model can be calculated according to the following formula (3): bd , the average curvature Q and the elastic energy density e of each triangle f (X), determine the elastic energy function E of the background grid els (X). X represents the position information of each mesh vertex in the background mesh and is an independent variable.

[0114]

[0115] Step 203: Obtain an elastic energy function for constraining the background mesh and an objective function of the first motion information of each mesh vertex.

[0116] The embodiment of the present application does not limit the form of the objective function. For example, in addition to the elastic energy function of the background mesh and the first motion information of each mesh vertex, the objective function may also include motion parameters such as motion time, gravity acceleration, and wind speed. The objective function is a function related to the second deformation gradient of each triangular face and the position variable of each mesh vertex. By solving the objective function, the second motion information of each mesh vertex can be obtained.

[0117] In a possible implementation, step 203 includes steps 2031 to 2033 (not shown in the figure).

[0118] Step 2031, based on the first motion information of each mesh vertex and the gravity acceleration, determine the reference position of each mesh vertex, the reference position of any mesh vertex is used to describe the position of any mesh vertex after movement under the influence of gravity.

[0119] In the embodiment of the present application, the electronic device can determine the reference position of each mesh vertex based on the first motion information of each mesh vertex and the gravitational acceleration according to the kinematic principle. Optionally, the first motion information of the mesh vertex includes the first position information of the mesh vertex and the first velocity of the mesh vertex. n =x n +hv n +h 2 g, determine the reference position of each mesh vertex. Wherein, s represents the reference position of the mesh vertex, x represents the first position information of the mesh vertex, v represents the first velocity of the mesh vertex, and g represents the acceleration of gravity. n represents the number of mesh vertices, and h represents the motion time. The embodiment of the present application does not limit the method for obtaining the motion time. Exemplarily, the motion time is a parameter input by the user, or the motion time is a randomly generated parameter, or the motion time is a set parameter.

[0120] Step 2032: determine a reference energy function of the background mesh for constraining the cloth mass corresponding to the cloth model and the reference position of each mesh vertex.

[0121] In the embodiment of the present application, the electronic device can be based on the cloth mass M corresponding to the cloth model and the reference position s of each mesh vertex. n , determine the reference energy function of the background grid. There are many ways to determine the reference energy function of the background grid. In one possible implementation, the reference energy function of the background grid is: Other implementations are not described here. * is an independent variable used to characterize the position information of each mesh vertex, that is, x * A variable that represents the position of each mesh vertex.

[0122] The reference energy function of the background mesh is a function related to the position variables of the mesh vertices. The relationship between the position variables of each mesh vertex and the reference energy function of the background mesh is constrained by the cloth mass and the reference position of each mesh vertex.

[0123] Step 2033: construct an objective function based on the reference energy function of the background grid and the elastic energy function of the background grid.

[0124] In the embodiment of the present application, the reference energy function of the background grid and the elastic energy function of the background grid can be added, weighted, etc. to obtain the objective function. Optionally, the objective function E(x * )satisfy: h represents the motion time. It is understandable that when constructing the objective function, it can also be constructed based on other energy information, which is not limited here.

[0125] Step 204 , solving the objective function to obtain second motion information of each mesh vertex, where the second motion information of the mesh vertex represents the motion state of the mesh vertex at a second moment after the first moment.

[0126] Since the objective function is constructed by the reference energy function of the background mesh and the elastic energy function of the background mesh, the objective function is a function related to the position variables of the mesh vertices and the second deformation gradient of the triangular face. The cloth quality, the reference position of each mesh vertex, the tensile strength, area and first deformation gradient of each triangular face constrain the relationship between the position variables of each mesh vertex, the second deformation gradient of each triangular face and the objective function.

[0127] By solving the objective function, the second motion information of each mesh vertex can be obtained as shown in the following formula (4). n+1 Characterize the second position information of each mesh vertex, x * It is used to describe the position variables of each mesh vertex. Argmin characterizes the objective function E(x * ) takes the minimum value when the independent variable x * The value of x n+1 .

[0128]

[0129] In the embodiment of the present application, the above formula (4) is deduced in the following manner.

[0130] First, the second position information x of each mesh vertex n+1 and the second velocity v of each mesh vertex n+1 Satisfies the formula shown below.

[0131] x n+1 =x n +hv n+1

[0132] v n+1 =v n +hM -1 f els (x n+1 )+hg

[0133] Among them, x n ∈R 3n Characterizes the first position information of each mesh vertex. n ∈R 3n Characterizes the first velocity of each mesh vertex. els (x n+1 )∈R 3n The elastic force that characterizes the background mesh is a second position information x of each mesh vertex n+1 Related parameters. g∈R 3n represents the gravitational acceleration. Among them, R represents a real number, R 3n represents a 3n-dimensional matrix composed of real numbers, n represents the number of mesh vertices, h represents the motion time, and M represents the cloth mass.

[0134] In order to solve the above nonlinear equation, we can assume that the elastic force of the background grid is the elastic energy E of the background grid. els The negative gradient of In this case, the above nonlinear equation can be rewritten as shown below.

[0135]

[0136]

[0137] The first equation in the above equations is the above-mentioned formula (4). By formula (4), the second position information x of each mesh vertex can be determined. n+1 , based on the second position information x of each mesh vertex n+1 , the first position information x of each mesh vertex n and the motion time, the second velocity v of each mesh vertex can be determined n+1 .

[0138] If the cloth model does not have a bending effect, the above mentioned formula (4) is equivalent to the following formula (5).

[0139]

[0140] Based on the principle of the Alternative Direction Method, the above formula (5) can be transformed into the following formula (6).

[0141]

[0142] If the cloth model has a bending effect, the above mentioned formula (4) is equivalent to the following formula (7).

[0143]

[0144] Based on the principle of the Alternative Direction Method, the above formula (7) can be transformed into the following formula (8).

[0145]

[0146] By solving formula (6) or formula (8), the second position information of each mesh vertex can be obtained. Then, based on the second position information of each mesh vertex, at least one motion parameter such as the second velocity, the second acceleration, and the second momentum of each mesh vertex is determined, thereby obtaining the second motion information of each mesh vertex. The second motion information of the mesh vertex describes the motion of the mesh vertex at the second moment, wherein the difference between the second moment and the first moment is the motion time h.

[0147] In a possible implementation, step 204 includes steps 2041 to 2042 (not shown in the figure).

[0148] Step 2041: Solve the elastic energy function of the background mesh according to the first motion information of each mesh vertex to obtain the first value of the second deformation gradient of each triangular facet.

[0149] As mentioned above, the objective function is a function related to the position variables of the mesh vertices and the second deformation gradient of the triangular facets. The objective function includes the reference energy function of the background mesh and the elastic energy function of the background mesh. The reference energy function of the background mesh is a function related to the position variables of the mesh vertices, and the elastic energy function of the background mesh is a function related to the second deformation gradient of the triangular facets. When solving the objective function, the reference energy function of the background mesh is fixed by fixing the first motion information of each mesh vertex, and only the elastic energy function of the background mesh is solved. By minimizing the value of the elastic energy function of the background mesh, the first numerical value of the second deformation gradient of each triangular facet is obtained. That is, solving Or, solve Get the first value of the second deformation gradient of each triangular face {Rf}.

[0150] It can be understood that the above steps are to solve the elastic energy function of the background grid in the objective function, which is equivalent to solving the objective function locally. Based on this, step 2041 can also be called a local solution step (LocalStep).

[0151] Step 2042: Solve the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second motion information of each mesh vertex.

[0152] In the embodiment of the present application, by fixing the first value {R f}, the elastic energy function of the fixed background mesh is realized. In the case of the elastic energy function of the fixed background mesh, the objective function is a function related to the position variables of the mesh vertices. Therefore, by solving the objective function, the second position information of each mesh vertex can be obtained, and then the second motion information of each mesh vertex is determined based on the second position information of each mesh vertex.

[0153] In one possible implementation, the first motion information of each mesh includes the first position information of each mesh vertex, and the second motion information of each mesh includes the second speed and second position information of each mesh vertex; step 2042 includes: solving the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second position information of each mesh vertex; determining the second speed of each mesh vertex based on the first position information and the second position information of each mesh vertex.

[0154] In the embodiment of the present application, under the condition of fixing the elastic energy function of the background grid, the value of the objective function is minimized to obtain the second position information of each grid vertex. Or, solve Get the second motion information x of each mesh vertex n+1 .

[0155] Next, follow According to the first position information x of each mesh vertex n , the second position information x of each mesh vertex n+1 And the movement time h, determine the second speed v of each mesh vertex n+1 .

[0156] It is understandable that at least one motion parameter such as a second acceleration and a second momentum of each mesh vertex can also be determined based on at least one of the first position information, the second position information, the first speed, and the second speed of each mesh vertex, and the determination method is not repeated here. The second motion information of the mesh vertex includes at least one motion parameter such as the second position information, the second speed, the second acceleration, and the second momentum of the mesh vertex.

[0157] It can be understood that the above steps are to solve the objective function, which is equivalent to performing a global solution to the objective function. Based on this, step 2042 can also be called a global solution step (Global Step).

[0158] In the embodiment of the present application, solving the objective function is a quadratic optimization problem, which is equivalent to solving a set of linear equations. It can be assumed that the first deformation gradient F of the triangular face is f Satisfaction: F f =D f x * , D f : R 3n →R 3×2 , where D f is a mapping function used to transform the position variables x of each mesh vertex * The first deformation gradient F mapped to the triangular patch f , the position variable x of each mesh vertex * is a 3n-dimensional matrix composed of real numbers, where n represents the number of mesh vertices and the first deformation gradient F of the triangle patch. f is a 3×2 dimensional matrix consisting of real numbers. When the shape of the mesh patch is a square, the area of ​​the triangle patch satisfies Solving the above mentioned formula (6) is equivalent to solving the linear equation system shown in the following formula (9).

[0159]

[0160] Solving the above mentioned formula (8) is equivalent to solving the linear equation system shown in the following formula (10).

[0161]

[0162] The meanings of the parameters in formula (9) and formula (10) are described above and will not be repeated here. n It is a constant matrix, that is, the elements in the matrix are all fixed values ​​and there are no unknown parameters.

[0163] As mentioned above, the steps of solving the objective function include a local solution step and a global solution step.

[0164] The local solution step is equivalent to: Under the current configuration, for each triangle patch, calculate its closest rigid body transformation result Get the first value R of the second deformation gradient of each triangular face f .

[0165] Since each triangular face needs to be calculated, and the triangular face is a face included in the mesh face obtained by uniform division, the shape, size, etc. of each triangular face is the same. According to the elastic energy function of the background mesh, it can be known that the elastic energy function of the background mesh includes the elastic energy density of each triangular face. Based on this, when implementing step 2041, each triangular face can be first divided into triangular faces in multiple groups, and a group includes at least one adjacent triangular face. In other words, the background mesh is divided into multiple sub-areas, and the triangular faces included in a group are each triangular face in a sub-area of ​​the background mesh. Then, a corresponding computing resource is allocated to each sub-area, and the computing resource can be a processor or a thread, etc. According to the first motion information of each mesh vertex, each computing resource is used to solve the elastic energy density of each triangular face in the corresponding sub-area in parallel, and the first value of the second deformation gradient of each triangular face is obtained. Among them, for any sub-region, the computing resources corresponding to the sub-region are used, and according to the first motion information of each mesh vertex of the triangular face in the sub-region, the elastic energy density of the triangular face in the sub-region is solved to obtain the first value of the second deformation gradient of the triangular face in the sub-region. Since the background grid is obtained by uniform division, it is relatively easy to divide the background grid into multiple sub-regions, and through parallel calculation, the calculation efficiency is accelerated to ensure the real-time performance of the cloth simulation.

[0166] The global solution step is equivalent to: finding a configuration that satisfies conditions 1 and 2.

[0167] Condition 1: The desired result has the inertia of moving at a constant speed along the previous speed, that is, it satisfies

[0168] Condition 2: Make the deformation result of each triangle as close as possible to the transformation determined in the local solution step, that is, satisfy

[0169] It is understandable that different electronic devices correspond to different computing resources, and the computing resources of the same electronic device change in real time. In an embodiment of the present application, the two-dimensional plane where the cloth model in a flattened state is located is evenly divided to obtain a fine grid. When the computing resources of the electronic device are not lower than the threshold, the fine grid is used as the background grid mentioned above. When the computing resources of the electronic device are lower than the threshold, the fine grid can be uniformly sampled to obtain a coarse grid, and the coarse grid is used as the background grid mentioned above. Since the fine grid is obtained by uniform division, the topological structure is simple, and the coarse grid is obtained by uniformly sampling the fine grid, the electronic device can switch between the coarse grid and the fine grid relatively easily, and the density of the grid can be adaptively switched according to the computing resources of the electronic device.

[0170] Among them, if the background grid is a coarse grid, the second motion information of each mesh vertex in the fine grid can be determined based on the second motion information of each mesh vertex in the coarse grid by interpolation, and then the second posture information of the cloth model is determined based on the second motion information of each mesh vertex in the fine grid.

[0171] In a possible implementation, step 2042 also includes: solving the elastic energy function of the background mesh according to the second motion information of each mesh vertex to obtain the second value of the second deformation gradient of each triangular facet; solving the objective function according to the second value of the second deformation gradient of each triangular facet to obtain the third motion information of each mesh vertex, the third motion information of the mesh vertex representing the motion state of the mesh vertex at a third moment after the second moment; and determining the second posture information of the cloth model based on the third motion information of each mesh vertex.

[0172] In the embodiment of the present application, if the second motion information of each mesh vertex meets the target condition, the target function can be solved based on the second motion information of each mesh vertex to obtain the third motion information of each mesh vertex, and the third motion information of the mesh vertex is used to describe the motion of the mesh vertex at the third moment, and the difference between the third moment and the second moment is the motion time. Among them, the embodiment of the present application does not limit the content of the second motion information of each mesh vertex meeting the target condition.

[0173] Optionally, the second motion information of the mesh vertex includes at least one motion parameter, and if the value of each motion parameter is not less than a corresponding threshold, it is determined that the second motion information of the mesh vertex meets the target condition. Alternatively, the electronic device obtains a first iteration number, and when determining the second motion information of each mesh vertex, updates the first iteration number to obtain a second iteration number, and if the second iteration number is not greater than an iteration number threshold, it is determined that the second motion information of each mesh vertex meets the target condition.

[0174] When the electronic device solves the objective function based on the second motion information of each mesh vertex to obtain the third motion information of each mesh vertex, it can first fix the second motion information of each mesh vertex to implement the reference energy function of the fixed background mesh, and only solve the elastic energy function of the background mesh. By minimizing the value of the elastic energy function of the background mesh, the second value of the second deformation gradient of each triangular face is obtained. Then, by fixing the second value of the second deformation gradient of each triangular face, the elastic energy function of the fixed background mesh is implemented. In the case of the elastic energy function of the fixed background mesh, the objective function is a function related to the position variable of the mesh vertex. Therefore, by solving the objective function, the third position information of each mesh vertex can be obtained, and then the third motion information of each mesh vertex can be determined based on the third position information of each mesh vertex. The implementation method of the above content can be seen in the description of steps 2041 to 2042, which will not be repeated here.

[0175] Afterwards, based on the third motion information of each mesh vertex, the second posture information of the cloth model is determined. The second posture information can be determined in the description of step 205. The implementation principles of the two are similar and will not be described here.

[0176] Next, if the third motion information of each mesh vertex meets the target condition, the target function can be solved based on the third motion information of each mesh vertex to obtain the fourth motion information of each mesh vertex. After that, the third posture information of the cloth model is determined based on the fourth motion information of each mesh vertex. Among them, the content that the third motion information of each mesh vertex meets the target condition is similar to the content that the second motion information of each mesh vertex meets the target condition. The method for determining the third posture information can be seen in the description of step 205, which will not be repeated here.

[0177] It should be noted that for the objective function to be solved The convexity of the objective function can be avoided by setting a smaller movement time h. If the movement time h→0, the objective function will degenerate into a quadratic optimization problem. In this case, a smaller iteration threshold can be set to allow the objective function to converge better.

[0178] In the embodiment of the present application, the elastic movement of the cloth model is simulated by the background grid. Since the background grid is obtained by uniform division, the shapes and sizes of the mesh facets are the same, so that the electronic device can solve in parallel and efficiently, and quickly determine the motion information of the mesh vertices. In addition, the background grid naturally supports multi-physics field coupling. When the cloth interacts with other objects, the cloth model is simulated by the background grid, and the motion information of the mesh vertices is quickly determined, thereby realizing the rapid solution of the posture of the cloth model, improving the calculation efficiency, and ensuring the real-time performance of the cloth simulation.

[0179] Step 205: Determine first posture information of the cloth model based on the second motion information of each mesh vertex.

[0180] In the embodiment of the present application, the motion of the cloth model is simulated by the background mesh by making the background mesh have the same elastic properties, motion state, etc. as the cloth model. Therefore, the motion information of each mesh vertex in the background mesh is related to the motion information of each cloth vertex in the cloth model. The second motion information of each cloth vertex in the cloth model can be determined based on the second motion information of each mesh vertex in the background mesh, and the first posture information of the cloth model includes the second motion information of each cloth vertex.

[0181] In the embodiment of the present application, the elastic motion of the cloth model is first simulated by the background grid to obtain the second motion information of each grid vertex, and then the second motion information of each cloth vertex is determined by the second motion information of each grid vertex, so as to realize the combination of cloth simulation based on the background grid and motion solution of cloth vertex. This solution method belongs to the particle-grid method. When performing cloth simulation by the particle-grid method, there is no need to consider the collision term additionally, which reduces the amount of calculation, so that complex cloth collision and friction can be automatically processed.

[0182] In a possible implementation, the cloth model includes a plurality of cloth vertices; step 205 includes steps 2051 to 2053 (not shown in the figure).

[0183] Step 2051: for any cloth vertex, when any mesh vertex overlaps with a cloth vertex, the second motion information of a mesh vertex is determined as the second motion information of any cloth vertex.

[0184] In the embodiment of the present application, after the two-dimensional plane where the cloth model in the flattened state is located is evenly divided to obtain the background mesh, any mesh vertex in the background mesh may overlap with a cloth vertex in the cloth model, or may not overlap with any cloth vertex. If a mesh vertex overlaps with a cloth vertex, the second motion information of the mesh vertex is the second motion information of the cloth vertex.

[0185] Step 2052: when any mesh vertex does not overlap with a cloth vertex, determine a mesh vertex related to any cloth vertex from multiple mesh vertices, interpolate the second motion information of the mesh vertex related to any cloth vertex, and obtain the second motion information of any cloth vertex.

[0186] If a mesh vertex does not overlap with any cloth vertex, multiple mesh vertices in the background mesh surrounding a cloth vertex in the cloth model in a flattened state are mesh vertices related to the cloth vertex, and the second motion information of the cloth vertex is obtained by interpolating the second motion information of each mesh vertices related to the cloth vertex.

[0187] The second motion information of the cloth vertex also includes at least one motion parameter such as the second velocity, second position information, second acceleration, and second momentum of the cloth vertex, and the motion of the cloth vertex is described by these motion parameters. The embodiment of the present application does not limit the method of interpolating the second motion information of each mesh vertex. Exemplarily, at least one method such as nearest neighbor interpolation, bilinear interpolation, and quadratic B-spline interpolation is used to interpolate the second motion information of each mesh vertex.

[0188] Step 2053: Determine first posture information of the cloth model based on the second motion information of each cloth vertex.

[0189] In the embodiment of the present application, the first posture information of the cloth model includes the second motion information of each cloth vertex. The static postures such as shape, stretching, and twisting of the cloth model can be determined through the second position information of each cloth vertex, and the dynamic posture of the cloth model can be determined through the motion parameters such as the second velocity, second acceleration, and second momentum of each cloth vertex.

[0190] Optionally, step 2053 includes: for any cloth patch included in the cloth model, based on the second motion information of at least two cloth vertices in any cloth patch, determining the second motion information of a reference point on any cloth patch, and any cloth patch includes multiple cloth vertices; based on the second motion information of each cloth vertex and the second motion information of each reference point, determining the first posture information of the cloth model.

[0191] In the embodiment of the present application, the cloth model includes multiple cloth patches, and there is at least one reference point on any cloth patch. The embodiment of the present application does not limit the reference point. For example, the reference point can be the midpoint of the upper edge of the cloth patch, the reference point can also be the center of gravity of the cloth patch, etc.

[0192] Next, the second motion information of each reference point on the fabric patch can be determined based on the second motion information of at least two fabric vertices in the fabric patch. It is understandable that the relationship between the reference point and the fabric patch is different, and the method of determining the second motion information of the reference point is also different. For example, taking the reference point as the midpoint of the upper edge of the fabric patch as an example, the average value of the second motion information of the two fabric vertices at both ends of the upper edge of the fabric patch can be calculated, and the average value can be used as the second motion information of the reference point. For another example, taking the reference point as the center of gravity of the fabric patch as an example, the second position information of the reference point can be first determined based on the second position information of each fabric vertex on the fabric patch. This step is equivalent to determining the coordinates of the center of gravity of the fabric patch. Next, based on the second position information of the reference point and the second motion information of each fabric vertex on the fabric patch, the second motion information of the reference point is determined.

[0193] The second motion information of the reference point includes at least one motion parameter such as the second position information, the second speed, the second acceleration, and the second momentum of the reference point. The first posture information of the cloth model includes the second motion information of each cloth vertex and the second motion information of each reference point. By determining the second motion information of the reference point, the points inside the cloth patch are increased, and a more detailed division of the cloth model is achieved, so that the cloth model is represented more carefully, and the expressiveness of the cloth model is improved.

[0194] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals involved in this application are all authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards in the relevant regions. For example, the cloth model and cloth vertex motion information involved in this application are all obtained with full authorization.

[0195] In the above method, the two-dimensional plane where the cloth model in the flattened state is located is evenly divided to obtain a background grid, and the objective function is constructed based on the elastic energy function of the background grid and the first motion information of each grid vertex in the background grid, and the objective function is solved to obtain the second motion information of each grid vertex, so as to achieve the motion simulation of the cloth model through the background grid. Since the background grid is obtained by even division, the shape and size of each grid vertex in the background grid are the same, and the topological structure of the background grid is simple, which can speed up the efficiency of calculating the second motion information of the grid vertex. Afterwards, the first posture information of the cloth model is determined based on the second motion information of each grid vertex, so as to achieve the transmission of the motion result of the background grid back to the cloth model, thereby quickly and accurately obtaining the posture of the cloth model, and ensuring the real-time performance of the cloth simulation.

[0196] The above describes the contents of the embodiments of the present application from the perspective of method steps. Figure 4 To give a systematic and comprehensive description, Figure 4 FIG. 1 is a flow chart of another method for determining a cloth posture provided by an embodiment of the present application. Figure 4 As shown, the embodiment of the present application includes a cloth simulator and a Material Point Method (MPM) simulator. The cloth simulator is used to simulate the cloth model, and can determine the motion information of each cloth vertex, and determine the posture information of the cloth model based on the motion information of each cloth vertex. The MPM simulator is used to simulate the cloth model on the background grid, and the motion information of each grid vertex is obtained by constructing an objective function and solving the objective function. The cloth simulator and the MPM simulator are introduced in detail below.

[0197] In an embodiment of the present application, a cloth simulator and an MPM simulator may be configured on the electronic device. The cloth simulator may be initialized based on the initial posture information of the cloth model, so that the cloth simulator may obtain the motion information of each cloth vertex. Then, the MPM simulator is initialized according to the motion information of each cloth vertex, so that the MPM simulator may obtain the motion information of each mesh vertex in the background mesh, thereby simulating the posture of the cloth model in the cloth simulator through the background mesh in the MPM simulator. The MPM simulator obtains the elastic energy function of the background mesh, and constructs the objective function based on the motion information of each mesh vertex and the elastic energy function of the background mesh.

[0198] Next, the MPM simulator solves the elastic energy function of the background mesh according to the motion information of each mesh vertex, obtains the solution result, and solves the objective function based on the solution result to obtain the motion information of each mesh vertex. After that, the cloth simulator updates the motion information of each cloth vertex based on the motion information of each mesh vertex, and determines the posture information of the cloth model based on the motion information of each cloth vertex. It should be noted that the above steps are performed iteratively.

[0199] That is, after constructing the objective function, the objective function is solved by multi-step iteration through the MPM simulator. After each step of iteration, the motion information of each cloth vertex is updated based on the motion information of each mesh vertex, thereby updating the posture information of the cloth model.

[0200] Through the MPM simulator and the cloth simulator, the movement of the cloth model is simulated through the background grid, the movement information of each cloth vertex in the cloth model is interpolated to the background grid, the cloth elasticity calculation is performed on the background grid, the movement information of the background grid is obtained, and then the movement information of the background grid is interpolated back to the cloth model. Through the information transmission between the MPM simulator and the cloth simulator, the elasticity calculation is first performed on the background grid without adding additional penalty items, and then the collision result of the cloth model is determined based on the elasticity calculation result, so that the elasticity calculation and collision solution are processed separately in different simulators, improving the calculation efficiency.

[0201] Since the background grid is obtained by uniform division, elastic calculations can be performed in parallel to speed up the calculation efficiency, and the authenticity of the simulation can be ensured while achieving real-time simulation. The method of the embodiment of the present application can be applied in a game engine, through which the collision between the cloth model and other cloth models, rigid body models, elastic body models, and other object models can be quickly resolved to ensure the real-time nature of the cloth simulation.

[0202] Figure 5 FIG. 1 is a schematic diagram of a structure of a device for determining a cloth posture provided in an embodiment of the present application. Figure 5 As shown, the device comprises:

[0203] A division module 501 is used to evenly divide the two-dimensional plane where the cloth model in a flattened state is located to obtain a background grid;

[0204] An acquisition module 502 is used to acquire first motion information of each mesh vertex in the background mesh, where the first motion information of the mesh vertex represents a motion state of the mesh vertex at a first moment;

[0205] The acquisition module 502 is further used to acquire the elastic energy function of the background grid, where the elastic energy function of the background grid is used to describe the energy stored in the background grid when it has the elastic properties of the cloth model;

[0206] The acquisition module 502 is further used to acquire an elastic energy function for constraining the background mesh and an objective function of the first motion information of each mesh vertex;

[0207] A solving module 503 is used to solve the objective function to obtain second motion information of each mesh vertex, where the second motion information of the mesh vertex represents a motion state of the mesh vertex at a second moment after the first moment;

[0208] The determination module 504 is used to determine the first posture information of the cloth model based on the second motion information of each mesh vertex.

[0209] In a possible implementation, the cloth model includes multiple cloth vertices; the acquisition module 502 is used to, for any mesh vertex, determine the first motion information of a cloth vertex as the first motion information of any mesh vertex when any mesh vertex overlaps with a cloth vertex; when any mesh vertex does not overlap with a cloth vertex, determine the cloth vertex related to any mesh vertex from multiple cloth vertices, interpolate the first motion information of the cloth vertex related to any mesh vertex, and obtain the first motion information of any mesh vertex.

[0210] In a possible implementation, the background mesh includes a plurality of mesh facets, any mesh facet includes a plurality of mesh vertices, any mesh facet includes at least one triangle facet and a vertex of any triangle facet is a mesh vertex;

[0211] Acquisition module 502 is used to determine the elastic energy density of any triangular facet based on the tensile strength of any triangular facet and the first position information of each mesh vertex in any triangular facet, wherein the elastic energy density of any triangular facet represents the elastic energy stored in any triangular facet; and determine the elastic energy function of the background mesh based on the elastic energy density of each triangular facet.

[0212] In one possible implementation, the acquisition module 502 is used to determine the area and first deformation gradient of any triangular facet based on the first position information of each mesh vertex in any triangular facet; determine the second deformation gradient of any triangular facet based on the first deformation gradient of any triangular facet, and the second deformation gradient of any triangular facet represents the deformation gradient after numerical constraints are imposed on the first deformation gradient of any triangular facet; determine the elastic energy density of any triangular facet based on the tensile strength, area, first deformation gradient and second deformation gradient of any triangular facet.

[0213] In one possible implementation, there are two edges in any triangular facet that are perpendicular to each other and equal in length; an acquisition module 502 is used to determine the length of a target edge based on first position information of each mesh vertex in any triangular facet, where the target edge is one of two edges that are perpendicular to each other and equal in length; based on the length of the target edge, the area of ​​any triangular facet is determined; based on the length of the target edge and the first position information of each mesh vertex in any triangular facet, the first deformation gradient of any triangular facet is determined.

[0214] In one possible implementation, an acquisition module 502 is used to perform singular value decomposition on the first deformation gradient of any triangular face to obtain a first orthogonal matrix, a first diagonal matrix, and a second orthogonal matrix; the first diagonal matrix is ​​replaced by a second diagonal matrix, and the second diagonal matrix represents a matrix after numerical constraints are imposed on the first diagonal matrix; based on the first orthogonal matrix, the second diagonal matrix, and the second orthogonal matrix, the second deformation gradient of any triangular face is determined.

[0215] In a possible implementation, the acquisition module 502 is used to acquire the bending strength and average curvature of the cloth model; and determine the elastic energy function of the background mesh based on the bending strength, average curvature and elastic energy density of each triangular facet of the cloth model.

[0216] In a possible implementation, the acquisition module 502 is used to determine the reference position of each mesh vertex based on the first motion information and gravity acceleration of each mesh vertex, where the reference position of any mesh vertex is used to describe the position of any mesh vertex after movement under the influence of gravity; determine the reference energy function of the background mesh used to constrain the cloth mass corresponding to the cloth model and the reference position of each mesh vertex; and construct an objective function based on the reference energy function of the background mesh and the elastic energy function of the background mesh.

[0217] In one possible implementation, the solution module 503 is used to solve the elastic energy function of the background mesh according to the first motion information of each mesh vertex to obtain the first value of the second deformation gradient of each triangular facet; and solve the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second motion information of each mesh vertex.

[0218] In a possible implementation, the first motion information of each mesh includes first position information of each mesh vertex, and the second motion information of each mesh includes second speed and second position information of each mesh vertex;

[0219] The solving module 503 is used to solve the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second position information of each mesh vertex; based on the first position information and the second position information of each mesh vertex, determine the second speed of each mesh vertex.

[0220] In a possible implementation, the solving module 503 is further used to solve the elastic energy function of the background mesh according to the second motion information of each mesh vertex to obtain a second value of the second deformation gradient of each triangular facet;

[0221] The solving module 503 is further used to solve the objective function according to the second value of the second deformation gradient of each triangular facet to obtain third motion information of each mesh vertex, where the third motion information of the mesh vertex represents the motion state of the mesh vertex at a third moment after the second moment;

[0222] The determination module 504 is further configured to determine second posture information of the cloth model based on the third motion information of each mesh vertex.

[0223] In a possible implementation, the cloth model includes multiple cloth vertices; a determination module 504 is used to, for any cloth vertex, determine the second motion information of a mesh vertex as the second motion information of any cloth vertex when any mesh vertex overlaps with a cloth vertex; when any mesh vertex does not overlap with a cloth vertex, determine the mesh vertex related to any cloth vertex from multiple mesh vertices, interpolate the second motion information of the mesh vertex related to any cloth vertex, and obtain the second motion information of any cloth vertex; based on the second motion information of each cloth vertex, determine the first posture information of the cloth model.

[0224] In a possible implementation, the determination module 504 is used to determine, for any cloth patch included in the cloth model, second motion information of a reference point on any cloth patch based on second motion information of at least two cloth vertices in any cloth patch, where any cloth patch includes multiple cloth vertices; and determine first posture information of the cloth model based on the second motion information of each cloth vertex and the second motion information of each reference point.

[0225] In the above device, the two-dimensional plane where the cloth model in the flattened state is located is evenly divided to obtain a background grid, and an objective function is constructed based on the elastic energy function of the background grid and the first motion information of each grid vertex in the background grid, and the objective function is solved to obtain the second motion information of each grid vertex, so that the motion of the cloth model is simulated by the background grid. Since the background grid is obtained by even division, the shape, size, etc. of each grid vertex in the background grid are the same, and the topological structure of the background grid is simple, which can speed up the efficiency of calculating the second motion information of the grid vertex. Afterwards, the first posture information of the cloth model is determined based on the second motion information of each grid vertex, so that the motion result of the background grid is transmitted back to the cloth model, so as to quickly and accurately obtain the posture of the cloth model, and ensure the real-time performance of the cloth simulation.

[0226] It should be understood that the above Figure 5When the device provided realizes its functions, only the division of the above-mentioned functional modules is used as an example for illustration. In practical applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device and method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0227] Figure 6 The structure block diagram of a terminal device 600 provided by an exemplary embodiment of the present application is shown. The terminal device 600 includes: a processor 601 and a memory 602 .

[0228] The processor 601 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 601 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 601 may also include a main processor and a coprocessor. The main processor is a processor for processing data in an awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in a standby state. In some embodiments, the processor 601 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 601 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.

[0229] The memory 602 may include one or more computer-readable storage media, which may be non-transitory. The memory 602 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 602 is used to store at least one computer program, which is used to be executed by the processor 601 to implement the method for determining the cloth posture provided in the method embodiment of the present application.

[0230] In some embodiments, the terminal device 600 may further optionally include: a peripheral device interface 603 and at least one peripheral device. The processor 601, the memory 602 and the peripheral device interface 603 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 603 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 604, a display screen 605, a camera assembly 606, an audio circuit 607 and a power supply 608.

[0231] The peripheral device interface 603 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 601 and the memory 602. In some embodiments, the processor 601, the memory 602, and the peripheral device interface 603 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 601, the memory 602, and the peripheral device interface 603 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.

[0232] The radio frequency circuit 604 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 604 communicates with the communication network and other communication devices through electromagnetic signals. The radio frequency circuit 604 converts the electrical signal into an electromagnetic signal for transmission, or converts the received electromagnetic signal into an electrical signal. Optionally, the radio frequency circuit 604 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, etc. The radio frequency circuit 604 can communicate with other terminals through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to: the World Wide Web, a metropolitan area network, an intranet, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a WiFi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 604 may also include circuits related to NFC (Near Field Communication), which is not limited in this application.

[0233] The display screen 605 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos, and any combination thereof. When the display screen 605 is a touch display screen, the display screen 605 also has the ability to collect touch signals on the surface or above the surface of the display screen 605. The touch signal can be input to the processor 601 as a control signal for processing. At this time, the display screen 605 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 605 can be one, set on the front panel of the terminal device 600; in other embodiments, the display screen 605 can be at least two, respectively set on different surfaces of the terminal device 600 or in a folding design; in other embodiments, the display screen 605 can be a flexible display screen, set on the curved surface or folding surface of the terminal device 600. Even, the display screen 605 can also be set to a non-rectangular irregular shape, that is, a special-shaped screen. The display screen 605 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode, organic light-emitting diode).

[0234] The camera assembly 606 is used to capture images or videos. Optionally, the camera assembly 606 includes a front camera and a rear camera. Typically, the front camera is arranged on the front panel of the terminal, and the rear camera is arranged on the back of the terminal. In some embodiments, there are at least two rear cameras, which are any one of a main camera, a depth of field camera, a wide-angle camera, and a telephoto camera, so as to realize the fusion of the main camera and the depth of field camera to realize the background blur function, the fusion of the main camera and the wide-angle camera to realize the panoramic shooting and VR (Virtual Reality) shooting function or other fusion shooting functions. In some embodiments, the camera assembly 606 may also include a flash. The flash can be a monochrome temperature flash or a dual-color temperature flash. A dual-color temperature flash refers to a combination of a warm light flash and a cold light flash, which can be used for light compensation at different color temperatures.

[0235] The audio circuit 607 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 601 for processing, or input them into the radio frequency circuit 604 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there may be multiple microphones, which are respectively arranged at different parts of the terminal device 600. The microphone may also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 601 or the radio frequency circuit 604 into sound waves. The speaker may be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into sound waves audible to humans, but also convert the electrical signal into sound waves inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 607 may also include a headphone jack.

[0236] The power supply 608 is used to power various components in the terminal device 600. The power supply 608 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 608 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery charged through a wired line, and a wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery can also be used to support fast charging technology.

[0237] In some embodiments, the terminal device 600 further includes one or more sensors 609 , including but not limited to: an acceleration sensor 611 , a gyroscope sensor 612 , a pressure sensor 613 , an optical sensor 614 , and a proximity sensor 615 .

[0238] The acceleration sensor 611 can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established by the terminal device 600. For example, the acceleration sensor 611 can be used to detect the components of gravity acceleration on the three coordinate axes. The processor 601 can control the display screen 605 to display the user interface in a horizontal view or a vertical view according to the gravity acceleration signal collected by the acceleration sensor 611. The acceleration sensor 611 can also be used for collecting game or user motion data.

[0239] The gyroscope sensor 612 can detect the body direction and rotation angle of the terminal device 600, and the gyroscope sensor 612 can cooperate with the acceleration sensor 611 to collect the user's 3D actions on the terminal device 600. The processor 601 can implement the following functions based on the data collected by the gyroscope sensor 612: motion sensing (such as changing the UI according to the user's tilt operation), image stabilization during shooting, game control, and inertial navigation.

[0240] The pressure sensor 613 can be set on the side frame of the terminal device 600 and / or the lower layer of the display screen 605. When the pressure sensor 613 is set on the side frame of the terminal device 600, it can detect the user's holding signal of the terminal device 600, and the processor 601 performs left and right hand recognition or shortcut operation according to the holding signal collected by the pressure sensor 613. When the pressure sensor 613 is set on the lower layer of the display screen 605, the processor 601 controls the operability controls on the UI interface according to the user's pressure operation on the display screen 605. The operability controls include at least one of a button control, a scroll bar control, an icon control, and a menu control.

[0241] The optical sensor 614 is used to collect the ambient light intensity. In one embodiment, the processor 601 can control the display brightness of the display screen 605 according to the ambient light intensity collected by the optical sensor 614. Specifically, when the ambient light intensity is high, the display brightness of the display screen 605 is increased; when the ambient light intensity is low, the display brightness of the display screen 605 is reduced. In another embodiment, the processor 601 can also dynamically adjust the shooting parameters of the camera assembly 606 according to the ambient light intensity collected by the optical sensor 614.

[0242] The proximity sensor 615, also called a distance sensor, is usually arranged on the front panel of the terminal device 600. The proximity sensor 615 is used to collect the distance between the user and the front of the terminal device 600. In one embodiment, when the proximity sensor 615 detects that the distance between the user and the front of the terminal device 600 is gradually decreasing, the processor 601 controls the display screen 605 to switch from the screen-on state to the screen-off state; when the proximity sensor 615 detects that the distance between the user and the front of the terminal device 600 is gradually increasing, the processor 601 controls the display screen 605 to switch from the screen-off state to the screen-on state.

[0243] Those skilled in the art will understand that Figure 6 The structure shown in the figure does not constitute a limitation on the terminal device 600, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.

[0244] Figure 7This is a schematic diagram of the structure of the server provided in the embodiment of the present application. The server 700 may have relatively large differences due to different configurations or performances, and may include one or more processors 701 and one or more memories 702, wherein the one or more memories 702 store at least one computer program, and the at least one computer program is loaded and executed by the one or more processors 701 to implement the cloth posture determination method provided in the above-mentioned various method embodiments. Exemplarily, the processor 701 is a CPU. Of course, the server 700 may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output. The server 700 may also include other components for implementing device functions, which will not be described in detail here.

[0245] In an exemplary embodiment, a computer-readable storage medium is further provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned methods for determining a cloth posture.

[0246] Optionally, the computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.

[0247] In an exemplary embodiment, a computer program is also provided. The computer program is at least one, and the at least one computer program is loaded and executed by a processor to enable an electronic device to implement any of the above-mentioned methods for determining a cloth posture.

[0248] In an exemplary embodiment, a computer program product is further provided, in which at least one computer program is stored. The at least one computer program is loaded and executed by a processor so that an electronic device can implement any of the above-mentioned methods for determining a cloth posture.

[0249] It should be understood that the "plurality" mentioned in this article refers to two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.

[0250] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

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

Claims

1. A method for determining a cloth posture, characterized in that: The method comprises: The two-dimensional plane where the cloth model in a flattened state is located is evenly divided to obtain a background grid; Acquire first motion information of each mesh vertex in the background mesh, where the first motion information of the mesh vertex represents a motion state of the mesh vertex at a first moment; Acquire an elastic energy function of the background grid, where the elastic energy function of the background grid is used to describe the energy stored in the background grid when it has the elastic properties of the cloth model; Acquire an elastic energy function for constraining the background mesh and an objective function of the first motion information of each mesh vertex; Solving the objective function to obtain second motion information of each mesh vertex, where the second motion information of the mesh vertex represents a motion state of the mesh vertex at a second moment after the first moment; Based on the second motion information of each mesh vertex, first posture information of the cloth model is determined.

2. The method according to claim 1, characterized in that The cloth model includes a plurality of cloth vertices; the step of obtaining first motion information of each mesh vertex in the background mesh includes: For any mesh vertex, when the any mesh vertex overlaps with a cloth vertex, determining the first motion information of the cloth vertex as the first motion information of the any mesh vertex; In a case where any one of the mesh vertices does not overlap with a cloth vertex, a cloth vertex related to the any one of the mesh vertices is determined from the multiple cloth vertices, and first motion information of the cloth vertex related to the any one of the mesh vertices is interpolated to obtain the first motion information of the any one of the mesh vertices.

3. The method according to claim 1, characterized in that The background mesh includes a plurality of mesh facets, any one of which includes a plurality of mesh vertices, any one of which includes at least one triangular facet and the vertex of any one of which is the mesh vertex; The step of obtaining the elastic energy function of the background grid includes: For any triangular facet, based on the tensile strength of the any triangular facet and the first position information of each mesh vertex in the any triangular facet, determine the elastic energy density of the any triangular facet, wherein the elastic energy density of the any triangular facet represents the elastic energy stored in the any triangular facet; Based on the elastic energy density of each triangular facet, the elastic energy function of the background mesh is determined.

4. The method according to claim 3, characterized in that The step of determining the elastic energy density of any triangular facet based on the tensile strength of any triangular facet and the first position information of each mesh vertex in any triangular facet comprises: Determine the area and the first deformation gradient of any triangular facet based on the first position information of each mesh vertex in any triangular facet; Based on the first deformation gradient of any triangular facet, determining a second deformation gradient of any triangular facet, wherein the second deformation gradient of any triangular facet represents a deformation gradient after numerical constraints are imposed on the first deformation gradient of any triangular facet; The elastic energy density of any triangular facet is determined based on the tensile strength, the area, the first deformation gradient, and the second deformation gradient of any triangular facet.

5. The method according to claim 4, characterized in that In any of the triangles, there are two edges that are perpendicular to each other and have the same length; The determining the area and the first deformation gradient of any triangular facet based on the first position information of each mesh vertex in any triangular facet comprises: Determine the length of a target edge based on first position information of each mesh vertex in any one of the triangular facets, wherein the target edge is one of two edges that are perpendicular to each other and have equal lengths; Determine the area of ​​any one of the triangles based on the length of the target edge; Based on the length of the target edge and the first position information of each mesh vertex in any one of the triangular facets, a first deformation gradient of the any one of the triangular facets is determined.

6. The method according to claim 4, characterized in that The determining the second deformation gradient of any triangular facet based on the first deformation gradient of any triangular facet comprises: Performing singular value decomposition on the first deformation gradient of any triangular facet to obtain a first orthogonal matrix, a first diagonal matrix, and a second orthogonal matrix; Replacing the first diagonal matrix with a second diagonal matrix, wherein the second diagonal matrix represents a matrix after numerical constraints are applied to the first diagonal matrix; Based on the first orthogonal matrix, the second diagonal matrix and the second orthogonal matrix, a second deformation gradient of any one of the triangular facets is determined.

7. The method according to claim 3, characterized in that The step of determining the elastic energy function of the background grid based on the elastic energy density of each triangular facet includes: Obtaining the bending strength and average curvature of the cloth model; The elastic energy function of the background mesh is determined based on the bending strength and average curvature of the cloth model and the elastic energy density of each triangular facet.

8. The method according to claim 1, characterized in that The step of obtaining the elastic energy function for constraining the background mesh and the objective function of the first motion information of each mesh vertex includes: Determine a reference position of each mesh vertex based on the first motion information of each mesh vertex and the gravity acceleration, wherein the reference position of any mesh vertex is used to describe the position of any mesh vertex after movement under the influence of gravity; Determine a reference energy function of the background mesh for constraining a cloth mass corresponding to the cloth model and a reference position of each mesh vertex; The objective function is constructed based on the reference energy function of the background grid and the elastic energy function of the background grid.

9. The method according to claim 8, characterized in that The step of solving the objective function to obtain the second motion information of each mesh vertex includes: Solving the elastic energy function of the background mesh according to the first motion information of each mesh vertex to obtain a first value of a second deformation gradient of each triangular facet; The objective function is solved according to the first value of the second deformation gradient of each triangular facet to obtain the second motion information of each mesh vertex.

10. The method according to claim 9, characterized in that The first motion information of each mesh includes first position information of each mesh vertex, and the second motion information of each mesh includes second speed and second position information of each mesh vertex; Solving the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second motion information of each mesh vertex includes: Solving the objective function according to the first value of the second deformation gradient of each triangular facet to obtain second position information of each mesh vertex; Based on the first position information and the second position information of each mesh vertex, a second speed of each mesh vertex is determined.

11. The method according to claim 9, characterized in that After solving the objective function according to the first value of the second deformation gradient of each triangular facet to obtain the second motion information of each mesh vertex, the method further includes: Solving the elastic energy function of the background mesh according to the second motion information of each mesh vertex to obtain a second value of a second deformation gradient of each triangular facet; Solving the objective function according to the second value of the second deformation gradient of each triangular facet to obtain third motion information of each mesh vertex, wherein the third motion information of the mesh vertex represents a motion state of the mesh vertex at a third moment after the second moment; Based on the third motion information of each mesh vertex, second posture information of the cloth model is determined.

12. The method according to any one of claims 1 to 11, characterized in that: The cloth model includes a plurality of cloth vertices; and determining the first posture information of the cloth model based on the second motion information of each mesh vertex includes: For any cloth vertex, when any mesh vertex overlaps with a cloth vertex, determining the second motion information of the mesh vertex as the second motion information of the any cloth vertex; In a case where any one of the mesh vertices does not overlap with a cloth vertex, determining a mesh vertex related to the any one of the cloth vertices from the multiple mesh vertices, and interpolating second motion information of the mesh vertex related to the any one of the cloth vertices to obtain second motion information of the any one of the cloth vertices; Based on the second motion information of each cloth vertex, first posture information of the cloth model is determined.

13. The method according to claim 12, characterized in that The determining the first posture information of the cloth model based on the second motion information of each cloth vertex includes: For any cloth patch included in the cloth model, determining second motion information of a reference point on the any cloth patch based on second motion information of at least two cloth vertices in the any cloth patch, wherein the any cloth patch includes a plurality of cloth vertices; Based on the second motion information of each cloth vertex and the second motion information of each reference point, first posture information of the cloth model is determined.

14. A device for determining a cloth posture, characterized in that: The device comprises: A division module is used to evenly divide the two-dimensional plane where the cloth model in a flattened state is located to obtain a background grid; An acquisition module, used for acquiring first motion information of each mesh vertex in the background mesh, wherein the first motion information of the mesh vertex represents a motion state of the mesh vertex at a first moment; The acquisition module is further used to acquire the elastic energy function of the background grid, where the elastic energy function of the background grid is used to describe the energy stored in the background grid when it has the elastic properties of the cloth model; The acquisition module is further used to acquire the elastic energy function used to constrain the background mesh and the first motion information of each mesh vertex; A solution module, used for solving the objective function to obtain second motion information of each mesh vertex, wherein the second motion information of the mesh vertex represents a motion state of the mesh vertex at a second moment after the first moment; The determination module is used to determine the first posture information of the cloth model based on the second motion information of each mesh vertex.

15. An electronic device, characterized in that: The electronic device includes a processor and a memory, wherein at least one computer program is stored in the memory, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the method for determining the cloth posture as described in any one of claims 1 to 13.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores at least one computer program, and the at least one computer program is loaded and executed by the processor so that the electronic device implements the method for determining the cloth posture as described in any one of claims 1 to 13.

17. A computer program product, characterized in that The computer program product stores at least one computer program, and the at least one computer program is loaded and executed by a processor so that the electronic device implements the method for determining the cloth posture as described in any one of claims 1 to 13.