CN112581602B - Clothing dynamic simulation method and device, electronic equipment and storage medium - Google Patents
Clothing dynamic simulation method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112581602B CN112581602B CN202011461934.7A CN202011461934A CN112581602B CN 112581602 B CN112581602 B CN 112581602B CN 202011461934 A CN202011461934 A CN 202011461934A CN 112581602 B CN112581602 B CN 112581602B
- Authority
- CN
- China
- Prior art keywords
- vertex
- triangle
- determining
- simulated
- speed
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000005094 computer simulation Methods 0.000 title claims abstract description 15
- 238000001514 detection method Methods 0.000 claims abstract description 72
- 239000013598 vector Substances 0.000 claims description 27
- 238000009958 sewing Methods 0.000 claims description 14
- 238000004590 computer program Methods 0.000 claims description 9
- 238000004088 simulation Methods 0.000 claims description 6
- 230000000694 effects Effects 0.000 abstract description 13
- 238000013461 design Methods 0.000 description 14
- 238000010586 diagram Methods 0.000 description 14
- 238000004891 communication Methods 0.000 description 5
- 239000011159 matrix material Substances 0.000 description 5
- 238000004422 calculation algorithm Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 238000012937 correction Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000006243 chemical reaction Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000001133 acceleration Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000012512 characterization method Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2200/00—Indexing scheme for image data processing or generation, in general
- G06T2200/04—Indexing scheme for image data processing or generation, in general involving 3D image data
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02P—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
- Y02P90/00—Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
- Y02P90/30—Computing systems specially adapted for manufacturing
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application provides a garment dynamic simulation method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a first position and a first speed of vertexes of each triangle in a plurality of triangles representing clothing to be simulated at the current moment; determining a second position of each vertex at the next moment based on the first position and the first speed of each vertex; according to the first position and the second position of each vertex and the time length from the current time to the next time, respectively determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is positioned; determining constraint conditions corresponding to the detection results according to the detection results; updating the second positions of the vertexes based on constraint conditions, the quality of the vertexes and the second positions of the vertexes, and respectively moving the vertexes to the updated positions corresponding to the vertexes so that the simulated display effect is close to the real dynamic display effect of the garment.
Description
Technical Field
The present disclosure relates to the field of computer graphics, and in particular, to a method and apparatus for dynamic garment simulation, an electronic device, and a storage medium.
Background
Dynamic simulation of electronic clothing is a popular technology in the field of virtual reality, and related technologies are applied to various fields such as online shopping, 3D games, three-dimensional animation, and the like. The dynamic simulation of the electronic clothing can intuitively show the dressing effect of the clothing for consumers, and can bring better game experience for game experimenters.
When the prior art utilizes a computer to dynamically simulate clothes, only the collision between the clothes and a human body model is generally considered, the self-collision condition of the same clothes is not considered, and then the simulated dynamic clothes display effect cannot be close to the real dynamic clothes display effect.
Disclosure of Invention
In view of this, an objective of the embodiments of the present application is to provide a method, an apparatus, an electronic device, and a storage medium for dynamically simulating clothing, so that a dynamic display effect of the simulated clothing is close to a real dynamic display effect of the clothing.
In a first aspect, an embodiment of the present application provides a method for dynamically simulating clothing, the method including: acquiring a first position and a first speed of vertexes of each triangle in a plurality of triangles representing clothing to be simulated at the current moment; determining a second position of each vertex at the next moment based on the first position and the first speed of each vertex; according to the first position and the second position of each vertex and the time length from the current moment to the next moment, respectively determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is positioned; determining constraint conditions corresponding to the detection results according to the detection results; updating the second positions of the vertexes based on the constraint conditions, the predetermined quality of the vertexes and the second positions of the vertexes to obtain updated positions; and respectively moving each vertex to the corresponding updated position.
In the implementation process, according to the first position and the second position of the vertex of each triangle in the triangles representing the garment to be simulated and the time length from the current moment to the next moment, determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is located, then determining the constraint condition corresponding to the detection result according to the detection result, fully considering the self-collision condition of the garment, aiming at each vertex on the garment to be simulated, the vertex collides with the rest vertices and does not collide, and correcting the positions of the vertex in different ways, so that after the corresponding constraint condition is determined, the second position of each vertex is accurately updated based on the constraint condition, the quality of each vertex and the second position of each vertex, the updated position is obtained, and finally the garment is dynamically simulated by moving each vertex to the updated position corresponding to each vertex.
Based on the first aspect, in one possible design, the determining, according to the first position, the second position, and the duration from the current time to the next time of each vertex, whether each vertex collides with a vertex of a triangle other than the triangle where the vertex is located includes: determining triangle pairs which are unlikely to collide and triangle pairs which are likely to collide according to the first position and the second position of each vertex; determining, for each of the possible triangle pairs, a first detection result indicating whether the vertex collides with a vertex of a triangle other than the triangle in which the vertex is located according to the first position, the second position, and the duration of each vertex in the pair; determining a second detection result which represents that collision does not occur between vertexes in the triangle pair aiming at each triangle in the triangle pair which is unlikely to collide; wherein, the detection result comprises: the first detection result and the second detection result.
In the implementation process, according to the first position and the second position of each vertex, a triangle pair which is unlikely to collide and a triangle pair which is likely to collide are determined, and it can be understood that, because the vertex in the triangle pair which is unlikely to collide cannot collide with other vertices on the garment, the vertex in the triangle pair which is unlikely to collide does not need to be subjected to collision detection operation, and only the vertex in the triangle pair which is likely to collide needs to be subjected to collision detection operation, so that the calculation complexity of collision detection is reduced.
Based on the first aspect, in one possible design, the determining, according to the first position, the first speed, and the duration from the current time to the next time of each vertex, whether each vertex collides with a vertex of a triangle other than the triangle where the vertex is located includes: and respectively determining whether each vertex collides with a triangle except the triangle where the vertex is positioned or not and a detection result of whether each vertex collides with the vertex except the triangle where the vertex is positioned or not according to the first position, the first speed and the duration of each vertex.
In the implementation process, as one part of the vertexes on the clothes may collide with the triangles on the clothes, and the other part of the vertexes on the clothes may collide with the vertexes on the clothes, the correction modes required for the two collisions are different (namely, the required constraint conditions are different), and therefore, the situation that the vertexes on the clothes collide with the triangles on the clothes is fully considered, and the simulated dynamic display effect of the clothes can be more close to the real dynamic display effect of the clothes.
Based on the first aspect, in one possible design, the determining whether each vertex collides with a triangle other than the triangle in which the vertex is located according to the first position, the second position and the duration of each vertex includes: for each vertex, determining the nearest characteristic point from the rest triangles except the triangle where the vertex is positioned; for each feature point, determining the direction vector and the length of a straight line formed by the feature point and the vertex; determining a second speed of each target vertex according to the first position, the second position and the duration of each target vertex on the target triangle where the feature point is located; determining a second speed of the vertex according to the first position, the second position and the duration of the vertex; determining the projection speeds of the vertex and each target vertex on the direction vector according to the second speed of each target vertex on the target triangle and the second speed of the vertex; determining the speed of the feature point in the direction of the direction vector according to the projection speed of each target vertex; and determining whether the vertex collides with the target triangle according to the projection speed of the vertex, the speed of the characteristic point, the length and the time length from the current moment to the next moment.
In the implementation process, when determining whether a certain vertex on the garment collides with a target triangle on the garment, the moving speed and direction of the target triangle are represented by using the moving speed and direction of a characteristic point on the target triangle, and the speed of the vertex is projected onto a direction vector of a straight line formed by the vertex and the characteristic point, so that the projection speed direction of the vertex is consistent with the speed direction of the characteristic point, and then, whether the vertex collides with the target triangle can be simply and quickly determined by using the projection speed of the vertex and the speed of the characteristic point.
Based on the first aspect, in one possible design, before the determining, according to the detection result, a constraint condition corresponding to the detection result, the method further includes: obtaining a position of an endpoint of each triangle of a plurality of triangles representing the mannequin; wherein the garment to be simulated is worn on the mannequin; and respectively determining whether each vertex collides with the triangle where each endpoint is located according to the position of each endpoint, the first position and the second position of each vertex.
In the implementation process, since the vertexes on the clothes possibly collide with the human body model, and the position correction mode corresponding to the collision of the clothes and the human body model is different from the self-collision of the clothes, namely, the constraint conditions are different, the situation that the vertexes on the clothes collide with the human body model is fully considered, and then the simulated dynamic display effect of the clothes is more close to the real dynamic display effect of the clothes.
Based on the first aspect, in one possible design, after the updated location, the method further comprises: for each vertex, determining a velocity of the vertex at the next time based on the updated position of the vertex and the first position of the vertex.
In the implementation process, when the state of continuous movement of the clothes needs to be simulated and the speeds of the vertexes on the clothes corresponding to different moments can be changed continuously, the speed of the vertexes at the next moment is determined, so that the simulation effect is closer to the real dynamic display effect of the clothes when the moving state of the clothes is simulated by using the speed at the next moment.
Based on the first aspect, in one possible design, the obtaining a first position at a current moment of vertices of each triangle of a plurality of triangles characterizing the garment to be simulated includes: acquiring initial positions of vertexes of triangles in each of a plurality of plates constituting the garment to be simulated; and performing simulated sewing on the edges to be sewn in each sheet according to a predetermined sewing constraint condition and the initial positions of each vertex to obtain a first position of each vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
In the implementation process, since a piece of sewn garment is generally dynamically simulated when the garment is dynamically simulated, after the initial positions of the vertices of the triangles of each of the plurality of panels of the garment to be simulated are obtained, the panels are simulated and sewn according to predetermined sewing constraint conditions, and then the first positions of the vertices of each triangle of the garment to be simulated at the current moment are obtained.
Based on the first aspect, in one possible design, the acquiring initial positions of respective vertices of triangles in respective panels of the plurality of panels constituting the garment to be simulated includes: acquiring coordinates of contour points representing contours of a plurality of cylinders in a first preset coordinate system; coordinates of contour points of the plurality of cylinders are used for representing the size, shape and position of each part of the human body model; wherein the garment to be simulated is worn on the mannequin; for each cylinder, determining the projection coordinates of each vertex of the triangle in the plate corresponding to the cylinder after the vertex is projected to the cylinder according to the coordinates of the contour point of the cylinder; and determining the initial position of the projection coordinates of the vertexes of the triangles in the corresponding plates in the second preset coordinate system based on the first preset coordinate system.
In the implementation process, the size, shape and position of each part of the human body model are represented by the coordinates of the contour points of a plurality of cylinders, then, for each cylinder, the projection coordinates of each vertex of the triangle in the plate corresponding to the cylinder after being projected onto the cylinder are determined according to the coordinates of the contour points of the cylinder, then, the position and shape of the projected plate are close to the position and shape of the plate on the simulated clothing, and based on the first preset coordinate system, the initial position of the projection coordinates of the vertex of the triangle in the corresponding plate in the second preset coordinate system is determined, so that the coordinates of each vertex in the plate in the second preset coordinate system are unified, and then, the dynamic simulation of the clothing is facilitated.
In a second aspect, embodiments of the present application provide a garment dynamics simulation apparatus, the apparatus comprising: the device comprises an acquisition unit, a control unit and a control unit, wherein the acquisition unit is used for acquiring a first position and a first speed of vertexes of each triangle in a plurality of triangles representing clothing to be simulated at the current moment; the prediction unit is used for determining a second position of each vertex at the next moment based on the first position and the first speed of each vertex; a collision detection unit, configured to determine, according to a first position and a second position of each vertex and a time period from the current time to the next time, a detection result that whether each vertex collides with a vertex of a triangle other than the triangle where the vertex is located; the constraint condition determining unit is used for determining constraint conditions corresponding to the detection results according to the detection results; a position updating unit, configured to update the second position of each vertex based on the constraint condition, the predetermined quality of each vertex, and the second position of each vertex, to obtain an updated position; and the dynamic simulation unit is used for respectively moving each vertex to the corresponding updated position.
Based on the second aspect, in one possible design, the collision detecting unit is specifically configured to determine a triangle pair that is unlikely to collide and a triangle pair that is likely to collide according to the first position and the second position of each vertex; and determining, for each of the pair of triangles that may collide, a first detection result indicating whether the vertex collides with a vertex of a triangle other than the triangle in which the vertex is located, according to the first position, the second position, and the duration of each vertex in the pair of triangles; determining a second detection result which represents that collision does not occur between vertexes in the triangle pair aiming at each triangle in the triangle pair which is unlikely to collide; wherein, the detection result comprises: the first detection result and the second detection result.
Based on the second aspect, in one possible design, the collision detecting unit is further configured to determine, based on the first position, the second position, and the time period of each vertex, whether each vertex collides with a triangle other than the triangle in which the vertex is located, and a detection result of whether each vertex collides with a vertex of a triangle other than the triangle in which the vertex is located, respectively.
Based on the second aspect, in one possible design, the collision detecting unit is further configured to, for each vertex, determine, from the triangles other than the triangle in which the vertex is located, the feature point nearest to the vertex, respectively; and determining, for each feature point, a direction vector and a length of a straight line formed by the feature point and the vertex; determining a second speed of each target vertex according to the first position, the second position and the duration of each target vertex on the target triangle where the feature point is located; determining a second speed of the vertex according to the first position, the second position and the duration of the vertex; determining the projection speeds of the vertex and each target vertex on the direction vector according to the second speed of each target vertex on the target triangle and the second speed of the vertex; determining the speed of the feature point in the direction of the direction vector according to the projection speed of each target vertex; and determining whether the vertex collides with the target triangle according to the projection speed of the vertex, the speed of the characteristic point, the length and the duration.
Based on the second aspect, in one possible design, the apparatus further comprises: a phantom collision detection unit for obtaining positions of endpoints of each triangle of the plurality of triangles characterizing the phantom; wherein the garment to be simulated is worn on the mannequin; and determining whether each vertex collides with the triangle where each endpoint is located according to the position of each endpoint, the first position and the second position of each vertex.
Based on the second aspect, in one possible design, the apparatus further comprises: and a speed updating unit, configured to determine, for each vertex, a speed of the vertex at the next time based on the updated position of the vertex and the first position of the vertex.
Based on the second aspect, in one possible design, the apparatus further comprises: the acquisition unit is specifically configured to acquire initial positions of vertices of triangles in each of a plurality of panels constituting the garment to be simulated; and performing simulated sewing on the edges to be sewn in each plate according to a predetermined sewing constraint condition and the initial positions of each vertex to obtain a first position of each vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
Based on the second aspect, in one possible design, the obtaining unit is further configured to obtain coordinates of contour points characterizing contours of the plurality of cylinders in a first preset coordinate system; coordinates of contour points of the plurality of cylinders are used for representing the size, shape and position of each part of the human body model; wherein the garment to be simulated is worn on the mannequin; and determining, for each cylinder, projection coordinates after each vertex of a triangle in a plate corresponding to the cylinder is projected to the cylinder according to coordinates of contour points of the cylinder; and determining the initial position of the projection coordinates of the vertexes of the triangles in the corresponding plates in the second preset coordinate system based on the first preset coordinate system.
In a third aspect, an embodiment of the present application provides an electronic device, including a processor and a memory connected to the processor, where the memory stores a computer program, and when the computer program is executed by the processor, causes the electronic device to perform the method of the first aspect.
In a fourth aspect, embodiments of the present application provide a storage medium having a computer program stored therein, which when run on a computer causes the computer to perform the method of the first aspect.
Additional features and advantages of the application will be set forth in the description which follows, and in part will be apparent from the description, or may be learned by practice of the embodiments of the application. The objectives and other advantages of the application will be realized and attained by the structure particularly pointed out in the written description and claims thereof as well as the appended drawings.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the embodiments will be briefly described below, it being understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered limiting the scope, and that other related drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for dynamic simulation of clothing according to an embodiment of the present application.
Fig. 2 is a schematic view of a panel of a garment to be simulated according to an embodiment of the present application.
Fig. 3 is a schematic diagram of a constructed first coordinate system provided in an embodiment of the present application.
Fig. 4 is a schematic view of stitching between edges to be stitched in a panel provided in an embodiment of the present application.
Fig. 5 is a schematic diagram of a vertex on a garment to be simulated not colliding with a mannequin according to an embodiment of the present application.
Fig. 6 is a schematic diagram of collision between a vertex on a garment to be simulated and a mannequin according to an embodiment of the present application.
Fig. 7 is a schematic diagram of a first position and a second position of a vertex on a garment to be simulated according to an embodiment of the present application, both being located inside a mannequin.
Fig. 8 is a schematic structural diagram of a device for dynamic garment simulation according to an embodiment of the present application.
Fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Icon: 500-a garment dynamic simulation device; 510-an acquisition unit; 520-a prediction unit; 530-a collision detection unit; 540-constraint condition determination unit; 550-a location updating unit; 560-a dynamic simulation unit; 600-an electronic device; 601-a processor; 602-a memory; 603-communication interface.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Referring to fig. 1, fig. 1 is a flowchart of a method for dynamically simulating clothing according to an embodiment of the present application, and the flowchart shown in fig. 1 will be described in detail, where the method includes the steps of: s11, S12, S13, S14, S15, and S16.
S11: a first position and a first speed of vertices at a current moment characterizing each triangle of a plurality of triangles of a garment to be simulated are obtained.
S12: based on the first position and the first speed of each vertex, a second position of each vertex at a next time is determined.
S13: and respectively determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is positioned according to the first position and the second position of each vertex and the time length from the current moment to the next moment.
S14: and determining constraint conditions corresponding to the detection results according to the detection results.
S15: and updating the second positions of the vertexes based on the constraint condition, the predetermined quality of the vertexes and the second positions of the vertexes to obtain updated positions.
S16: and respectively moving each vertex to the corresponding updated position.
The above method is described below.
S11: a first position and a first speed of vertices at a current moment characterizing each triangle of a plurality of triangles of a garment to be simulated are obtained.
As an embodiment, the step of obtaining a first position at the current moment of the vertex of each triangle of the plurality of triangles characterizing the garment to be simulated includes the steps of: a1 and A2.
A1: an initial position of each vertex of a triangle in each of a plurality of panels that make up the garment to be simulated is obtained.
Wherein the coordinates of the initial position are three-dimensional coordinates.
It will be appreciated that the size, shape and position of each panel is described by the size, shape and position of a plurality of triangles.
In an actual implementation, A1 may be implemented in such a manner that an initial position of each vertex of a triangle in each of a plurality of panels constituting the garment to be simulated in the coordinate system is acquired through a second coordinate system established in advance.
Wherein, a plurality of plates of the garment to be simulated are shown in fig. 2.
As an embodiment, in A1, the initial positions of the vertices of the triangles in the respective sheets may also be acquired from a third party.
As one embodiment, A1 includes the steps of: a11, a12 and a13.
A11: acquiring coordinates of contour points representing contours of a plurality of cylinders in a first preset coordinate system; coordinates of contour points of the plurality of cylinders are used for representing the size, shape and position of each part of the human body model; wherein the garment to be simulated is worn on the mannequin.
In an actual implementation process, a11 may be implemented in a manner that, for each part in the mannequin, the part is wrapped by using a cylinder, so that the position, the size and the shape of the cylinder in the first preset coordinate system are used to represent the size, the shape and the position of the part in the first preset coordinate system, and then, for each part of the mannequin, three-dimensional coordinates of a plurality of contour points of the contour of the cylinder corresponding to the part in the first preset coordinate system are obtained.
The first coordinate system corresponding to each cylinder of the plurality of cylinders is different, for each cylinder, the center of the bottom plane of the cylinder is taken as the origin, the bottom plane of the cylinder is taken as the XZ plane of the first coordinate system, the axis of the cylinder is taken as the Y axis of the first coordinate system, and the Y axis of the first coordinate system is perpendicular to the XZ plane, referring to fig. 3.
A12: for each cylinder, according to the coordinates of the contour points of the cylinder, the projection coordinates of the vertexes of the triangle in the plate corresponding to the cylinder after being projected to the cylinder are determined.
Wherein, a cylinder can only have a slab to wrap up, also can wrap up with two slabs, sets up according to actual demand.
For each cylinder, the coordinates of the vertices of each triangle in the plurality of triangles in the sheet in the first coordinate system corresponding to the cylinder are obtained by moving the sheet corresponding to the cylinder to a position tangential to the contour of the cylinder, at this time, the sheet is a plane figure, referring to fig. 3, the radius of the bottom plane of the cylinder is determined according to the coordinates of the contour point of the cylinder in the first coordinate system, and the coordinate projection formulaWherein x and y represent two-dimensional coordinates of any vertex of a triangle in the sheet, r is a radius of a bottom plane of the cylinder, and the coordinates of the vertices of each triangle in the plurality of triangles in the sheet are respectively input into a coordinate projection formula to determine projection of each vertex of the triangle in the sheet corresponding to the cylinder To the projection coordinates behind the cylinder.
A13: and determining the initial position of the projection coordinates of the vertexes of the triangles in the corresponding plates in the second preset coordinate system based on the first preset coordinate system.
Determining a movement expression required for moving the first coordinate system to coincide with the second coordinate system according to the relative position relation between the first coordinate system and the second coordinate system, wherein the movement expression is: u=p+ q.v ', wherein p and q are determined according to the relative positional relationship between the first coordinate system and the second coordinate system, v' represents the projection coordinate of a certain vertex of the triangle in the corresponding plate, and u is the initial position of the vertex in the second coordinate system; and inputting the coordinate value of the projection coordinate v 'of each vertex into the mobile expression to obtain the coordinate value of the initial position v' corresponding to each vertex.
The specific embodiments for determining p and q are well known in the art and will not be described herein.
A2: and performing simulated sewing on the edges to be sewn in each sheet according to a predetermined sewing constraint condition and the initial positions of each vertex to obtain a first position of each vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
For a predetermined stitching relationship between edges to be stitched in each sheet, the initial positions of each vertex on two edges to be stitched with a stitching relationship are determined, wherein referring to fig. 4, the number of vertices on two edges to be stitched with a stitching relationship (for example, an a edge and a B edge) is the same, for the vertex P2 on the a edge, a vertex P6 closest to the vertex P2 is determined on the B edge, a line segment formed by connecting the point P2 and the point P6 is determined according to the coordinates of the point P2 and the coordinates of the point P6, and the point P2 and the point P6 are respectively moved along the line segment so that the moved point P2 and the moved point P6 coincide, wherein the distance by which the point P2 and the point P6 move is the same is half of the length of the line, and the point P2 and the moved point P6 are regarded as one point in the garment to be simulated, and the mass of the point P2 and the point P6 is half of the mass sum; similarly, for P1 and P4, the moving manner of P2 and P6 is referred to move so that the moved point P1 and the moved point P4 coincide, and one of the values is that the plate including the edge to be stitched moves according to the moving manner of the point on the edge to be stitched, so as to finish the simulated stitching of the edge to be stitched in each plate, and finally obtain the first position of the vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
As an embodiment, in S11, the first position and the first speed characterizing the vertex of each triangle in the garment to be simulated at the current moment may also be obtained directly from a third party.
S12: based on the first position and the first speed of each vertex, a second position of each vertex at a next time is determined.
And inputting the first position, the first speed and the duration from the current moment to the next moment of each vertex into an expression of a preset algorithm to obtain the second position of each vertex at the next moment. The expression of the preset algorithm is as follows:wherein (1)>Is the second position, x n A position matrix formed by the values of the first position of each vertex on the garment at the nth moment (namely the current moment), v n For a velocity matrix formed by the values of the first velocity of each vertex on the garment at the nth moment, deltat is the duration from the nth moment to the next moment (i.e. the (n+1) th moment), M -1 The inverse of the mass matrix M, g, which is composed of the values of the mass of the individual vertices on the garment to be simulated, is the gravitational acceleration.
S13: and respectively determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is positioned according to the first position and the second position of each vertex and the time length from the current moment to the next moment.
As one embodiment, S13 includes the steps of: b1, B2 and B3.
B1: and determining triangle pairs which are unlikely to collide and triangle pairs which are likely to collide according to the first position and the second position of each vertex.
And determining triangle pairs which are unlikely to collide and triangle pairs which are likely to collide from the triangles of the clothing to be simulated according to the first position, the second position and the KDTee algorithm of each vertex.
The specific embodiment of determining triangle pairs that are unlikely to collide and triangle pairs that are likely to collide by using the KDTree algorithm is well known in the art, and therefore will not be described herein.
B2: and for each triangle in the triangle pairs which are likely to collide, determining a first detection result representing whether the vertex collides with the vertex of the triangle except the triangle in which the vertex is positioned according to the first position, the second position and the duration of each vertex in the triangle pairs.
For each triangle in the triangle pairs which can collide, respectively carrying out collision detection on each vertex in the triangle pairs and each vertex in the triangle except for the triangle in which the vertex is positioned, wherein the mode of detecting whether any two vertexes collide is the same, and carrying out collision detection on a first vertex a and a second vertex b, wherein the first position of the first vertex a is x1; a second position x2 of the first vertex a; thus, by inputting the first position of the first vertex, the second position of the first vertex and the value of the duration Δt into the expression Obtaining a second velocity v1 of the first vertex; assuming that the first position of the second vertex b is x3, and the second position of the second vertex b is x4; thus, by inputting the first position of the second vertex, the second position of the second vertex and the value of the duration Δt into the expressionObtaining a second velocity v2 of the second vertex; wherein the direction of the second velocity of the first vertex and the direction of the second velocity of the second vertex intersect; by assuming the collision time is t, wherein 0.ltoreq.t.ltoreq.Δt, constructing an equation x1+v1×t=x3+v2×t according to the first position of the first vertex a and the second speed of the first vertex, and the first position of the second vertex and the second speed of the second vertex, and by solving the equation, characterizing that the first vertex a and the second vertex b collide when the equation has a solution; the first vertex a and the second vertex b are characterized as not colliding when the equation is solved.
To further improve collision detection accuracy, therefore, it is necessary to consider the radius of the vertex, and as an embodiment, by assuming the moment of collision to be t, where 0.ltoreq.t.ltoreq.Δt, constructing the equation x1+v1×t=x3+v2×t, t '=r1/length (v 1) +r2/length (v 2), t.ltoreq.t+t'. Ltoreq.Δt, length (v 1) representing the value of velocity v1 from the first position, second velocity, and first radius of the first vertex a, and the first position, second velocity, and second radius of the second vertex; by solving the equation, when the equation is solved, the first vertex a and the second vertex b are characterized as collision; the first vertex a and the second vertex b are characterized as not colliding when the equation is solved.
B3: determining a second detection result which represents that collision does not occur between vertexes in the triangle pair aiming at each triangle in the triangle pair which is unlikely to collide; wherein, the detection result comprises: the first detection result and the second detection result.
As an implementation manner, S13 may be implemented in the following manner, for each vertex in the garment to be simulated, it is determined whether the vertex collides with the vertices of the triangle other than the vertex, where the manner of detecting whether the two vertices collide may be in accordance with step B2, and therefore, details are not repeated herein.
As one embodiment, S13 includes the steps of: C.
c: and respectively determining whether each vertex collides with a triangle except the triangle where the vertex is positioned or not and a detection result of whether each vertex collides with the vertex except the triangle where the vertex is positioned or not according to the first position, the second position and the time length of each vertex.
As one embodiment, step C includes the steps of: c1, C2, C3, C4, C5, C6 and C7.
C1: for each vertex, the nearest feature point to the vertex is determined from the rest of triangles except the triangle where the vertex is located.
For each vertex, determining the rest triangles except the triangle where the vertex is located, and for each triangle in the rest triangles, determining the nearest characteristic point from the triangle according to the first position of the vertex and the first position of each vertex of the triangle.
The step of determining coordinates of the feature point c includes: the coordinates of each vertex on the triangle where the feature point c is located are input into a predetermined expression, wherein the coordinates of three vertices on the triangle where the feature point c is located are (x 11, x12 and x 13) respectively, and the coordinates of the feature point c are obtained; wherein the predetermined expression is: c=x11×w1+x12×w2+x13×w3, where w1, w2, and w3 are weights, and specific embodiments for determining the values of w1, w2, and w3 are well known in the art, and therefore will not be described herein.
As one embodiment, a triangle pair which is unlikely to collide and a triangle pair which is likely to collide are determined according to the first position and the second position of each vertex; and then, for each triangle in the triangle pairs which are likely to collide, for each vertex in the triangle pairs, determining a target triangle except for the triangle in which the vertex is positioned from the triangle pairs, and determining the characteristic point nearest to the vertex from the target triangle.
C2: for each feature point, a direction vector and a length of a straight line formed by the feature point and the vertex are determined.
For each feature point, determining the direction vector and the length of a straight line formed by the feature point and the vertex according to the first position of the feature point and the first position of the vertex.
And C3: and determining the second speed of each target vertex according to the first position, the second position and the duration of each target vertex on the target triangle where the feature point is located.
For each target vertex, inputting the values of the first position x11, the second position x22 and the duration deltat of the target vertex into an expressionObtaining a second velocity v of the target vertex; wherein the second speed is a vector.
And C4: and determining the second speed of the vertex according to the first position, the second position and the duration of the vertex.
The specific embodiment of C4 is the same as C3, and thus, will not be described herein.
C5: and determining the projection speeds of the vertex and each target vertex on the direction vector according to the second speed of the target vertex and the second speed of the vertex.
And inputting the second speed of each target vertex on the target triangle and the second speed of the vertex into a coordinate projection equation set to obtain the projection speeds of the vertex and each target vertex on the direction vector.
Wherein, the coordinate projection equation set is:wherein n is the direction vector; dot (v, n) characterizes the dot product between the direction vector n and the second velocity v of the vertex, and n·dot (v, n) characterizes the dot product of the direction vector n and dot (v, n). v11, v12 and v13 are the second velocities of the respective target vertices on the target triangle, respectively; v' is the projection speed of the vertex; v1', v2' and v3' are the projection speeds of the respective target vertices on the target triangle, respectively; the projection speed is a vector.
C6: and determining the speed of the characteristic point in the direction of the direction vector according to the projection speed of each target vertex.
The speed v of the characteristic point in the direction of the direction vector is obtained by inputting the projection speed of each target vertex of the target triangle into a predetermined speed conversion expression c 。
Wherein the predetermined speed conversion expression is: v c =v1'×w1+v2'×w2+v3'×w3。
C7: and determining whether the vertex collides with the target triangle according to the projection speed of the vertex, the speed of the characteristic point, the length and the duration.
Determining a first distance of the movement of the vertex according to the projection speed of the vertex and the duration; determining a second distance for the feature point to move according to the projection speed of the feature point and the time length; determining whether the sum of the first distance and the first distance is greater than the length, and characterizing that the vertex and the target triangle are not collided when the sum of the first distance and the first distance is determined to be less than the length, otherwise, determining that the vertex and the target triangle are collided.
To further accurately determine whether the vertex and the target triangle collide, therefore, as one embodiment, when it is determined that the sum of the first distance, the second distance, the radius of the vertex, and the thickness of the target triangle is less than the length, it is characterized that the vertex and the target triangle do not collide, otherwise it is determined that the vertex and the target triangle collide.
As an embodiment, before S14, the method further comprises the steps of: d1 and D2.
D1: obtaining a position of an endpoint of each triangle of a plurality of triangles representing the mannequin; wherein the garment to be simulated is worn on the mannequin.
The locations of the endpoints of each of the plurality of triangles characterizing the manikin may be obtained from a third party. The positions of all the endpoints on the human body model and the positions of all the vertexes on the garment to be simulated are determined according to the same coordinate system.
D2: and respectively determining whether each vertex collides with the triangle where each endpoint is located according to the position of each endpoint, the first position and the second position of each vertex.
Referring to fig. 5, for each vertex, according to the first position (e.g., P3 and P5 in fig. 5) of the vertex and the positions of the endpoints, a triangle to be detected closest to the first position of the vertex is determined from triangles where the endpoints are located, and according to the positions of the three endpoints of the triangle to be detected and the second position (e.g., P4 and P6 in fig. 5) of the vertex, it is determined that the vertex is not collided with the human body model when the second position of the vertex is located outside the human body model.
Referring to fig. 6, for each vertex, determining a triangle to be detected closest to the first position of the vertex from triangles where the respective endpoints are located according to the first position of the vertex (e.g., P3 in fig. 6) and the positions of the respective endpoints, and determining that the vertex collides with the human model when determining that the second position of the vertex is located in the human model according to the positions of the three endpoints of the triangle to be detected and the second position of the vertex (e.g., P4 in fig. 6).
Referring to fig. 7, for each vertex, determining a triangle to be detected closest to the first position of the vertex from triangles where the respective endpoints are located according to the first position of the vertex (e.g., p3 in fig. 7) and the positions of the respective endpoints, and determining that the first position of the vertex is located in the mannequin according to the positions of the three endpoints of the triangle to be detected and the first position of the vertex; and determining that the vertex is located in the mannequin according to the positions of the three endpoints of the triangle to be detected and the second position of the vertex (for example, P4 in fig. 7), and considering that the vertex does not collide with the mannequin.
S14: and determining constraint conditions corresponding to the detection results according to the detection results.
For each vertex, when the detection result corresponding to the vertex indicates that the vertex collides with a triangle in the human body model, the corresponding constraint condition is C= (p-cc) nn is more than or equal to 0. Wherein p characterizes the initial position of the vertex in each iteration in step S15; cc is the point in the phantom closest to the second location of the vertex, which does not change with increasing iteration number; nn is the normal to the triangle that collides with this vertex.
For each vertex, when the detection result corresponding to the vertex indicates that the vertex collides with the rest of the vertexes on the garment to be simulated, the corresponding constraint condition is thatWherein p1 and p2 are initial positions where two vertices where collision exists perform each iteration in step S15;A direction vector of a straight line connecting the second positions of the two vertexes; r is (r) p1 And r p2 The radii of the two vertices p1 and p2, respectively, where there is a collision.
Similarly, for each vertex, when the detection result corresponding to the vertex indicates that the vertex collides with the target triangle on the garment to be simulated, the corresponding constraint condition is that Wherein p11, p12, and p13 are initial positions of each vertex of the target triangle in each iteration in step S15, and may also be represented by a position of a feature point pp, where pp=p11×w11+p12×w12+p13×w13, where w11, w12, and w13 are weights, and specific embodiments for determining the values of w11, w12, and w13 are well known in the art, and therefore will not be described herein; p0 is the initial position of the vertex in each iteration in step S15;Normal vectors for target triangles, i.e.The direction of the normal vector of the target triangle is determined according to the position relation between the vertex and the target triangle; r is (r) p0 Is the radius of the vertex; r is (r) triangle Is the radius of the target triangle.
Similarly, for any two vertices, the corresponding stitching constraints further include: c (p 1, p 2) = |p2-p1| -d=0; wherein, p2, p1 are the initial positions of the two vertexes in each iteration in step S15; d characterizes the distance between the first positions of the two vertices.
S15: and updating the second positions of the vertexes based on the constraint condition, the predetermined quality of the vertexes and the second positions of the vertexes to obtain updated positions.
And for each vertex, after determining the constraint condition corresponding to the vertex, continuously updating the second position of each vertex in the following way.
Initializing:wherein, for each vertex on the garment to be simulated, the vertex is +_ when it does not collide with the mannequin>Second position of each vertex, however, one mention of the values is +.>A position of a point on the manikin closest to the second position of the vertex; in case the vertex would collide with the phantom, < +.>A position of an intersection point between a connection line between the first position and the second position of the vertex and the human body model; p is p 11 Initial positions of the first small iteration of the first large iteration of each vertex are set;
initializing: lambda (lambda) 1 =0;
i=1;
while i < n do; i represents the ith iteration; n is preset iteration times and is set according to user requirements;
j=1;
calculating Deltalambda ij Calculation using a formulaWherein C is j (p ij ) Represents a j-th constraint; for each vertex on the garment to be simulated, when the vertex collides with the human body model, the constraint condition corresponding to the vertex is the constraint condition corresponding to the collision of the vertex with the human body model when j=1, namely, the constraint condition corresponding to the collision of the vertex with the human body model is considered first in the iteration process; secondly, whether the vertex collides with the human body model or the garment to be simulated or not, the sewing constraint condition corresponding to the vertex is considered finally in the iteration process; m is a matrix formed by the mass of each vertex; p is p ij The table is the initial position of each vertex in the j-th small iteration in the i-th large iteration;Δt is the duration; alpha characterizes the compliance, alpha=s -1 S is a diagonal matrix, and the values of diagonal elements in S are Young' S modulus corresponding to each vertex on the predetermined garment to be simulated; s is S -1 Characterizing and inverting S;characterization->Is a transpose of (2);Characterization of pair C j (p ij ) And solving a Hamiltonian operator.
λ i(j+1) =λ ij +Δλ ij ;
p i(j+1) =p ij +Δp ij ;
Updating the value of j, i.e., j=j+1;
after the second position of each vertex is continuously updated by using the constraint condition corresponding to each vertex, executing the steps: p is p (i+1)1 =p ij ;
Updating the value of i, i.e. i=i+1;
end while
and taking the position of each vertex obtained after the jth small iteration in the n-1 th large iteration as the updated position of each vertex. S16: and respectively moving each vertex to the corresponding updated position.
As an embodiment, the method further comprises: for each vertex, determining a velocity of the vertex at the next time based on the updated position of the vertex and the first position of the vertex.
By updating the position x of the vertex n+1 First position x of the vertex n And the duration deltat are respectively input into a predetermined speed expression to obtain the speed v of the vertex at the next moment n+1 。
referring to fig. 8, fig. 8 is a block diagram illustrating a clothing dynamic simulation apparatus 500 according to an embodiment of the disclosure. The block diagram of fig. 8 will be described, and the apparatus includes:
an obtaining unit 510 is configured to obtain a first position and a first speed of a vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
The prediction unit 520 is configured to determine, based on the first position and the first speed of each vertex, a second position of each vertex at a next time.
And a collision detection unit 530, configured to determine, according to the first position and the second position of each vertex and the time period from the current time to the next time, whether each vertex collides with a vertex of a triangle other than the triangle where the vertex is located.
And a constraint condition determining unit 540, configured to determine, according to the detection result, a constraint condition corresponding to the detection result.
And a location updating unit 550, configured to update the second location of each vertex based on the constraint condition, the predetermined quality of each vertex, and the second location of each vertex, to obtain an updated location.
And the dynamic simulation unit 560 is configured to move each vertex to a corresponding updated position.
As an embodiment, the collision detecting unit 530 is specifically configured to determine, according to the first position and the second position of each vertex, a triangle pair that is unlikely to collide, and a triangle pair that is likely to collide; and determining, for each of the pair of triangles that may collide, a first detection result indicating whether the vertex collides with a vertex of a triangle other than the triangle in which the vertex is located, according to the first position, the second position, and the duration of each vertex in the pair of triangles; determining a second detection result which represents that collision does not occur between vertexes in the triangle pair aiming at each triangle in the triangle pair which is unlikely to collide; wherein, the detection result comprises: the first detection result and the second detection result.
As an embodiment, the apparatus further comprises: a phantom collision detection unit for obtaining positions of endpoints of each triangle of the plurality of triangles characterizing the phantom; wherein the garment to be simulated is worn on the mannequin; and determining whether each vertex collides with the triangle where each endpoint is located according to the position of each endpoint, the first position and the second position of each vertex.
As an embodiment, the collision detecting unit 530 is further configured to, for each vertex, determine, from the triangles other than the triangle in which the vertex is located, a feature point nearest to the vertex; and determining, for each feature point, a direction vector and a length of a straight line formed by the feature point and the vertex; determining a second speed of each target vertex according to the first position, the second position and the duration of each target vertex on the target triangle where the feature point is located; determining a second speed of the vertex according to the first position, the second position and the duration of the vertex; determining the projection speeds of the vertex and each target vertex on the direction vector according to the second speed of each target vertex on the target triangle and the second speed of the vertex; determining the speed of the feature point in the direction of the direction vector according to the projection speed of each target vertex; and determining whether the vertex collides with the target triangle according to the projection speed of the vertex, the speed of the characteristic point, the length and the duration.
As an embodiment, the apparatus further comprises: a human body model acquisition unit configured to acquire positions of endpoints of respective triangles among a plurality of triangles representing a human body model; wherein the garment to be simulated is worn on the mannequin; correspondingly, the collision detection unit is further configured to determine, according to the position of each endpoint, the first position, the second position, and the duration of each vertex, whether each vertex collides with the triangle where each endpoint is located, and the detection result of the collision between the vertices of the triangle other than the triangle where the vertex is located.
As an embodiment, the apparatus further comprises: and a speed updating unit, configured to determine, for each vertex, a speed of the vertex at the next time based on the updated position of the vertex and the first position of the vertex.
As an embodiment, the apparatus further comprises: the acquiring unit 510 is specifically configured to acquire initial positions of vertices of triangles in each of a plurality of panels that constitute the garment to be simulated; and performing simulated sewing on the edges to be sewn in each plate according to a predetermined sewing constraint condition and the initial positions of each vertex to obtain a first position of each vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
As an embodiment, the obtaining unit 510 is further configured to obtain coordinates of contour points characterizing contours of the plurality of cylinders in a first preset coordinate system; coordinates of contour points of the plurality of cylinders are used for representing the size, shape and position of each part of the human body model; wherein the garment to be simulated is worn on the mannequin; and determining, for each cylinder, projection coordinates after each vertex of a triangle in a plate corresponding to the cylinder is projected to the cylinder according to coordinates of contour points of the cylinder; and determining the initial position of the projection coordinates of the vertexes of the triangles in the corresponding plates in the second preset coordinate system based on the first preset coordinate system.
For the process of implementing the respective functions by the functional units in this embodiment, please refer to the contents described in the embodiments shown in fig. 1-7, which are not described herein.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an electronic device 600 according to an embodiment of the present application, where the electronic device 600 may be a site server in the above embodiment, and the electronic device 600 may be a personal computer (personal computer, PC), a tablet computer, a smart phone, a personal digital assistant (personal digital assistant, PDA), or the like.
The electronic device 600 may include: memory 602, process 601, communication interface 603, and a communication bus for enabling the connected communication of these components.
The Memory 602 is used for storing various data such as computer program instructions corresponding to the garment dynamic simulation method and apparatus provided in the embodiments of the present application, where the Memory 602 may be, but is not limited to, a random access Memory (Random Access Memory, RAM), a Read Only Memory (ROM), a programmable Read Only Memory (Programmable Read-Only Memory, PROM), an erasable Read Only Memory (Erasable Programmable Read-Only Memory, EPROM), an electrically erasable Read Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), and the like.
The processor 601 is configured to read and execute computer program instructions corresponding to a garment dynamic simulation method and apparatus stored in the memory, so as to obtain a first position and a first speed of vertices of each triangle in a plurality of triangles representing a garment to be simulated at a current moment; determining a second position of each vertex at the next moment based on the first position and the first speed of each vertex; according to the first position and the second position of each vertex and the time length from the current time to the next time, respectively determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is positioned; determining constraint conditions corresponding to the detection results according to the detection results; updating the second positions of the vertexes based on the constraint condition, the predetermined quality of the vertexes and the second positions of the vertexes, and moving the vertexes to the updated positions respectively.
The processor 601 may be an integrated circuit chip with signal processing capabilities. The processor 601 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
A communication interface 603 for receiving or transmitting data.
Furthermore, the embodiment of the present application provides a storage medium, in which a computer program is stored, which when executed on a computer, causes the computer to perform the method provided in any one of the embodiments of the present application.
In summary, according to the method, the device, the electronic equipment and the storage medium for dynamically simulating clothing provided in the embodiments of the present application, according to the first position and the second position of the vertex of each triangle in the plurality of triangles representing the clothing to be simulated and the time period from the current time to the next time, it is determined whether each vertex collides with the vertex of the triangle other than the triangle where the vertex is located, then according to the detection result, a constraint condition corresponding to the detection result is determined, the self-collision condition of the clothing is fully considered, and for each vertex on the clothing to be simulated, the vertex collides with the rest vertices and the correction mode of the position of the vertex is different, therefore, after the corresponding constraint condition is determined, the second position of each vertex is accurately updated based on the constraint condition, the quality of each vertex determined in advance and the second position of each vertex, and finally, the clothing is dynamically simulated by moving each vertex to the corresponding updated position respectively, and then the self-collision condition of the clothing is fully considered.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based devices which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
Claims (10)
1. A method of dynamic garment simulation, the method comprising:
acquiring a first position and a first speed of vertexes of each triangle in a plurality of triangles representing clothing to be simulated at the current moment;
determining a second position of each vertex at the next moment based on the first position and the first speed of each vertex;
according to the first position and the second position of each vertex and the time length from the current moment to the next moment, respectively determining whether each vertex collides with the vertex of the triangle except the triangle where the vertex is positioned;
determining constraint conditions corresponding to the detection results according to the detection results;
updating the second positions of the vertexes based on the constraint conditions, the predetermined quality of the vertexes and the second positions of the vertexes to obtain updated positions;
moving each vertex to a corresponding updated position;
The step of obtaining a first position of vertexes of each triangle in the plurality of triangles representing the garment to be simulated at the current moment comprises the following steps:
acquiring initial positions of vertexes of triangles in each of a plurality of plates constituting the garment to be simulated;
and performing simulated sewing on the edges to be sewn in each sheet according to a predetermined sewing constraint condition and the initial positions of each vertex to obtain a first position of each vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
2. The method according to claim 1, wherein the determining whether each vertex collides with a vertex of a triangle other than the triangle in which the vertex is located according to the first position, the second position, and the time period from the current time to the next time of each vertex includes:
determining triangle pairs which are unlikely to collide and triangle pairs which are likely to collide according to the first position and the second position of each vertex;
determining, for each of the possible triangle pairs, a first detection result indicating whether the vertex collides with a vertex of a triangle other than the triangle in which the vertex is located according to the first position, the second position, and the duration of each vertex in the pair;
Determining a second detection result which represents that collision does not occur between vertexes in the triangle pair aiming at each triangle in the triangle pair which is unlikely to collide; wherein, the detection result comprises: the first detection result and the second detection result.
3. The method according to claim 1, wherein the determining whether each vertex collides with a vertex of a triangle other than the triangle in which the vertex is located according to the first position, the second position, and the time period from the current time to the next time of each vertex includes:
and respectively determining whether each vertex collides with a triangle except the triangle where the vertex is positioned or not and a detection result of whether each vertex collides with the vertex except the triangle where the vertex is positioned or not according to the first position, the second position and the time length of each vertex.
4. A method according to claim 3, wherein determining whether each vertex will collide with a triangle other than the triangle in which the vertex is located based on the first position, the second position, and the time period of each vertex, respectively, comprises:
For each vertex, determining the nearest characteristic point from the rest triangles except the triangle where the vertex is positioned;
for each feature point, determining the direction vector and the length of a straight line formed by the feature point and the vertex;
determining a second speed of each target vertex according to the first position, the second position and the duration of each target vertex on the target triangle where the feature point is located;
determining a second speed of the vertex according to the first position, the second position and the duration of the vertex;
determining the projection speeds of the vertex and each target vertex on the direction vector according to the second speed of each target vertex on the target triangle and the second speed of the vertex;
determining the speed of the feature point in the direction of the direction vector according to the projection speed of each target vertex;
and determining whether the vertex collides with the target triangle according to the projection speed of the vertex, the speed of the characteristic point, the length and the duration.
5. The method of claim 1, wherein prior to said determining a constraint corresponding to said test result based on said test result, said method further comprises:
Obtaining a position of an endpoint of each triangle of a plurality of triangles representing the mannequin; wherein the garment to be simulated is worn on the mannequin;
and respectively determining whether each vertex collides with the triangle where each endpoint is located according to the position of each endpoint, the first position and the second position of each vertex.
6. The method of claim 1, wherein after the updated location, the method further comprises:
for each vertex, determining a velocity of the vertex at the next time based on the updated position of the vertex and the first position of the vertex.
7. The method of claim 1, wherein the obtaining initial positions of respective vertices of triangles in respective panels of a plurality of panels comprising the garment to be simulated comprises:
acquiring coordinates of contour points representing contours of a plurality of cylinders in a first preset coordinate system; coordinates of contour points of the plurality of cylinders are used for representing the size, shape and position of each part of the human body model; wherein the garment to be simulated is worn on the mannequin;
For each cylinder, determining the projection coordinates of each vertex of the triangle in the plate corresponding to the cylinder after the vertex is projected to the cylinder according to the coordinates of the contour point of the cylinder;
and determining the initial position of the projection coordinates of the vertexes of the triangles in the corresponding plates in a second preset coordinate system based on the first preset coordinate system.
8. A garment dynamics simulation apparatus, the apparatus comprising:
the device comprises an acquisition unit, a control unit and a control unit, wherein the acquisition unit is used for acquiring a first position and a first speed of vertexes of each triangle in a plurality of triangles representing clothing to be simulated at the current moment;
the prediction unit is used for determining a second position of each vertex at the next moment based on the first position and the first speed of each vertex;
a collision detection unit, configured to determine, according to a first position and a second position of each vertex and a time period from the current time to the next time, a detection result that whether each vertex collides with a vertex of a triangle other than the triangle where the vertex is located;
the constraint condition determining unit is used for determining constraint conditions corresponding to the detection results according to the detection results;
A position updating unit, configured to update the second position of each vertex based on the constraint condition, the predetermined quality of each vertex, and the second position of each vertex, to obtain an updated position;
and the dynamic simulation unit is used for respectively moving each vertex to the corresponding updated position. The method comprises the steps of carrying out a first treatment on the surface of the
The acquisition unit is specifically configured to acquire initial positions of vertices of triangles in each of a plurality of panels forming the garment to be simulated; and performing simulated sewing on the edges to be sewn in each plate according to a predetermined sewing constraint condition and the initial positions of each vertex to obtain a first position of each vertex of each triangle in the plurality of triangles representing the garment to be simulated at the current moment.
9. An electronic device comprising a memory and a processor, the memory having stored therein computer program instructions that, when read and executed by the processor, perform the method of any of claims 1-7.
10. A storage medium having stored thereon computer program instructions which, when read and executed by a computer, perform the method of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011461934.7A CN112581602B (en) | 2020-12-09 | 2020-12-09 | Clothing dynamic simulation method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011461934.7A CN112581602B (en) | 2020-12-09 | 2020-12-09 | Clothing dynamic simulation method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112581602A CN112581602A (en) | 2021-03-30 |
CN112581602B true CN112581602B (en) | 2023-07-07 |
Family
ID=75132283
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011461934.7A Active CN112581602B (en) | 2020-12-09 | 2020-12-09 | Clothing dynamic simulation method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112581602B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103324784A (en) * | 2013-05-30 | 2013-09-25 | 杭州电子科技大学 | Grid model collision handling method based on local restriction |
CN106354959A (en) * | 2016-08-31 | 2017-01-25 | 北京维盛视通科技有限公司 | Three-dimensional garment and human model collision detection method and device |
CN106407605A (en) * | 2016-11-01 | 2017-02-15 | 南京大学 | Particle computer dynamic simulation method for 3D garment |
CN111651894A (en) * | 2020-06-16 | 2020-09-11 | 北京中科深智科技有限公司 | Cloth deformation real-time simulation method |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7616204B2 (en) * | 2005-10-19 | 2009-11-10 | Nvidia Corporation | Method of simulating dynamic objects using position based dynamics |
GB201806015D0 (en) * | 2018-04-11 | 2018-05-23 | Electronic Arts Inc | Cloth self collision with predictive contacts |
-
2020
- 2020-12-09 CN CN202011461934.7A patent/CN112581602B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103324784A (en) * | 2013-05-30 | 2013-09-25 | 杭州电子科技大学 | Grid model collision handling method based on local restriction |
CN106354959A (en) * | 2016-08-31 | 2017-01-25 | 北京维盛视通科技有限公司 | Three-dimensional garment and human model collision detection method and device |
CN106407605A (en) * | 2016-11-01 | 2017-02-15 | 南京大学 | Particle computer dynamic simulation method for 3D garment |
CN111651894A (en) * | 2020-06-16 | 2020-09-11 | 北京中科深智科技有限公司 | Cloth deformation real-time simulation method |
Non-Patent Citations (3)
Title |
---|
织物物理模拟与三维服装实时仿真技术;柳杨;孙守迁;徐爱国;;纺织学报(第07期);81-87 * |
结合一种面-面碰撞检测算法的服装动态模拟;顾尔丹,许端清,王靖滨,陈纯;计算机辅助设计与图形学学报(第11期);37-41 * |
通用三维服装模型的强约束动态仿真方法;刘正东;;计算机工程与科学(第02期);161-167 * |
Also Published As
Publication number | Publication date |
---|---|
CN112581602A (en) | 2021-03-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20170186219A1 (en) | Method for 360-degree panoramic display, display module and mobile terminal | |
US10909744B1 (en) | Simulating garment with wrinkles based on physics based cloth simulator and machine learning model | |
KR20210092231A (en) | Watertight ray triangle intersection that does not restore with double precision | |
US20100061622A1 (en) | Method for aligning objects | |
CN110471409A (en) | Robot method for inspecting, device, computer readable storage medium and robot | |
KR20140104597A (en) | Mobile devices of transmitting and receiving data using gesture | |
US11922577B2 (en) | Method and apparatus for online fitting | |
CN110276774A (en) | Drawing practice, device, terminal and the computer readable storage medium of object | |
CN111460937A (en) | Face feature point positioning method and device, terminal equipment and storage medium | |
CN111882380A (en) | Virtual fitting method, device, system and electronic equipment | |
CN106840389A (en) | Light source estimating and measuring method and device, intelligent electronic device based on multiple balls | |
CN115131478A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN114742956A (en) | Model processing method, device, equipment and computer readable storage medium | |
CN112581602B (en) | Clothing dynamic simulation method and device, electronic equipment and storage medium | |
CN109579842A (en) | Two-dimensional plane positioning method and device, projection control method and device, and mobile phone | |
CN115496860A (en) | Flexible rule model construction method and device, terminal equipment and storage medium | |
JP2008059375A (en) | Information processing method, and information processor | |
CN114663615A (en) | Electronic map display method and device and electronic equipment | |
CN112669425A (en) | Hair rendering method, hair rendering device, electronic equipment and readable storage medium | |
CN113469900A (en) | Track denoising method and related device and equipment | |
CN111080694A (en) | Training and positioning method, device, equipment and storage medium of positioning model | |
CN116543093B (en) | Flexible object rendering method, device, computer equipment and storage medium | |
US20160196682A1 (en) | Graphical simulation of objects in a virtual environment | |
CN113409385B (en) | Characteristic image identification and positioning method and system | |
US20230206541A1 (en) | Common circuitry for triangle intersection and instance transformation for ray tracing |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |