CN110765565A - Cloth simulation collision method and device - Google Patents

Cloth simulation collision method and device Download PDF

Info

Publication number
CN110765565A
CN110765565A CN201810826872.1A CN201810826872A CN110765565A CN 110765565 A CN110765565 A CN 110765565A CN 201810826872 A CN201810826872 A CN 201810826872A CN 110765565 A CN110765565 A CN 110765565A
Authority
CN
China
Prior art keywords
vertex
constraint
information
triangular patch
triangular
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.)
Pending
Application number
CN201810826872.1A
Other languages
Chinese (zh)
Inventor
黄文超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhen Mei Intelligent Technology (shenzhen) Co Ltd
Original Assignee
Zhen Mei Intelligent Technology (shenzhen) Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhen Mei Intelligent Technology (shenzhen) Co Ltd filed Critical Zhen Mei Intelligent Technology (shenzhen) Co Ltd
Priority to CN201810826872.1A priority Critical patent/CN110765565A/en
Publication of CN110765565A publication Critical patent/CN110765565A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention is suitable for the field of computer graphics and computer aided design, and provides a method and a device for simulating collision of cloth, wherein the method comprises the following steps: obtaining each vertex on the triangular mesh and a triangular patch having a potential collision relation with each vertex according to a self-collision result; when the distance between the vertex and the triangular patch is smaller than a threshold value and the projection of the vertex falls in the triangular patch, adding the three vertexes of the triangular patch into the adjacent vertex indexes of the vertex; determining the length of a constraint side according to the distances between the vertexes and the three vertexes of the triangular patch, and adding the length of the constraint side into a list of the length of the constraint side of the vertex; and calculating constraint information in the cloth simulation according to the neighbor vertex information and the constraint side length information of each vertex, and processing the cloth simulation of the next frame according to the constraint information. The invention overcomes the problem of mutual penetration of multi-layer cloth in the simulation process by establishing a constraint relation.

Description

Cloth simulation collision method and device
Technical Field
The invention relates to the field of computer graphics and computer aided design, in particular to a method and a device for simulating collision of cloth.
Background
A method for simulating the natural and real human movement process by computer graphics and virtual reality technique is called human movement simulation, which includes building the calculation model of human body and its accessories, simulating the natural and real physical movement process of virtual human under the given constraint condition, and realistically presenting the movement process in the form of three-dimensional graph in the virtual environment generated by computer. More than 80% of the area of the natural real human body surface is covered by the cloth, so the realistic simulation of the cloth plays a key role in the realistic human body motion simulation. The cloth is a natural or artificial fiber mesh fabric, the shape of the garment formed by the cloth is not fixed and unchanged like a rigid body, and the cloth has some obvious characteristics of anisotropy, non-compressibility, tensile strength, non-bending resistance and the like on the aspect of mechanical characteristics, the simulation difficulty is brought to the simulation by the characteristics, meanwhile, the cloth often has multilayer conditions in the simulation process, and the final simulation effect is particularly influenced by the self simulation calculation of the multilayer cloth and the simulation calculation between the multilayer cloth and a human body.
Disclosure of Invention
The embodiment of the invention aims to provide a method and a device for simulating collision of cloth, aiming at simulating by establishing a constraint relation among vertexes of the cloth and overcoming the problems of mutual penetration and the like of multi-layer cloth in the simulation process through the constraint relation.
The embodiment of the invention is realized in such a way that a method for simulating collision of cloth comprises the following steps:
obtaining each vertex on the triangular mesh and a triangular patch having a potential collision relation with each vertex according to a self-collision result;
when the distance between the vertex and the triangular patch is smaller than a threshold value and the projection of the vertex falls in the triangular patch, adding the three vertexes of the triangular patch into the adjacent vertex indexes of the vertex;
determining the length of a constraint side according to the distances between the vertexes and the three vertexes of the triangular patch, and adding the length of the constraint side into a list of the length of the constraint side of the vertex;
and calculating constraint information in the cloth simulation according to the neighbor vertex information and the constraint side length information of each vertex, and processing the cloth simulation of the next frame according to the constraint information.
In a possible design, the step of obtaining, according to the self-collision result, each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex further includes:
two sections of continuous storage spaces are pre-allocated to each vertex on the triangular mesh and are respectively used for storing the neighbor vertex information of the vertex and the constraint side length information of the vertex.
In one possible design, when the distance between a vertex and a triangular patch is smaller than a threshold value and the projection of the vertex falls within the triangular patch, the specific step of adding the three vertices of the triangular patch to the neighboring vertex indexes of the vertex is:
resetting the index number of the adjacent vertex of the vertex, and judging whether the absolute value of the distance between the vertex and one of the adjacent triangular patches and the projection of the vertex fall in the adjacent triangular patch;
and when the absolute value of the distance between the vertex and the triangular patch is smaller than the threshold value and the projection of the vertex falls in the triangular patch, adding the three vertices of the triangular patch into the adjacent vertex indexes of the vertex.
In a possible design, the step of calculating constraint information in the fabric simulation according to the neighboring vertex information and the constraint edge length information of each vertex, and performing processing of the next frame of fabric simulation according to the constraint information further includes:
and carrying out duplication removal on the neighbor vertex of each vertex according to the neighbor vertex index of each vertex, and combining the same neighbor vertex to calculate the length of the constraint edge.
In one possible design, the step of calculating the length of the constraint edge by merging the same neighboring vertices comprises:
calculating the number of the same adjacent vertexes;
and taking the average value of the lengths of the constraint edges of the same vertex as the length of the constraint edge of the vertex.
Another object of an embodiment of the present invention is to provide a device for simulating collision of cloth, including:
the self-collision unit is used for obtaining each vertex on the triangular mesh and a triangular patch with a potential collision relation with each vertex according to a self-collision result;
the neighbor vertex determining unit is used for adding three vertexes of the triangular patch into neighbor vertex indexes of the vertexes when the distances between the vertexes and the triangular patch are smaller than a threshold value and the projections of the vertexes fall in the triangular patch;
the constraint side length determining unit is used for determining the length of a constraint side according to the distances between the vertex and the three vertexes of the triangular patch, and adding the length of the constraint side into a constraint side length list of the vertex;
and the constraint information determining unit is used for calculating constraint information in the cloth simulation according to the neighbor vertex information and the constraint side length information of each vertex, and performing the processing of the next frame of cloth simulation according to the constraint information.
In one embodiment, the bounding box determining unit further includes:
in one possible design, the cloth simulation collision device further comprises:
and the storage allocation unit is used for pre-allocating two continuous storage spaces for each vertex on the triangular mesh and respectively storing the neighbor vertex information of the vertex and the constraint side length information of the vertex.
In one possible design, the neighbor vertex determining unit includes:
the resetting judgment unit is used for resetting the index number of the adjacent vertex of the vertex, and judging whether the absolute value of the distance between the vertex and one of the adjacent triangular patches and the projection of the vertex fall in the adjacent triangular patch or not;
and the vertex index determining unit is used for adding the three vertexes of the triangular patch into the adjacent vertex indexes of the vertexes when the absolute value of the distance between the vertexes and the triangular patch is smaller than the threshold value and the projection of the vertexes is in the triangular patch.
In one possible design, the cloth simulation collision device further comprises:
and the duplication removing unit is used for carrying out duplication removal on the neighbor vertex of each vertex according to the neighbor vertex index of each vertex, and carrying out merging calculation on the same neighbor vertex to obtain the length of the constraint edge.
In one possible design, the deduplication unit further includes:
the number determining unit is used for calculating the number of the same adjacent vertexes;
and the value taking unit is used for taking the average value of the lengths of the constraint edges of the same vertex as the length of the constraint edge of the vertex.
According to the method and the device for simulating collision of the cloth, the information of each vertex and the triangular surface patch with the potential collision relation is obtained, whether the triangular surface patch with the potential collision relation is an effective triangular surface with the potential collision relation is judged, the effective triangular surface with the potential collision relation is converted into effective simulation constraint information, the constraint information is added into the cloth simulation process in the cloth simulation process, the problems of penetration and the like in the multi-layer simulation process of the cloth can be effectively solved through the addition of the constraint relation, and the problem of physical simulation distortion of the multi-layer cloth is effectively solved.
Drawings
FIG. 1 is a flow chart of a method for simulating collision of cloth according to a first embodiment of the present invention;
FIG. 2 is a flowchart illustrating a method for simulating collision of cloth according to a second embodiment of the present invention;
FIG. 3 is a diagram of a cloth simulation effect provided by a second embodiment of the present invention without adopting a cloth collision simulation method;
FIG. 4 is a diagram of a cloth simulation effect of a method for simulating collision by using cloth according to a second embodiment of the present invention;
FIG. 5 is a block diagram of a collision simulation apparatus for cloth according to a third embodiment of the present invention; and
FIG. 6 is a structural diagram of a device for simulating fabric crash according to a fourth embodiment of the present invention;
Detailed Description
In order to make those skilled in the art better understand the technical solution of the present invention, the technical solution in the embodiment of the present invention will be clearly described below with reference to the drawings in the embodiment of the present invention, and it is obvious that the described embodiment is only a part of the embodiment of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The following detailed description of specific implementations of the present invention is provided in conjunction with specific embodiments:
the first embodiment is as follows:
fig. 1 shows an implementation process of a method for simulating collision of cloth according to a first embodiment of the present invention, which is detailed as follows:
in step S101, each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex are obtained according to the self-collision result.
In a specific implementation process, coarse detection of self-collision is firstly completed between cloth and a human body, namely, information of each vertex on a triangular mesh and a triangular patch having a potential collision relation with the vertex is firstly obtained, the coarse detection method can be a plurality of detection methods, for example, a detection method based on a spatial hierarchy bounding box can be adopted, a collision detection method based on spatial hash can be adopted, and the like, potential collision pairs which may exist can be obtained through the detection method, and the potential collision pairs specifically include the potential collision relation between a point and a face, the potential collision relation between an edge and an edge, and the like.
In step S102, when the distance between the vertex and the triangular patch is smaller than the threshold value and the projection of the vertex falls within the triangular patch, the three vertices of the triangular patch are added to the neighboring vertex indexes of the vertex.
In the specific implementation process, after determining each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex, judging the distance value between the vertex and the triangular patch, because if the distance value between the vertex and the triangular patch is too large, the possibility of collision is very low, so the distance between the vertex and the triangular patch needs to be judged, only when the distance between the vertex and the triangular patch is less than a threshold value, the possibility of potential collision is meaningful for simulation, meanwhile, the projection relationship between the vertex and the triangular patch needs to be judged, the projection relationship is determined according to the normal direction of the triangular patch, namely, projection is carried out along the normal direction of the triangular patch, when the projection of the vertex falls in the triangular patch, the potential collision between the vertex and the triangular patch is judged to be a valid potential collision relationship, and then three vertices of the triangular patch are added to the index of the neighboring vertex of the vertex, and increasing the index number by 3, and then continuously judging the relationship between the vertex and the next triangular patch and the relationship between the next vertex and other triangular patches.
In step S103, the length of the constraint side is determined according to the distances between the vertex and the three vertices of the triangular patch, and the length of the constraint side is added to the list of the lengths of the constraint sides of the vertex.
In the implementation process, after determining the vertices and valid triangular patches with potential collision relationships, it is necessary to determine the lengths of the constraint edges according to the distance relationships between the vertices and the three vertices on the triangular patches, where the lengths of the constraint edges between the vertices are (sqrt (La ^2+ d0^2), sqrt (Lb ^2+ d0^2), and sqrt (Lc ^2+ d0^2)), where La is the distance from the vertex to a point of a triangular patch, where Lb is the distance from the vertex to a point of b of the triangular patch, Lc is the distance from the vertex to a point of c of the triangular patch, and d0 is the absolute value of the triangle from the vertex to the patch, and after obtaining the length of the constraint edge of each vertex, the length of the constraint edge is added to the list of the constraint edges of the vertex.
In step S104, constraint information in the fabric simulation is calculated according to the neighboring vertex information and the constraint side length information of each vertex, and processing of the next frame of fabric simulation is performed according to the constraint information.
In the specific implementation process, after the neighbor vertex index of the vertex and the constraint side length list of the vertex are obtained, simulation constraint can be performed in simulation collision according to effective potential collision information existing in the vertex, the simulation constraint can be performed in the simulation collision according to the effective potential collision information existing in the vertex, the effective constraint information is used as effective constraint information in the cloth simulation process and is added into a constraint value of cloth simulation, constraint simulation is performed on cloth simulation of the next frame, continuous repeated simulation is performed on cloth simulation of each frame through the method, and the problems of penetration and the like of multi-layer cloth in the simulation process can be effectively reduced.
According to the method for simulating collision of the cloth, the information of each vertex and the triangular surface patch with the potential collision relation is obtained, whether the triangular surface patch with the potential collision relation is an effective triangular surface with the potential collision relation is judged, the effective triangular surface with the potential collision relation is converted into effective simulation constraint information, the constraint information is added into the cloth simulation process in the cloth simulation process, the problems of penetration and the like in the multi-layer simulation process of the cloth can be effectively solved through the addition of the constraint relation, and the problem of physical simulation distortion of the multi-layer cloth is effectively solved.
Example two:
fig. 2 shows an implementation flow of a method for simulating collision of cloth according to a second embodiment of the present invention, which is detailed as follows:
in step S201, vertices on the triangular mesh and triangular patches having potential collision relationships with the vertices are obtained according to the self-collision result.
The method comprises the steps of firstly completing coarse detection of self-collision between cloth and a human body, namely firstly obtaining information of each vertex on a triangular mesh and a triangular patch having a potential collision relation with the vertex, wherein the coarse detection method can be a plurality of detection methods, for example, a detection method based on a spatial hierarchy bounding box can be adopted, a collision detection method based on spatial hash can be adopted, and the like.
In step S202, two continuous storage spaces are pre-allocated to each vertex on the triangular mesh, and are respectively used for storing neighboring vertex information of the vertex and constraint side length information of the vertex.
In the specific implementation process, after obtaining each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex, in order to record and store the relationship between the vertex and the triangular patch, two sections of storage spaces are allocated to each vertex on the triangular mesh, wherein preferably two continuous sections of storage spaces are allocated, the two sections of storage spaces are respectively used for storing vertex information adjacent to the vertex and constraint side length information of the vertex, the vertex information adjacent to the stored vertex is stored through an adjacent vertex index table, the constraint side length information of the stored vertex is stored through a constraint side length list of the vertex, and the adjacent vertex information of the vertex and the constraint side length information of the vertex are stored through the two continuous sections of storage spaces.
In step S203, when the distance between the vertex and the triangular patch is smaller than the threshold value and the projection of the vertex falls within the triangular patch, the three vertices of the triangular patch are added to the neighboring vertex indexes of the vertex.
In a specific implementation process, after determining each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex, resetting the index number of the adjacent vertex of the vertex, specifically marking the index number of the adjacent vertex as 0, and judging whether the absolute value of the distance between the vertex and one adjacent triangular patch and the projection of the vertex fall in the adjacent triangular patch; the distance value between the vertex and the triangular patch is determined because if the distance value between the vertex and the triangular patch is too large, the probability of collision is already very low, therefore, the distance between the vertex and the triangular patch needs to be determined, and only when the distance between the vertex and the triangular patch is smaller than a threshold value, the possibility of potential collision is meaningful for simulation, and meanwhile, the projection relation between the vertex and the triangular patch needs to be judged, the projection relation is determined according to the normal direction of the triangular patch, namely, the projection is carried out along the normal direction of the triangular patch, when the projection of the vertex falls into the triangular patch, the potential collision between the vertex and the triangular patch is judged to be an effective potential collision relation, at the moment, three vertexes of the triangular patch are added into the index of the adjacent vertex of the vertex, simultaneously, the number of the indexes is increased by 3, and then continuously judging the relationship between the vertex and the next triangular patch and the relationship between the next vertex and other triangular patches.
In step S204, the length of the constraint side is determined according to the distances between the vertex and the three vertices of the triangular patch, and the length of the constraint side is added to the list of the lengths of the constraint sides of the vertex.
In the implementation process, after determining the vertices and valid triangular patches with potential collision relationships, it is necessary to determine the lengths of the constraint edges according to the distance relationships between the vertices and the three vertices on the triangular patches, where the lengths of the constraint edges between the vertices are (sqrt (La ^2+ d0^2), sqrt (Lb ^2+ d0^2), and sqrt (Lc ^2+ d0^2)), where La is the distance from the vertex to a point of a triangular patch, where Lb is the distance from the vertex to a point of b of the triangular patch, Lc is the distance from the vertex to a point of c of the triangular patch, and d0 is the absolute value of the triangle from the vertex to the patch, and after obtaining the length of the constraint edge of each vertex, the length of the constraint edge is added to the list of the constraint edges of the vertex.
In step S205, the neighbor vertices of each vertex are deduplicated according to their neighbor vertex indices, and the same neighbor vertices are merged to calculate the constraint edge length.
In a specific implementation process, after obtaining an adjacent vertex index table of a vertex and a constraint side length table of the vertex, it is found that the same adjacent vertex information appears in a specific list, and the same adjacent vertex information appears with different constraint side length information, if simulation processing is performed on the constraint side information as constraint information of constraint simulation, a plurality of constraint information appears, which causes disorder of data processing, at this time, in order to obtain consistent simulation constraint information, it is necessary to perform deduplication on adjacent vertices of the same vertex, merge adjacent vertices of the same vertex, and merge constraint side lengths corresponding to adjacent vertices of the same vertex, and a manner of specifically merging constraint side lengths corresponding to adjacent vertices is as follows: firstly, calculating the number of the same adjacent vertexes, and then taking the average value of the lengths of the constraint edges corresponding to the same adjacent vertexes as the length of the constraint edge corresponding to the adjacent vertexes.
In step S206, constraint information in the fabric simulation is calculated according to the neighboring vertex information and the constraint side length information of each vertex, and processing of the next frame of fabric simulation is performed according to the constraint information.
In the specific implementation process, after a nonrepeating neighbor vertex index of a vertex and a list of constrained side lengths of the vertex are obtained, simulation constraint can be performed in simulation collision according to effective potential collision information of the vertex, the simulation constraint can be taken as effective constraint information in a cloth simulation process and added into a constraint value of cloth simulation, constraint simulation is performed on cloth simulation of a next frame, and continuous repeated simulation is performed on cloth simulation of each frame through the method, so that the problems of penetration and the like of multiple layers of cloth in the simulation process can be effectively reduced.
The embodiment of the invention adopts the above mode, a method for simulating collision of cloth, obtains information of each vertex and a triangular patch with a potential collision relation, then judges whether the triangular patch with the potential collision relation is an effective triangular patch with the potential collision relation, converts the effective triangular patch with the potential collision into effective simulation constraint information, adds the potential collision information into the constraint information in advance in the process of simulating the cloth, then effectively identifies the potential position relation between the vertex and the vertex in the cloth by adding the constraint relation in the process of simulating the cloth, and further carries out effective position identification and simulation processing in the subsequent simulation process, the introduction of the mode can effectively solve the penetration problem in the simulation of the multilayer cloth, and the problem of physical simulation distortion of the multilayer cloth is effectively solved by the constraint mode, wherein, fig. 3 is a cloth simulation effect diagram of a method without adopting cloth simulation collision, fig. 4 is a cloth simulation effect diagram of a method adopting cloth simulation collision, the technical problem that multiple layers of cloth directly penetrate each other in the process of multiple layers of simulation collision is basically eliminated after the method adopting cloth simulation collision, and then self-collision response is carried out between clothes and human bodies and between clothes and clothes, so as to complete the space collision of clothes and a three-dimensional model in a virtual three-dimensional space and the response after collision.
Example three:
fig. 5 is a block diagram illustrating a collision simulation apparatus for cloth according to a third embodiment of the present invention, in which only the portions related to the embodiment of the present invention are shown for convenience of description.
And the self-collision unit 501 is configured to obtain each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex according to a self-collision result.
In a specific implementation process, the self-collision unit is used for firstly completing coarse detection of self-collision between cloth and a human body when the cloth and the cloth are in contact with each other, that is, firstly obtaining information of each vertex on a triangular mesh and a triangular patch having a potential collision relationship with the vertex, the coarse detection method can be a plurality of detection methods, for example, a detection method based on a spatial hierarchy bounding box can be adopted, a collision detection method based on spatial hash can also be adopted, and possible potential collision pairs can be obtained by the detection method, and the potential collision pairs specifically include the potential collision relationship between a point and a face, the potential collision relationship between an edge and an edge, and the like.
And a neighboring vertex determining unit 502, configured to add three vertices of the triangular patch to neighboring vertex indexes of the vertices when the distances between the vertices and the triangular patch are smaller than a threshold value and the projections of the vertices fall within the triangular patch.
In the specific implementation process, after determining each vertex on the triangular mesh and the triangular patch having a potential collision relationship with each vertex, the neighboring vertex determining unit determines the distance value between the vertex and the triangular patch, because if the distance value between the vertex and the triangular patch is too large, the probability of collision is very low, and therefore the distance between the vertex and the triangular patch needs to be determined, only when the distance between the vertex and the triangular patch is less than a threshold value, the probability of potential collision is meaningful for simulation, and meanwhile, the projection relationship between the vertex and the triangular patch needs to be determined, the projection relationship is determined according to the normal direction of the triangular patch, that is, projection is performed along the normal direction of the triangular patch, and when the projection of the vertex falls within the triangular patch, the potential collision between the vertex and the triangular patch is determined to be a valid potential collision relationship, at this time, three vertexes of the triangular patch are added into the index of the adjacent vertex of the vertex, the number of indexes is increased by 3, and then the relation between the vertex and the next triangular patch and the relation between the next vertex and other triangular patches are continuously judged.
And a constrained side length determining unit 503, configured to determine the length of the constrained side according to the distances between the vertex and the three vertices of the triangular patch, and add the constrained side length to the constrained side length list of the vertex.
In a specific implementation process, after determining the vertex and the valid triangle patch having the potential collision relationship, the constraint edge length determining unit needs to determine the constraint edge length according to the distance relationship between the vertex and the three vertices on the triangle patch, where the specific constraint edge lengths between the vertex and the three vertices are (sqrt (La ^2+ d0^ 2); (Lb ^2+ d0^ 2); (sqrt (Lc ^2+ d0^2)), where La is the distance from the vertex to the triangle patch a point, where Lb is the distance from the vertex to the triangle patch b point, where Lc is the distance from the vertex to the triangle patch c point, and d0 is the absolute value of the vertex to the triangle patch, and after obtaining the constraint edge length of each vertex, the constraint edge length is added to the constraint edge length list of the vertex.
And the constraint information determining unit 304 is configured to calculate constraint information in the fabric simulation according to the neighboring vertex information and the constraint edge length information of each vertex, and perform processing of the next frame of fabric simulation according to the constraint information.
In a specific implementation process, after obtaining the neighbor vertex index of the vertex and the constrained side length list of the vertex, the constrained information determining unit can perform simulation constraint in simulation collision according to effective potential collision information existing in the vertex, and the simulation constraint information is used as effective constrained information in a cloth simulation process and added into a constraint value of cloth simulation to perform constraint simulation on cloth simulation of a next frame.
According to the cloth collision simulation device, the information of each vertex and the triangular patch with the potential collision relation is obtained, whether the triangular patch with the potential collision relation is an effective triangular patch with the potential collision relation is judged, the effective triangular patch with the potential collision relation is converted into effective simulation constraint information, the constraint information is added into the cloth simulation process in the cloth simulation process, the problems of penetration and the like in the multi-layer simulation process of cloth can be effectively solved through the addition of the constraint relation, and the problem of physical simulation distortion of the multi-layer cloth is effectively solved.
Example four:
fig. 6 is a block diagram illustrating a collision simulation apparatus for cloth according to a fourth embodiment of the present invention, in which only the portions related to the embodiment of the present invention are shown for convenience of description.
And the self-collision unit 601 is configured to obtain each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex according to a self-collision result.
The method comprises the steps of firstly completing coarse detection of self-collision between cloth and a human body, namely firstly obtaining information of each vertex on a triangular mesh and a triangular patch having a potential collision relation with the vertex, wherein the coarse detection method can be a plurality of detection methods, for example, a detection method based on a spatial hierarchy bounding box can be adopted, a collision detection method based on spatial hash can be adopted, and the like.
The storage allocation unit 602 is configured to pre-allocate two segments of continuous storage spaces for each vertex on the triangular mesh, and respectively store neighboring vertex information of the vertex and constraint side length information of the vertex.
In the specific implementation process, after obtaining each vertex on the triangular mesh and a triangular patch having a potential collision relationship with each vertex, in order to record and store the relationship between the vertex and the triangular patch, two sections of storage spaces are allocated to each vertex on the triangular mesh, wherein preferably two continuous sections of storage spaces are allocated, the two sections of storage spaces are respectively used for storing vertex information adjacent to the vertex and constraint side length information of the vertex, the vertex information adjacent to the stored vertex is stored through an adjacent vertex index table, the constraint side length information of the stored vertex is stored through a constraint side length list of the vertex, and the adjacent vertex information of the vertex and the constraint side length information of the vertex are stored through the two continuous sections of storage spaces.
A neighboring vertex determining unit 603 configured to add three vertices of the triangular patch to neighboring vertex indexes of the vertices when the distances between the vertices and the triangular patch are smaller than a threshold value and the projections of the vertices fall within the triangular patch.
In a specific implementation process, the neighbor vertex determining unit includes: the resetting judgment unit is used for resetting the index number of the adjacent vertex of the vertex, and judging whether the absolute value of the distance between the vertex and one of the adjacent triangular patches and the projection of the vertex fall in the adjacent triangular patch or not; and the vertex index determining unit is used for adding the three vertexes of the triangular patch into the adjacent vertex indexes of the vertexes when the absolute value of the distance between the vertexes and the triangular patch is smaller than the threshold value and the projection of the vertexes is in the triangular patch.
After determining each vertex on the triangular mesh and the triangular patch having potential collision relation with each vertex, resetting the index number of the adjacent vertex of the vertex, specifically marking the index number of the adjacent vertex as 0, and judging whether the absolute value of the distance between the vertex and one adjacent triangular patch and the projection of the vertex fall in the adjacent triangular patch; the distance value between the vertex and the triangular patch is determined because if the distance value between the vertex and the triangular patch is too large, the probability of collision is already very low, therefore, the distance between the vertex and the triangular patch needs to be determined, and only when the distance between the vertex and the triangular patch is smaller than a threshold value, the possibility of potential collision is meaningful for simulation, and meanwhile, the projection relation between the vertex and the triangular patch needs to be judged, the projection relation is determined according to the normal direction of the triangular patch, namely, the projection is carried out along the normal direction of the triangular patch, when the projection of the vertex falls into the triangular patch, the potential collision between the vertex and the triangular patch is judged to be an effective potential collision relation, at the moment, three vertexes of the triangular patch are added into the index of the adjacent vertex of the vertex, simultaneously, the number of the indexes is increased by 3, and then continuously judging the relationship between the vertex and the next triangular patch and the relationship between the next vertex and other triangular patches.
And a constrained edge length determining unit 604, configured to determine the length of the constrained edge according to the distances between the vertex and the three vertices of the triangular patch, and add the constrained edge length to the constrained edge length list of the vertex.
In the implementation process, after determining the vertices and valid triangular patches with potential collision relationships, it is necessary to determine the lengths of the constraint edges according to the distance relationships between the vertices and the three vertices on the triangular patches, where the lengths of the constraint edges between the vertices are (sqrt (La ^2+ d0^2), sqrt (Lb ^2+ d0^2), and sqrt (Lc ^2+ d0^2)), where La is the distance from the vertex to a point of a triangular patch, where Lb is the distance from the vertex to a point of b of the triangular patch, Lc is the distance from the vertex to a point of c of the triangular patch, and d0 is the absolute value of the triangle from the vertex to the patch, and after obtaining the length of the constraint edge of each vertex, the length of the constraint edge is added to the list of the constraint edges of the vertex.
And a deduplication unit 605, configured to perform deduplication on neighboring vertices of each vertex according to the neighboring vertex index of each vertex, and perform merging calculation on the same neighboring vertices to calculate a constraint edge length.
In a specific implementation process, the deduplication unit further comprises: the number determining unit is used for calculating the number of the same adjacent vertexes; and the value taking unit is used for taking the average value of the lengths of the constraint edges of the same vertex as the length of the constraint edge of the vertex.
After obtaining the neighbor vertex index table of the vertex and the constraint side length table of the vertex, it is found that the same neighbor vertex information appears in a specific list, and the same neighbor vertex information appears with different constraint side length information, if the constraint side information is used as constraint information of constraint simulation for simulation processing, a plurality of constraint information appears, causing disorder of data processing, at this time, in order to obtain consistent simulation constraint information, it is necessary to perform deduplication on neighbor vertices of the same vertex, merge neighbor vertices of the same vertex, and perform merging processing on constraint side lengths corresponding to neighbor vertices of the same vertex, and specifically perform merging processing on constraint side lengths corresponding to neighbor vertices: firstly, calculating the number of the same adjacent vertexes, and then taking the average value of the lengths of the constraint edges corresponding to the same adjacent vertexes as the length of the constraint edge corresponding to the adjacent vertexes.
And the constraint information determining unit 606 is configured to calculate constraint information in the fabric simulation according to the neighboring vertex information and the constraint edge length information of each vertex, and perform processing of the next frame of fabric simulation according to the constraint information.
In the specific implementation process, after a nonrepeating neighbor vertex index of a vertex and a list of constrained side lengths of the vertex are obtained, simulation constraint can be performed in simulation collision according to effective potential collision information of the vertex, the simulation constraint can be taken as effective constraint information in a cloth simulation process and added into a constraint value of cloth simulation, constraint simulation is performed on cloth simulation of a next frame, and continuous repeated simulation is performed on cloth simulation of each frame through the method, so that the problems of penetration and the like of multiple layers of cloth in the simulation process can be effectively reduced.
Through the method, the embodiment of the invention discloses a device for simulating collision of cloth, which obtains the information of each vertex and a triangular surface patch with a potential collision relation, then judges whether the triangular surface patch with the potential collision relation is an effective triangular surface with the potential collision relation, converts the effective triangular surface with the potential collision into effective simulation constraint information, adds the potential collision information into the constraint information in advance in the process of simulating the cloth, then can effectively identify the potential position relation between the vertex and the vertex in the cloth through the addition of the constraint relation in the process of simulating the cloth, and further carries out effective position identification and simulation processing in the subsequent simulation process, the introduction of the method can effectively solve the penetrating problem in the process of simulating the multilayer cloth, and the problem of physical simulation distortion of the multilayer cloth is effectively solved through the constraint method, wherein, fig. 3 is a cloth simulation effect diagram of a method without adopting cloth simulation collision, fig. 4 is a cloth simulation effect diagram of a method adopting cloth simulation collision, the technical problem that multiple layers of cloth directly penetrate each other in the process of multiple layers of simulation collision is basically eliminated after the method adopting cloth simulation collision, and then self-collision response is carried out between clothes and human bodies and between clothes and clothes, so as to complete the space collision of clothes and a three-dimensional model in a virtual three-dimensional space and the response after collision.
In the above-described embodiments of the invention, may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
The above embodiments are only used to describe the technical solutions of the embodiments of the present invention in detail, but the above description of the embodiments is only used to help understanding the method and the core idea of the embodiments of the present invention, and should not be construed as limiting the present application. Those skilled in the art can easily conceive of changes or substitutions within the technical scope of the embodiments of the present invention, and all such changes or substitutions are intended to be included within the scope of the embodiments of the present invention.

Claims (12)

1. A method for simulating fabric collision, the method comprising:
obtaining each vertex on the triangular mesh and a triangular patch having a potential collision relation with each vertex according to a self-collision result;
when the distance between the vertex and the triangular patch is smaller than a threshold value and the projection of the vertex falls in the triangular patch, adding the three vertexes of the triangular patch into the adjacent vertex indexes of the vertex;
determining the length of a constraint side according to the distances between the vertexes and the three vertexes of the triangular patch, and adding the length of the constraint side into a list of the length of the constraint side of the vertex;
and calculating constraint information in the cloth simulation according to the neighbor vertex information and the constraint side length information of each vertex, and processing the cloth simulation of the next frame according to the constraint information.
2. The method of claim 1, wherein the step of obtaining each vertex on the triangular mesh and the triangular patch having a potential collision relationship with each vertex according to the self-collision result further comprises:
two sections of continuous storage spaces are pre-allocated to each vertex on the triangular mesh and are respectively used for storing the neighbor vertex information of the vertex and the constraint side length information of the vertex.
3. The method of claim 1, wherein when the distance between the vertex and the triangle patch is less than the threshold value and the projection of the vertex falls within the triangle patch, the step of adding the three vertices of the triangle patch to the indices of the neighboring vertices of the vertex is:
resetting the index number of the adjacent vertex of the vertex, and judging whether the absolute value of the distance between the vertex and one of the adjacent triangular patches and the projection of the vertex fall in the adjacent triangular patch;
and when the absolute value of the distance between the vertex and the triangular patch is smaller than the threshold value and the projection of the vertex falls in the triangular patch, adding the three vertices of the triangular patch into the adjacent vertex indexes of the vertex.
4. The method according to claim 1, wherein the step of calculating constraint information in the cloth simulation according to the neighbor vertex information and the constraint edge length information of each vertex, and performing the processing of the next frame of cloth simulation according to the constraint information further comprises:
and carrying out duplication removal on the neighbor vertex of each vertex according to the neighbor vertex index of each vertex, and combining the same neighbor vertex to calculate the length of the constraint edge.
5. The method of claim 4, wherein said step of calculating a bound edge length for the same neighbor vertex by merging comprises:
calculating the number of the same adjacent vertexes;
and taking the average value of the lengths of the constraint edges of the same vertex as the length of the constraint edge of the vertex.
6. An apparatus for simulating fabric impact, the apparatus comprising:
the self-collision unit is used for obtaining each vertex on the triangular mesh and a triangular patch with a potential collision relation with each vertex according to a self-collision result;
the neighbor vertex determining unit is used for adding three vertexes of the triangular patch into neighbor vertex indexes of the vertexes when the distances between the vertexes and the triangular patch are smaller than a threshold value and the projections of the vertexes fall in the triangular patch;
the constraint side length determining unit is used for determining the length of a constraint side according to the distances between the vertex and the three vertexes of the triangular patch, and adding the length of the constraint side into a constraint side length list of the vertex;
and the constraint information determining unit is used for calculating constraint information in the cloth simulation according to the neighbor vertex information and the constraint side length information of each vertex, and performing the processing of the next frame of cloth simulation according to the constraint information.
7. The apparatus of claim 6, wherein said cloth simulating collision apparatus further comprises:
and the storage allocation unit is used for pre-allocating two continuous storage spaces for each vertex on the triangular mesh and respectively storing the neighbor vertex information of the vertex and the constraint side length information of the vertex.
8. The apparatus of claim 6, wherein the neighbor vertex determining unit comprises:
the resetting judgment unit is used for resetting the index number of the adjacent vertex of the vertex, and judging whether the absolute value of the distance between the vertex and one of the adjacent triangular patches and the projection of the vertex fall in the adjacent triangular patch or not;
and the vertex index determining unit is used for adding the three vertexes of the triangular patch into the adjacent vertex indexes of the vertexes when the absolute value of the distance between the vertexes and the triangular patch is smaller than the threshold value and the projection of the vertexes is in the triangular patch.
9. The apparatus of claim 6, wherein said cloth simulating collision apparatus further comprises:
and the duplication removing unit is used for carrying out duplication removal on the neighbor vertex of each vertex according to the neighbor vertex index of each vertex, and carrying out merging calculation on the same neighbor vertex to obtain the length of the constraint edge.
10. The apparatus of claim 9, wherein the deduplication unit further comprises:
the number determining unit is used for calculating the number of the same adjacent vertexes;
and the value taking unit is used for taking the average value of the lengths of the constraint edges of the same vertex as the length of the constraint edge of the vertex.
11. A computer-readable storage medium having stored thereon instructions which, when executed on a computer, cause the computer to perform the method of any one of claims 1-5.
12. A computer program product comprising instructions which, when run on a computer, cause the computer to perform the method of any one of claims 1 to 5.
CN201810826872.1A 2018-07-25 2018-07-25 Cloth simulation collision method and device Pending CN110765565A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810826872.1A CN110765565A (en) 2018-07-25 2018-07-25 Cloth simulation collision method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810826872.1A CN110765565A (en) 2018-07-25 2018-07-25 Cloth simulation collision method and device

Publications (1)

Publication Number Publication Date
CN110765565A true CN110765565A (en) 2020-02-07

Family

ID=69327199

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810826872.1A Pending CN110765565A (en) 2018-07-25 2018-07-25 Cloth simulation collision method and device

Country Status (1)

Country Link
CN (1) CN110765565A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112417746A (en) * 2020-11-18 2021-02-26 中北大学 Method for predicting collision detection based on neural network
CN114925552A (en) * 2022-07-19 2022-08-19 武汉亘星智能技术有限公司 Cloth simulation method and system based on HPBD
CN115293018A (en) * 2022-09-29 2022-11-04 武汉亘星智能技术有限公司 Collision detection method and device for flexible body, computer equipment and storage medium
WO2022267855A1 (en) * 2021-06-22 2022-12-29 腾讯科技(深圳)有限公司 Collision data processing method and apparatus, storage medium, program product, and electronic device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112417746A (en) * 2020-11-18 2021-02-26 中北大学 Method for predicting collision detection based on neural network
CN112417746B (en) * 2020-11-18 2022-11-25 中北大学 Method for predicting collision detection based on neural network
WO2022267855A1 (en) * 2021-06-22 2022-12-29 腾讯科技(深圳)有限公司 Collision data processing method and apparatus, storage medium, program product, and electronic device
CN114925552A (en) * 2022-07-19 2022-08-19 武汉亘星智能技术有限公司 Cloth simulation method and system based on HPBD
CN115293018A (en) * 2022-09-29 2022-11-04 武汉亘星智能技术有限公司 Collision detection method and device for flexible body, computer equipment and storage medium
CN115293018B (en) * 2022-09-29 2022-12-27 武汉亘星智能技术有限公司 Collision detection method and device for flexible body, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN110765565A (en) Cloth simulation collision method and device
Truong‐Hong et al. Combining an angle criterion with voxelization and the flying voxel method in reconstructing building models from LiDAR data
US8384717B2 (en) Method and system for B-rep face and edge connectivity compression
US9443345B2 (en) Method and apparatus for rendering three-dimensional (3D) object
US9959670B2 (en) Method for rendering terrain
CN105378796A (en) Scalable volumetric 3d reconstruction
CN107564077B (en) method and device for drawing road network
CN115439607A (en) Three-dimensional reconstruction method and device, electronic equipment and storage medium
CN109767391A (en) Point cloud denoising method, image processing equipment and the device with store function
KR102158390B1 (en) Method and apparatus for image processing
CN111145328B (en) Three-dimensional character surface texture coordinate calculation method, medium, equipment and device
CN115330940A (en) Three-dimensional reconstruction method, device, equipment and medium
CN109491565A (en) The module information display methods and equipment of object in three-dimensional scenic
CN112184900B (en) Method, device and storage medium for determining elevation data
Chen et al. Flexible and rapid animation of brittle fracture using the smoothed particle hydrodynamics formulation
JP6391033B1 (en) Image processing apparatus, image processing method, and program
KR101086228B1 (en) Method and apparatus for providing 3d model cutting simulation
CN112337093A (en) Virtual object clustering method and device, storage medium and electronic device
CN114791800A (en) White-model building edge tracing method and device, computer equipment and storage medium
TW202312100A (en) Grid generation method, electronic device and computer-readable storage medium
KR100738095B1 (en) Method and apparatus of rendering 3D object efficiently
CN102945571A (en) Void filling method and system based on surface data
Laug et al. Discrete CAD model for visualization and meshing
Bangay et al. Minimum spanning trees for valley and ridge characterization in digital elevation maps
CN107346319A (en) Across city up to base establishing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20200207