A cloth simulation processing method and device
By using multi-layered distance and velocity field data and employing a pyramid structure to represent dynamic human collisions, the problem of high complexity in distance field construction in existing technologies is solved, and efficient cloth simulation of dynamic human bodies is achieved.
Patent Information
- Application Number
- CN202210573888.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-24
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2042-05-24
AI Technical Summary
In existing technologies, the construction process of the distance field in cloth simulation is highly complex when dealing with human collisions, making it unsuitable for dynamic human bodies and resulting in poor simulation effects.
Using multi-layered distance and velocity field data, a pyramid structure is used to represent dynamic human collisions. Adaptive cloth simulation is achieved by updating the distance and velocity parameters of the mesh cells.
This reduces the complexity of distance field construction, improves the applicability and simulation effect of cloth simulation on dynamic human bodies, and ensures the accuracy and coverage of the distance field near the human body surface.
Smart Images

Figure CN114880729B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of digital content technology, and in particular to a method and apparatus for fabric simulation processing. Background Technology
[0002] In existing technologies, handling human collisions in cloth simulation is a key challenge in order to achieve a natural fit between cloth and the human body. Human collisions typically employ a distance field representation method. This method considers the human body as a closed surface, so it voxels the space around the human body, stores the distance of each voxel to the human body surface, and finally detects the distance value of each voxel containing a vertex of the cloth, pushing cloth vertices with distances less than 0 (i.e., those inside the human body) outwards. Once the distance field is established, this method has very low complexity; however, the process of constructing the distance field itself requires high complexity. For dynamic human bodies, a distance field needs to be constructed for each frame, making it unsuitable for dynamic human bodies. Summary of the Invention
[0003] The purpose of this invention is to provide a fabric simulation processing method and apparatus to avoid the high complexity of the distance field construction process for human body collision in the prior art, which is not applicable to dynamic human bodies and results in poor fabric simulation effects.
[0004] To achieve the above objectives, embodiments of the present invention provide a fabric simulation processing method, comprising:
[0005] Obtain the human body mesh data corresponding to the virtual human body, wherein the human body mesh data is a mesh cell containing the virtual human body in multiple preset mesh cells;
[0006] Based on the human body mesh data, the distance field data and velocity field data of the multi-layer structure of the fabric simulation model are updated to obtain the updated fabric simulation model.
[0007] The virtual human body is subjected to cloth simulation processing based on the updated cloth simulation model to obtain cloth simulation results.
[0008] The distance field data includes distance parameters from each preset grid cell to the virtual human body surface, and the velocity field data includes virtual human body movement speed parameters corresponding to each preset grid cell. In the distance field data and the velocity field data, the grid cells corresponding to the same layer structure have the same size, and the grid cells corresponding to different layer structures have different sizes.
[0009] Optionally, based on the human body mesh data, the distance field data of the multi-layer structure of the fabric simulation model is updated, including:
[0010] For each layer of structure, multiple target mesh units corresponding to each triangular facet are determined; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets;
[0011] For each triangular facet, determine the minimum distance between the center of the target mesh cell and the triangular facet.
[0012] For each layer of structure, the distance parameter corresponding to the target grid cell in the distance field data is updated to the minimum distance.
[0013] Optionally, based on the human body mesh data, the velocity field data of the multi-layer structure of the fabric simulation model is updated, including:
[0014] For each layer of structure, multiple target mesh units corresponding to each triangular facet are determined; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets;
[0015] For each triangular facet, the movement speed of each target mesh cell corresponding to the triangular facet is determined based on the movement speed of the triangular facet.
[0016] For each layer of structure, the human movement speed parameters corresponding to the target grid cell in the velocity field data are updated according to the movement speed of the target grid cell.
[0017] Optionally, before determining the moving speed of each target mesh cell corresponding to the triangular facet based on its moving speed, the method further includes:
[0018] For each triangular facet, calculate the position of the triangular facet at time i and the offset of its position at time i+1.
[0019] The moving speed of the triangular facet is determined based on the offset and the time difference between the i-th time and the (i+1)-th time, where i is a positive integer.
[0020] Optionally, for each triangular facet, the moving speed of each target mesh cell corresponding to the triangular facet is determined based on the moving speed of the triangular facet, including:
[0021] For each layer of structure, determine the minimum distance between each triangular facet and the multiple target mesh cells corresponding to the triangular facet;
[0022] For each target grid cell, a weight value corresponding to the target grid cell is determined based on the minimum distance corresponding to the target grid cell;
[0023] For each triangular facet, the movement speed of the multiple target mesh cells corresponding to the triangular facet is determined based on the movement speed of the triangular facet and the weight value.
[0024] Optionally, the human movement velocity parameters corresponding to the target grid cell in the velocity field data are updated, including:
[0025] For each layer of structure, the human movement speed parameter corresponding to the target grid cell in the distance field data is updated to the movement speed corresponding to the target grid cell and the weight value.
[0026] Optionally, for each layer of structure, multiple target mesh elements corresponding to each triangular facet are determined, including:
[0027] For each layer of structure, determine the first grid cell containing each triangular facet;
[0028] The first grid cell and a plurality of second grid cells adjacent to the first grid cell are identified as the plurality of target grid cells.
[0029] Optionally, for each layer of structure, the first mesh cell containing each triangular facet is determined, including:
[0030] For each layer of structure, determine the origin position in the human body mesh data;
[0031] For each triangular facet, the first grid cell in which the triangular facet is located is determined based on the vertex position of the triangular facet, the origin position, and the size of the grid cell of each layer.
[0032] Optionally, determining the origin position in the human body mesh data for each layer of structure includes:
[0033] For each layer of structure, the vertex position of each grid cell in the human body mesh data in the three-dimensional direction is obtained;
[0034] For each dimension, determine the minimum value at each vertex position;
[0035] The origin position is determined based on the minimum value among the vertex positions in the three-dimensional direction.
[0036] Optionally, for each triangular facet, the first mesh cell containing the triangular facet is determined based on the vertex position of the triangular facet, the origin position, and the mesh cell size of each layer, including:
[0037] The center position of the triangular facet is determined based on the vertex positions of the triangular facet.
[0038] Calculate the difference between the center position of the triangular facet and the origin position;
[0039] The first grid cell containing the triangular facet is determined based on the ratio of the difference to the size of the grid cell in each layer of the structure.
[0040] Optionally, updating the velocity field data of the fabric simulation model also includes:
[0041] For grid cells in the velocity field data that have not been updated, determine the average velocity of multiple adjacent grid cells of that grid cell;
[0042] The target velocity is obtained by performing thermal diffusion iteration processing based on the average velocity.
[0043] Based on the target velocity, the human movement velocity parameters of the unupdated grid cells in the velocity field data are updated.
[0044] Optionally, the step of performing cloth simulation processing on the virtual human body based on the updated cloth simulation model to obtain cloth simulation results includes:
[0045] The fabric data is updated based on the velocity field data of the updated fabric simulation model to obtain the updated fabric data.
[0046] Based on the distance field data of the updated fabric simulation model and the updated fabric data, fabric simulation processing is performed to obtain fabric simulation results.
[0047] Optionally, the fabric data is updated based on the velocity field data of the updated fabric simulation model to obtain updated fabric data, including:
[0048] Calculate the product of the first time difference and the human movement velocity parameter in the velocity field data of the fabric simulation model at time i; where the first time difference is the time difference between time i+1 and time i, and i is a positive integer;
[0049] The fabric data is updated based on the sum of the product and the first simulation result output by the fabric simulation model at the i-th time, resulting in updated fabric data.
[0050] Optionally, fabric simulation processing is performed based on the distance field data of the updated fabric simulation model and the updated fabric data to obtain fabric simulation results, including:
[0051] Determine the target maximum value in the vector concatenation of the target value and the distance of each grid vertex of the fabric from the human distance field data of the updated fabric simulation model;
[0052] The human collision distance field constraint force is determined by multiplying the target maximum value, the preset weight value, and the normal vector of the human distance field data of the updated fabric simulation model.
[0053] Based on the human body collision distance field constraint force, the distance field data of the updated fabric simulation model, and the preset elastic material system, the target elastic material system is determined.
[0054] The updated fabric data is input into the target elastic material system to obtain fabric simulation results.
[0055] Optionally, before obtaining the human body mesh data corresponding to the virtual human body, the method further includes:
[0056] Determine the bounding box of the human body based on the virtual human body;
[0057] Based on the preset grid unit size, the human body bounding box is divided in three dimensions in a manner that increases or decreases layer by layer according to the grid unit size, resulting in multiple preset grid units corresponding to each layer of structure.
[0058] Optionally, before updating the distance field data and velocity field data of the multi-layer structure of the fabric simulation model based on the human body mesh data, the method further includes:
[0059] Based on multiple preset grid cells corresponding to each layer of structure, the initial distance field data and initial velocity field data are determined.
[0060] In the initial distance field data, the distance parameter corresponding to each grid cell is the nearest distance value between that grid cell and the virtual human body surface; the movement speed parameter corresponding to each grid cell in the initial velocity field data is zero.
[0061] Optionally, the distance field data values of each grid vertex of the fabric from the updated fabric simulation model to the human body distance field include:
[0062] The data is taken from the bottom layer to the top layer of the updated fabric simulation model's human distance field data, and the process continues until a non-initialized value is obtained or until the top layer of the updated fabric simulation model is reached.
[0063] To achieve the above objectives, embodiments of the present invention also provide a fabric simulation processing apparatus, comprising:
[0064] The acquisition module 10 is used to acquire human body mesh data corresponding to the virtual human body, wherein the human body mesh data is a mesh unit containing the virtual human body in a plurality of preset mesh units;
[0065] The first processing module 20 is used to update the distance field data and velocity field data of the multi-layer structure of the fabric simulation model according to the human body mesh data, so as to obtain the updated fabric simulation model.
[0066] The second processing module 30 is used to perform cloth simulation processing on the virtual human body according to the updated cloth simulation model to obtain cloth simulation results.
[0067] The distance field data includes distance parameters from each preset grid cell to the virtual human body surface, and the velocity field data includes virtual human body movement speed parameters corresponding to each preset grid cell. In the distance field data and the velocity field data, the grid cells corresponding to the same layer structure have the same size, and the grid cells corresponding to different layer structures have different sizes.
[0068] To achieve the above objectives, embodiments of the present invention also provide a readable storage medium having a program or instructions stored thereon, which, when executed by a processor, implement the steps in the fabric simulation processing method as described in any of the preceding claims.
[0069] The beneficial effects of the above-described technical solution of the present invention are as follows:
[0070] In the cloth simulation processing method of this invention, both distance field data and velocity field data are represented by grids. Each grid in the distance data field includes the nearest distance to the nearest point on the virtual human body surface; each grid in the velocity field data includes the velocity parameters of the virtual human body located within that grid. Here, a multi-layer data structure representing the dynamic human body is set up, with the same layer structure corresponding to the same grid cell size, and different layer structures corresponding to different grid cell sizes, to reflect multi-layer structure data with different resolutions. Cloth simulation processing is performed on the virtual human body according to the updated cloth simulation model to obtain the cloth simulation result. The technical solution of this invention addresses the technical problem that the current distance field construction process is highly complex and unsuitable for dynamic human bodies, resulting in poor cloth simulation effects. It updates the cloth position based on the human body's adaptive velocity field and uses the human body's adaptive distance field as a constraint condition to constrain the cloth simulation, thus obtaining the cloth simulation result. Attached Figure Description
[0071] Figure 1 This is a flowchart illustrating the fabric simulation processing method provided in an embodiment of the present invention.
[0072] Figure 2 This is one of the 2D schematic diagrams of a pyramid structure provided in an embodiment of the present invention;
[0073] Figure 3 This is a second 2D schematic diagram of a pyramid structure provided in an embodiment of the present invention;
[0074] Figure 4 This is the third 2D schematic diagram of the pyramid structure provided in the embodiments of the present invention;
[0075] Figure 5 This is a schematic diagram of the fabric simulation processing device provided in an embodiment of the present invention. Detailed Implementation
[0076] To make the technical problems, technical solutions and advantages of the present invention clearer, a detailed description will be given below in conjunction with the accompanying drawings and specific embodiments.
[0077] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of the invention. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments.
[0078] In various embodiments of the present invention, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0079] In addition, the terms "system" and "network" are often used interchangeably in this article.
[0080] In the embodiments provided in this application, it should be understood that "B corresponding to A" means that B is associated with A, and B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information.
[0081] It should be noted that the Signed Distance Field (SDF) is a way to represent surfaces in three-dimensional space. It uses the signed distance from each point on a discrete spatial grid to the surface to represent the surface. This distance is the distance from a point in space to the nearest triangular face. It is a positive value if it is outside the object and a negative value if it is inside the object. Generally, the zero-crossing face is the location of the surface being represented.
[0082] like Figure 1 As shown, an embodiment of the present invention provides a fabric simulation processing method, comprising:
[0083] Step 100: Obtain the human body mesh data corresponding to the virtual human body. The human body mesh data is a mesh cell containing the virtual human body in a plurality of preset mesh cells.
[0084] In this embodiment, the virtual human body is represented by human body mesh data. The human body mesh data obtained here includes: the center position of the mesh, the triangular facets at the mesh, the vector parameters of the mesh, etc. Here, no limitations are made.
[0085] Step 200: Based on the human body mesh data, update the distance field data and velocity field data of the multi-layer structure of the fabric simulation model to obtain the updated fabric simulation model.
[0086] The distance field data includes distance parameters from each preset grid cell to the virtual human body surface, and the velocity field data includes virtual human body movement speed parameters corresponding to each preset grid cell. In the distance field data and the velocity field data, the grid cells corresponding to the same layer structure have the same size, and the grid cells corresponding to different layer structures have different sizes.
[0087] It should be noted that the distance field data and the velocity field data are corresponding multi-layer data structures. The same layer structure corresponds to the same grid cell size, while different layer structures correspond to different grid cell sizes. A pyramid structure can be selected to represent structural data of different precision. The different grid cell sizes corresponding to different layer structures indicate that the resolution of the multi-layer data structure is different.
[0088] For example Figures 2 to 4 As shown, the distance field data or the velocity field data is a 2D schematic diagram of a three-layer pyramid. Figure 2 This is a schematic diagram of the bottom layer. Figure 4 This is a top-level diagram; each pyramid level contains a three-dimensional grid of data. Figures 2 to 4 The medium gray area represents the calculated coverage of the area near the human body surface.
[0089] In this embodiment, the distance field data and velocity field data of the multi-layer structure of the fabric simulation model are updated in real time using the human body mesh data, ensuring that the human body distance field data and human body velocity field data of the multi-layer structure adapt to the process of human body changes.
[0090] Step 300: Perform cloth simulation processing on the virtual human body according to the updated cloth simulation model to obtain cloth simulation results.
[0091] This invention addresses the technical problem that current distance field construction processes are highly complex, unsuitable for dynamic human bodies, and result in poor cloth simulation effects. Starting with a method for representing human body distance field data, it focuses on solving the complexity of constructing a distance field for each frame of a dynamic human body. Furthermore, it introduces the concept of human body velocity field data to accelerate the processing speed of human body collisions. This invention also provides a pyramid structure for multi-layered distance field data and multi-layered velocity field data to represent dynamic human body collisions, further improving the accuracy of data processing.
[0092] Optionally, updating the distance field data of the multi-layer structure of the fabric simulation model in step 200 includes:
[0093] Step 210: For each layer of structure, determine multiple target mesh units corresponding to each triangular facet; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets;
[0094] Step 220: For each triangular facet, determine the minimum distance between the center of the target mesh cell and the triangular facet.
[0095] Step 230: For each layer of structure, update the distance parameter corresponding to the target grid cell in the distance field data to the minimum distance.
[0096] In this embodiment, by determining the minimum distance between the center of the target mesh unit and the triangular facet, the latest distance between the triangular facet corresponding to the human body mesh data and the center of the target mesh at time t can be obtained. The distance parameter corresponding to the target mesh unit in the distance field data is then updated to the minimum distance, completing the data update for each layer of the structure. This allows for the elimination of unnecessary calculations for non-target mesh units that are too far from each triangular facet, as these units will not participate in collisions during the simulation. Thus, the computational load for each triangular facet is limited, effectively ensuring real-time performance. This invention utilizes low computational complexity to progressively update each layer of the structure by using the minimum distance between the center of the target mesh unit and the triangular facet, ensuring both the coverage of the distance field and the accuracy of the distance field near the human body surface.
[0097] Here, it is preferable to use the "atomicmin" function in the default standard library of CUDA (Unified Computing Device Architecture) to find the minimum value in the matrix.
[0098] Specifically, through Formula 1: Determine the minimum distance between the center of the target mesh cell and the triangular facet; where, o ijk Indicates the center of the target mesh cell. This represents the point on the triangular facet that is closest to the center of the target mesh cell.
[0099] Specifically, the aforementioned Formula 2 is used to determine that: The superscript "3" in the summation function here represents the meaning of the three vertices of the triangular facet. k + = mod(k+1,3), k - = mod(k+2,3); The superscript "3" in the summation function here represents the meaning of the three vertices of the triangular facet; where k takes the value 0, 1, or 2.
[0100] It should be noted that mod() is the modulo function; the center point of each cell is denoted as . p min This indicates the origin position in the human body grid data. These represent k=0 and k=1, respectively. The value of It can also represent the three-dimensional coordinates of the three vertices of a triangular facet. It should be noted that the three dimensions of the three-dimensional space are represented by the x, y, and z three-dimensional coordinate axes. The position of any point in the three-dimensional space is represented by three-dimensional coordinates. The size of the mesh cell in each layer is a real number ε.
[0101] Optionally, updating the velocity field data of the multi-layer structure of the fabric simulation model in step 200 includes:
[0102] Step 240: For each layer of structure, determine multiple target mesh units corresponding to each triangular facet; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets;
[0103] Step 250: For each triangular facet, determine the movement speed of each target mesh cell corresponding to the triangular facet based on the movement speed of the triangular facet.
[0104] Step 260: For each layer of structure, update the human movement speed parameters corresponding to the target grid cell in the velocity field data according to the movement speed of the target grid cell.
[0105] In this embodiment, steps 240 to 250 are similar to steps 210 to 230, except that here it is necessary to determine the moving speed of each target mesh unit corresponding to the triangular facet, and update the human body moving speed parameters corresponding to the target mesh units in the velocity field data. That is, for each triangular facet of the human body mesh data, the moving speed of the triangular facet is determined using a graphics processing unit (GPU), and the human body moving speed parameters of the corresponding target mesh unit can also be determined to complete the corresponding update. Here, the update can be to update the resultant velocity of the velocity field mesh units to obtain the updated human body adaptive velocity field data.
[0106] Optionally, step 250 includes:
[0107] Step 251: For each layer of structure, determine the minimum distance between each triangular facet and the multiple target mesh units corresponding to the triangular facet;
[0108] Step 252: For each target grid cell, determine the weight value corresponding to the target grid cell based on the minimum distance corresponding to the target grid cell;
[0109] Step 253: For each triangular facet, determine the movement speed of the multiple target mesh units corresponding to the triangular facet based on the movement speed of the triangular facet and the weight value.
[0110] In this embodiment, in step 251, formula three can be used: Determine the minimum distance between each triangular facet and the corresponding plurality of target mesh cells, wherein, The calculation method is the same as in Formula 1 above, and will not be elaborated here. ijk Indicates the center of the target mesh cell. p min This represents the origin position in the human body grid data, and the size of each grid cell in the structure is a real number ε.
[0111] Specifically, in step 253, the human body movement speed parameter includes the movement speed of the target grid cell. and the preset weights of the target mesh cells By pre-setting weights The resultant velocity of the target mesh element is calculated using a weighted summation method. This can be achieved through formula four: Formula 4 is expressed as the velocity field data before the update + Update. The weighting coefficient w is the weighting value in step 252.
[0112] Among them, the The weighting coefficient w in the formula is obtained through formula five: The formula in Formula 5 represents e raised to the power of x. The principle behind this step is to obtain the distance to each cell. Increase and decrease The weight coefficients w are calculated, and then a weighted sum is calculated, while also recording the sum of the weights for later averaging. Since the operation is performed on all triangle faces in parallel, each triangle face may access the same cell simultaneously, so the CUDA atomic operation preset function ("atomicAdd" function) can be called during the accumulation.
[0113] Optionally, step 260 includes:
[0114] For each layer of structure, the human movement speed parameter corresponding to the target grid cell in the distance field data is updated to the movement speed corresponding to the target grid cell and the weight value.
[0115] It should be noted that the resultant velocity and the total weight V have already been determined in the above calculation of the resultant velocity. (l) (i,j,k)=(v [t] ,w [t] The cumulative calculation has been completed; we only need to calculate and assign values to each cell in parallel. This can effectively obtain a relatively smooth average velocity field, which is convenient for subsequent use.
[0116] Optionally, updating the velocity field data of the fabric simulation model also includes:
[0117] For grid cells in the velocity field data that have not been updated, determine the average velocity of multiple adjacent grid cells of that grid cell;
[0118] The target velocity is obtained by performing thermal diffusion iteration processing based on the average velocity.
[0119] Based on the target velocity, the human movement velocity parameters of the unupdated grid cells in the velocity field data are updated.
[0120] In this embodiment, thermal diffusion iteration is performed on the top-level velocity field data, i.e., on the velocity field spatial grid at the top of the pyramid. The steps are as follows: for the top-level grid cell V in the velocity field data... (L-1) Since the average velocity values of the grid cells near the human body surface have already been calculated, and the average velocity field is smooth and suitable for the thermal diffusion equation, the next step is simply to perform thermal diffusion iteration to update the uncalculated velocity values using the already calculated velocity values.
[0121] Specifically, for the unupdated grid cells in the velocity field data, the average velocity of the multiple adjacent grid cells of the grid cell is determined. Here, it is preferable to use the average velocity value of the six adjacent grid cells in the three-dimensional space to update its own velocity value.
[0122]
[0123] Where, δ i ,δ j ,δ k ∈{(±1,0,0),(0,±1,0),(0,0,±1)}
[0124] This process can be iterated 10 to 100 times. Because V (L-1) At the top of the pyramid, the resolution is very low, and the computational cost required for this iteration is minimal.
[0125] In physical simulation of human collision calculations, the closer the distance to the human body surface, the higher the accuracy requirement, and vice versa. Through such adaptive calculation, this invention can ensure both the coverage of the distance field and the accuracy of the distance field near the human body surface with low computational complexity.
[0126] Optionally, before step 250, the method further includes:
[0127] For each triangular facet, calculate the position of the triangular facet at time i and the offset of its position at time i+1.
[0128] The moving speed of the triangular facet is determined based on the offset and the time difference between the i-th time and the (i+1)-th time, where i is a positive integer.
[0129] It is understandable that time i is represented as t - The time interval, i+1, is denoted as time t, and the time difference can be expressed as tt. - The offset can be expressed as the center point of the triangular facet at time t. With the t - The center point of the triangular facet at time The difference is used to determine the moving speed of the triangular facet, specifically expressed as: the moving speed of the triangular facet.
[0130] Specifically, t - The time point 't' can represent the time point of the previous frame in the physical simulation, and the time point 't' can represent the time point of the current frame in the physical simulation.
[0131] Optionally, step 210 or step 240 includes:
[0132] Step 270: For each layer of structure, determine the first grid cell where each triangular facet is located;
[0133] Step 280: The first grid cell and a plurality of second grid cells adjacent to the first grid cell are determined as the plurality of target grid cells.
[0134] In this embodiment, during the calculation process, each triangular facet updates multiple neighboring cells in parallel. Therefore, for each layer of structure, the first grid cell where each triangular facet is located and multiple second grid cells adjacent to the first grid cell are determined. In this way, the amount of computation for each triangular facet is limited, which can effectively ensure real-time performance.
[0135] Specifically, each first grid cell updates multiple neighboring second grid cells in parallel. To handle parallel conflicts, this invention utilizes the "atomicmin" function from the CUDA (Unified Computing Device Architecture) standard library to find the minimum value in the matrix. The first grid cell and the second grid cell are adjacent by a first threshold h. All grid cells between the first grid cell and the second grid cell can be represented as:
[0136]
[0137] Among them, D (l) = (i,j,k) represents the grid cell between the first grid cell and the second grid cell. These represent the coordinate positions of the first grid cell.
[0138] Here, h=5 is preferred because mesh elements that are too far from the triangular facet do not require extra calculations; since cloth facets that are too far from the body surface will not participate in collisions during the simulation; thus, the computational load for each triangular facet is limited, which can effectively ensure real-time performance.
[0139] Optionally, step 270 includes:
[0140] Step 271: For each layer of structure, determine the origin position in the human body mesh data;
[0141] Step 272: For each triangular facet, determine the first grid cell in which the triangular facet is located based on the vertex position of the triangular facet, the origin position, and the size of the grid cell of each layer.
[0142] In this embodiment, for each layer, the center position of the triangular facet is determined based on its vertex position. For each triangular facet, the distance between its center position and the origin position is determined. Then, based on the grid cell size of each layer, the first grid cell containing the triangular facet is determined. This first grid cell is the specific location of each triangular facet within each layer. By determining the specific location of the triangular facets, this invention provides data assurance for subsequent calculations.
[0143] Optionally, step 272 includes:
[0144] The center position of the triangular facet is determined based on the vertex positions of the triangular facet.
[0145] In this embodiment, each triangular facet is represented as follows: Among them, the These represent the positions of each vertex of the triangular facet, and the center position of the triangular facet is represented as...
[0146] Calculate the difference between the center position of the triangular facet and the origin position;
[0147] Here, the origin position is... The difference is expressed as
[0148] The first grid cell containing the triangular facet is determined based on the ratio of the difference to the size of the grid cell in each layer of the structure.
[0149] In this embodiment, the size of the grid cell in each layer of the structure is determined to be a real number ε, where ε is a preset value. The formula for determining the first grid cell where the triangular facet is located is expressed as: This invention determines the first grid cell where the triangular facet is located based on a specific formula, thereby improving the accuracy of data processing.
[0150] It should be understood that the reason why the construction of the distance field in the existing technology is so complex is that, in order to express the accuracy, the distance field needs to use a high voxel resolution: for example, for a human body bounding box with a length, width and height of 1 meter, if the accuracy is to be 1 mm, the distance field voxel resolution needs to be 1000x1000x1000. Estimating the distance field at such a high resolution requires a very large amount of computation.
[0151] Optionally, step 271 includes:
[0152] Step 2711: For each layer of structure, obtain the vertex position of each grid cell in the human body grid data in the three-dimensional direction;
[0153] It should be noted that the three-dimensional directions refer to the three dimensions of three-dimensional space, represented here by the x, y, and z three-dimensional coordinate axes. In this embodiment, the virtual human body is determined from predetermined human body animation data. The predetermined human body animation data refers to human body animation data that is usually directly specified by the application, such as frame sequence animation.
[0154] Step 2712: For each dimension, determine the minimum value among the vertex positions;
[0155] Step 2713: Determine the origin position based on the minimum value among the vertex positions in the three-dimensional direction.
[0156] In this embodiment, the set of each dimension at time t, i.e., each coordinate axis in the x, y, and z axes, is obtained, i.e., {x [t]},{y [t]},{z [t]}, iterate through the elements of each set, determine the minimum value among the vertex positions, that is, the minimum value among the vertex positions in each three-dimensional direction of each layer, and determine the origin position p. min =(x min y min , z min This invention utilizes a graphics processing unit (GPU) to call the preset function "thrust::min_element()" in the preset standard library of CUDA (Unified Computing Device Architecture) to calculate the origin position in parallel, thereby updating the origin position of the human body mesh data.
[0157] Optionally, step 300 includes:
[0158] Step 310: Update the fabric data according to the velocity field data of the updated fabric simulation model to obtain the updated fabric data;
[0159] Step 320: Perform fabric simulation processing based on the distance field data of the updated fabric simulation model and the updated fabric data to obtain the fabric simulation results.
[0160] In this embodiment, step 310 determines that the fabric position is updated based on the human body adaptive velocity field data (the velocity field data of the updated fabric simulation model), and step 320 uses the human body adaptive distance field (the distance field data of the updated fabric simulation model) as a constraint condition to constrain the fabric simulation and obtain the fabric simulation result.
[0161] Optionally, step 310 includes:
[0162] Step 311: Calculate the product of the first time difference and the human movement speed parameter in the velocity field data of the fabric simulation model at time i; wherein, the first time difference is the time difference between time i+1 and time i, and i is a positive integer;
[0163] Step 312: Update the fabric data based on the sum of the product and the first simulation result output by the fabric simulation model at the i-th time, to obtain the updated fabric data.
[0164] It is understandable that time i is represented as t - The time interval, i+1, is denoted as time t, and the time difference can be expressed as tt. - The human movement velocity parameter in the velocity field data of the fabric simulation model at time i is represented as v. [t] The first simulation result output by the fabric simulation model at time i is represented as p. [t-] According to formula six: p [t] ←p [t-] +(tt - )*v [t] This yields updated fabric data.
[0165] Among them, the moving speed parameter v [t] The vertex is determined by querying velocity field data. Values are taken from the bottom of the pyramid; if the obtained value is the initial value, the process continues upwards along the pyramid until the top layer is reached or a non-initialized value is obtained. Each grid layer index is as follows: The real number ε represents the size of the grid cell in each layer of the structure.
[0166] It should be noted that the previous time position p [t-] , refers to the output after the calculation is completed at time i of the cloth simulation. This step uses the velocity field to update this position, with the aim of providing a better initial value for the simulation at time i+1 (the current time) and improving calculation efficiency.
[0167] Optionally, before step 200, the distance field data and velocity field data of the multi-layer structure are initialized, and after the initialization is completed, step 200 is performed.
[0168] The values of all grid cells in the initialized range field data refer to all values for 0 ≤ l < L. Let the distance field data D (l) (i,j,k)=|d box |,d box =(x box ,y box ,z boxThe bounding box size represents the length, width, and height of the virtual human body; the purpose of this is to initialize it with a maximum distance value so that the minimum value can be updated later.
[0169] The values of all grid cells in the initial velocity field data refer to all values for 0 ≤ l < L. Let the velocity field data V (l) (i,j,k)=(0,0); Zero initialization is used to facilitate the subsequent accumulation and averaging.
[0170] Optionally, step 320 includes:
[0171] Step 321: Determine the target maximum value in the vector concatenation of the target value and the distance of each grid vertex of the fabric from the human body distance field data of the updated fabric simulation model;
[0172] Specifically, the distance field data values of each grid vertex of the fabric from the updated fabric simulation model to the human body include:
[0173] The data is taken from the bottom layer to the top layer of the updated fabric simulation model's human distance field data, and the process continues until a non-initialized value is obtained or until the top layer of the updated fabric simulation model is reached.
[0174] In this embodiment, the target maximum value is represented as max(0, β-D(p)), the target value is 0, and the vector concatenation of the distance field data values of each grid vertex of the fabric from the updated fabric simulation model is represented as β-D(p), where β = 10*ε, and the real number ε represents the size of the grid cell in each layer; D(p) = (D(p0), D(p1), ...) is the vector concatenation of the distance field data values of all fabric vertices from the updated fabric simulation model; D(p i The value of ) is determined from the bottom D of the pyramid. (0) (p i If an invalid value (i.e., the initial value) is obtained, the process continues to retrieve values upwards along the pyramid until the top of the pyramid is reached or a valid value is obtained.
[0175] Step 322: The human collision distance field constraint force is determined by multiplying the target maximum value, the preset weight value, and the normal vector of the human distance field data of the updated fabric simulation model.
[0176] In this embodiment, the human collision distance field constraint force F(p) = λmax(0, β-D(p))N(p). Where λ = 100, and λ is a preset weight value; the normal vector N(p) of the human distance field data in the updated fabric simulation model is expressed as:
[0177] Here, σ is the normal vector of the human distance field data in the updated fabric simulation model where the fabric is located. x =(ε,0,0),σ y = (0, ε, 0), σ z = (0, 0, ε).
[0178] Step 323: Based on the human body collision distance field constraint force, the distance field data of the updated fabric simulation model, and the preset elastic material system, determine the target elastic material system;
[0179] In this embodiment, the calculation formula for the target elastic material system is expressed as follows:
[0180]
[0181] Except for the parameters of F(p), all others are determined by a preset elastic material system. Here, h = tt - M is the time step; M is the mass matrix. W(p) describes the internal forces between fabric particles and is a common calculation process in existing fabric simulation systems.
[0182] Step 324: Input the updated fabric data into the target elastic material system to obtain the fabric simulation results.
[0183] In this embodiment, the updated fabric data is input into the target elastic material system to obtain fabric simulation results. This can be specifically implemented on multiple sets of human body and clothing test samples, and the results of running the fabric simulation system with human distance field constraints according to this invention are displayed. The method of this invention can effectively handle complex fabric and body collisions.
[0184] Optionally, before step 100, the method further includes:
[0185] Determine the bounding box of the human body based on the virtual human body;
[0186] In this embodiment, the size of the human body bounding box refers to the fact that since the same human body is used throughout the simulation, the overall size will not change significantly, so the size d of the bounding box can be calculated. box =(x box ,y box ,z box ), representing the length, width, and height of the virtual human body.
[0187] Based on the preset grid unit size, the human body bounding box is divided in three dimensions in a manner that increases or decreases layer by layer according to the grid unit size, resulting in multiple preset grid units corresponding to each layer of structure.
[0188] Here, the preset grid cell size is a real number ε. However, for ease of calculation, 1mm can also be used as the preset grid cell size. Specifically, the grid resolution is N. x ×N y ×N z The array length is
[0189] In one specific embodiment, the method for obtaining multiple preset grid cells corresponding to each layer of the structure is as follows: an L-layer pyramid can be used to represent distance fields with different precision. Figures 2 to 4 This is a 2D schematic diagram of a three-layer pyramid, where each layer contains a three-dimensional spatial grid. Assume the resolution of the 0th layer's spatial grid is N. x ×N y ×N z (that is, the x, y, and z directions each contain N) x N y N z The spatial grid has 1 cell (number of cells), and each cell has a scale of 1 mm; then for any 0 ≤ l < L, the resolution of the l-th layer spatial grid is... The scale of each cell is 2. l mm.
[0190] Optionally, before step 200, the following may also be included:
[0191] Based on multiple preset grid cells corresponding to each layer of structure, the initial distance field data and initial velocity field data are determined.
[0192] In the initial distance field data, the distance parameter corresponding to each grid cell is the nearest distance value between that grid cell and the virtual human body surface; the movement speed parameter corresponding to each grid cell in the initial velocity field data is zero.
[0193] In this embodiment, the initial distance field data is a spatial grid pyramid structure {D}. (l) ,p min |0≤l<L}, L=4. Each level of the pyramid contains an origin p. min With a spatial grid D (l) Where p min =(x min ,y min ,z min () is a three-dimensional vector representing the minimum value of the distance field across the three coordinate axes. It is calculated by iterating through all vertex positions of the virtual human body mesh data and then taking the minimum value along each of the three coordinate axes. (l) It is a three-dimensional array with a length of . ε (l) =ε·2l Each element D in the array (l) (i,j,k) stores a single-precision floating-point number representing the nearest distance from the cell to the human body surface. The center point of each cell is denoted as .
[0194] The initial velocity field data is similar to the human body adaptive distance field, denoted as {V (l) ,p min |0≤l<L}. Where the origin p... min Same meaning; V (l) It is also a three-dimensional array, and the array length is the same as D. (l) Same; but each cell V (l) (i,j,k)=(v,w), where v is a three-dimensional vector representing the average velocity and w is a single-precision floating-point number representing the weight, used to assist in the calculation.
[0195] The initial distance field data and initial velocity field data refer to the allocation of video memory for the virtual human body's adaptive distance field and velocity field according to the required array length.
[0196] In another specific embodiment, when both the distance field data and the velocity field data of the multi-layer structure of the fabric simulation model are set to L layers: for each layer's spatial grid, only the values of the region near the human body surface are calculated. Thus, as the cell scale increases, the coverage of the calculated region near the human body surface gradually increases. Specifically, in the velocity field data, up to the (L-1)th layer, due to the very low grid resolution, the computational load is minimal. Therefore, this invention further performs thermal diffusion iteration to calculate the values of all cells in this layer.
[0197] In physical simulation of human collision calculations, the closer the distance to the human body surface, the higher the accuracy requirement, and vice versa. This invention, through the above-mentioned adaptive calculation, can ensure both the coverage of the distance field and the accuracy of the distance field near the human body surface with lower computational complexity.
[0198] like Figure 5 As shown, embodiments of the present invention also provide a fabric simulation processing device, comprising:
[0199] The acquisition module 10 is used to acquire human body mesh data corresponding to the virtual human body, wherein the human body mesh data is a mesh unit containing the virtual human body in a plurality of preset mesh units;
[0200] The first processing module 20 is used to update the distance field data and velocity field data of the multi-layer structure of the fabric simulation model according to the human body mesh data, so as to obtain the updated fabric simulation model.
[0201] The second processing module 30 is used to perform cloth simulation processing on the virtual human body according to the updated cloth simulation model to obtain cloth simulation results.
[0202] The distance field data includes distance parameters from each preset grid cell to the virtual human body surface, and the velocity field data includes virtual human body movement speed parameters corresponding to each preset grid cell. In the distance field data and the velocity field data, the grid cells corresponding to the same layer structure have the same size, and the grid cells corresponding to different layer structures have different sizes.
[0203] Optionally, the first processing module 20 includes:
[0204] The first processing submodule is used to determine multiple target mesh units corresponding to each triangular facet for each layer of structure; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets;
[0205] The second processing submodule is used to determine the minimum distance between the center of the target mesh cell and the triangular facet for each triangular facet.
[0206] The third processing submodule is used to update the distance parameter of the target grid cell in the distance field data to the minimum distance for each layer of structure.
[0207] Optionally, the first processing module 20 further includes:
[0208] The fourth processing submodule is used to determine multiple target mesh units corresponding to each triangular facet for each layer of structure; wherein the triangular facet is obtained by dividing the human body surface of the virtual human body;
[0209] The fifth processing submodule is used to determine the movement speed of each target mesh cell corresponding to each triangular facet based on the movement speed of the triangular facet.
[0210] The sixth processing submodule is used to update the human movement speed parameters corresponding to the target grid cell in the velocity field data for each layer of structure, based on the movement speed of the target grid cell.
[0211] Optionally, the device further includes:
[0212] The first calculation module is used to calculate the position of each triangular facet at time i and the offset of its position at time i+1 for each triangular facet.
[0213] The first determining module is used to determine the moving speed of the triangular facet based on the offset and the time difference between the i-th time and the (i+1)-th time, where i is a positive integer.
[0214] Optionally, the fifth processing submodule includes:
[0215] The first determining unit is used to determine, for each layer of structure, the minimum distance between each triangular facet and the multiple target mesh units corresponding to the triangular facet;
[0216] The second determining unit is used to determine the weight value corresponding to each target grid cell based on the minimum distance corresponding to the target grid cell.
[0217] The third determining unit is used to determine the movement speed of multiple target mesh units corresponding to each triangular facet based on the movement speed of the triangular facet and the weight value.
[0218] Optionally, the sixth processing submodule includes:
[0219] The first update unit is used to update the human movement speed parameter corresponding to the target grid cell in the distance field data for each layer of structure to the movement speed corresponding to the target grid cell and the weight value.
[0220] Optionally, the first processing submodule or the fourth processing submodule includes:
[0221] The fourth determining unit is used to determine the first grid unit where each triangular facet is located for each layer of structure;
[0222] The fifth determining unit is used to determine the first grid cell and a plurality of second grid cells adjacent to the first grid cell as the plurality of target grid cells.
[0223] Optionally, the fourth determining unit includes:
[0224] The first determining subunit is used to determine the origin position in the human body mesh data for each layer of structure;
[0225] The second determining subunit is used to determine the first grid cell in which each triangular facet is located, based on the vertex position of the triangular facet, the origin position, and the size of the grid cell of each layer.
[0226] Optionally, the first determining subunit is specifically used for:
[0227] For each layer of structure, the vertex position of each grid cell in the human body mesh data in the three-dimensional direction is obtained;
[0228] For each dimension, determine the minimum value at each vertex position;
[0229] The origin position is determined based on the minimum value among the vertex positions in the three-dimensional direction.
[0230] Optionally, the second determining subunit is specifically used for:
[0231] The center position of the triangular facet is determined based on the vertex positions of the triangular facet.
[0232] Calculate the difference between the center position of the triangular facet and the origin position;
[0233] The first grid cell containing the triangular facet is determined based on the ratio of the difference to the size of the grid cell in each layer of the structure.
[0234] Optionally, the first processing module 20 further includes:
[0235] The first determining submodule is used to determine the average velocity of multiple adjacent grid cells for grid cells that have not been updated in the velocity field data.
[0236] The first submodule is used to perform thermal diffusion iteration processing based on the average velocity to obtain the target velocity;
[0237] The update submodule is used to update the human movement speed parameters of the unupdated grid cells in the velocity field data according to the target speed.
[0238] Optionally, the second processing module includes:
[0239] The second submodule is used to update the fabric data based on the velocity field data of the updated fabric simulation model to obtain the updated fabric data.
[0240] The third submodule is used to perform fabric simulation processing based on the distance field data of the updated fabric simulation model and the updated fabric data to obtain fabric simulation results.
[0241] Optionally, the second sub-module includes:
[0242] The calculation unit is used to calculate the product of the first time difference and the human movement speed parameter in the velocity field data of the fabric simulation model at time i; wherein, the first time difference is the time difference between time i+1 and time i, and i is a positive integer;
[0243] The unit is used to update the fabric data based on the sum of the product and the first simulation result output by the fabric simulation model at the i-th time, so as to obtain the updated fabric data.
[0244] Optionally, the third sub-module includes:
[0245] The sixth determining unit is used to determine the target maximum value in the vector concatenation of the target value and the distance of each grid vertex of the fabric from the human body distance field data of the updated fabric simulation model;
[0246] The seventh determining unit is used to determine the human collision distance field constraint force by multiplying the target maximum value, the preset weight value, and the normal vector of the human distance field data of the updated fabric simulation model.
[0247] The eighth determining unit is used to determine the target elastic material system based on the human body collision distance field constraint force, the distance field data of the updated fabric simulation model, and the preset elastic material system.
[0248] The updated fabric data is input into the target elastic material system to obtain fabric simulation results.
[0249] Optionally, the device further includes:
[0250] The second determining module is used to determine the bounding box of the human body based on the virtual human body;
[0251] The module is used to divide the human body bounding box in three dimensions based on a preset grid unit size, in a manner that increases or decreases the grid unit size layer by layer, to obtain multiple preset grid units corresponding to each layer of structure.
[0252] Optionally, the device further includes:
[0253] The third determination module is used to determine the initial distance field data and the initial velocity field data based on multiple preset grid cells corresponding to each layer of structure.
[0254] In the initial distance field data, the distance parameter corresponding to each grid cell is the nearest distance value between that grid cell and the virtual human body surface; the movement speed parameter corresponding to each grid cell in the initial velocity field data is zero.
[0255] It should be noted that the distance field data between each grid vertex of the fabric and the updated fabric simulation model includes:
[0256] The data is taken from the bottom layer to the top layer of the updated fabric simulation model's human distance field data, and the process continues until a non-initialized value is obtained or until the top layer of the updated fabric simulation model is reached.
[0257] An embodiment of the present invention provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the steps in the fabric simulation processing method described above and achieve the same technical effect. To avoid repetition, further details are omitted here.
[0258] The processor mentioned above is the processor used in the fabric simulation processing method described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0259] In this embodiment of the invention, the module can be implemented in software so that it can be executed by various types of processors. For example, an identified executable code module may include one or more physical or logical blocks of computer instructions, which may be constructed as objects, procedures, or functions. Nevertheless, the executable code of the identified module does not need to be physically located together, but may include different instructions stored in different bits, which, when logically combined, constitute the module and achieve the module's intended purpose.
[0260] In practice, an executable code module can be a single instruction or many instructions, and can even be distributed across multiple different code segments, different programs, and across multiple memory devices. Similarly, operational data can be identified within the module and can be implemented in any suitable form and organized within any suitable type of data structure. This operational data can be collected as a single dataset or distributed across different locations (including different storage devices), and can exist, at least in part, solely as electronic signals within the system or network.
[0261] When a module can be implemented using software, considering the current level of hardware technology, modules that can be implemented in software can be implemented using hardware circuits by those skilled in the art to achieve the corresponding functions, without considering cost. These hardware circuits include conventional very-large-scale integrated circuits (VLSI) or gate arrays, as well as existing semiconductors such as logic chips and transistors, or other discrete components. Modules can also be implemented using programmable hardware devices, such as field-programmable gate arrays, programmable array logic, and programmable logic devices.
[0262] The exemplary embodiments described above are with reference to the accompanying drawings. Many different forms and embodiments are feasible without departing from the spirit and teachings of the invention. Therefore, the invention should not be construed as limiting the exemplary embodiments set forth herein. Rather, these exemplary embodiments are provided to make the invention complete and convey the scope of the invention to those skilled in the art. In these drawings, component dimensions and relative dimensions may be exaggerated for clarity. The terminology used herein is for the purpose of describing particular exemplary embodiments only and is not intended to be limiting. As used herein, unless clearly indicated otherwise, the singular forms “a,” “an,” and “the” are intended to include all such forms. It will be further understood that the terms “comprising” and / or “including”, when used in this specification, indicate the presence of the stated features, integers, steps, operations, components, and / or elements, but do not exclude the presence or addition of one or more other features, integers, steps, operations, components, and / or groups thereof. Unless otherwise indicated, when stated, a range of values includes the upper and lower limits of the range and any subranges in between.
[0263] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A fabric simulation processing method, characterized in that, include: Obtain the human body mesh data corresponding to the virtual human body, wherein the human body mesh data is a mesh cell containing the virtual human body in multiple preset mesh cells; Based on the human body mesh data, the distance field data and velocity field data of the multi-layer structure of the fabric simulation model are updated to obtain the updated fabric simulation model. The virtual human body is subjected to cloth simulation processing based on the updated cloth simulation model to obtain cloth simulation results. The distance field data includes distance parameters from each preset grid cell to the virtual human body surface, and the velocity field data includes virtual human body movement velocity parameters corresponding to each preset grid cell; in the distance field data and the velocity field data, the grid cells corresponding to the same layer structure have the same size, and the grid cells corresponding to different layer structures have different sizes; Specifically, based on the human body mesh data, the velocity field data of the multi-layer structure of the fabric simulation model is updated, including: For each layer of structure, multiple target mesh units corresponding to each triangular facet are determined, including: for each layer of structure, determining the first mesh unit where each triangular facet is located; and determining the first mesh unit and multiple second mesh units adjacent to the first mesh unit as the multiple target mesh units; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets; For each triangular facet, the movement speed of each target mesh cell corresponding to the triangular facet is determined based on the movement speed of the triangular facet. For each layer of structure, the human movement speed parameters corresponding to the target grid cell in the velocity field data are updated according to the movement speed of the target grid cell.
2. The method according to claim 1, characterized in that, Based on the human body mesh data, the distance field data of the multi-layer structure of the fabric simulation model is updated, including: For each layer of structure, multiple target mesh units corresponding to each triangular facet are determined, including: for each layer of structure, determining the first mesh unit where each triangular facet is located; and determining the first mesh unit and multiple second mesh units adjacent to the first mesh unit as the multiple target mesh units; wherein, the triangular facet is obtained by dividing the human body surface of the virtual human body into triangular facets; For each triangular facet, determine the minimum distance between the center of the target mesh cell and the triangular facet. For each layer of structure, the distance parameter corresponding to the target grid cell in the distance field data is updated to the minimum distance.
3. The method according to claim 1, characterized in that, Before determining the moving speed of each target mesh cell corresponding to the triangular facet based on its moving speed, the method further includes: For each triangular facet, calculate the position of the triangular facet at time i and the offset of its position at time i+1. The moving speed of the triangular facet is determined based on the offset and the time difference between the i-th time and the (i+1)-th time, where i is a positive integer.
4. The method according to claim 1, characterized in that, For each triangular facet, the moving speed of each target mesh cell corresponding to the triangular facet is determined based on the moving speed of the triangular facet, including: For each layer of structure, determine the minimum distance between each triangular facet and the multiple target mesh cells corresponding to the triangular facet; For each target grid cell, a weight value corresponding to the target grid cell is determined based on the minimum distance corresponding to the target grid cell; For each triangular facet, the movement speed of the multiple target mesh cells corresponding to the triangular facet is determined based on the movement speed of the triangular facet and the weight value.
5. The method according to claim 4, characterized in that, Updating the human movement velocity parameters corresponding to the target grid cell in the velocity field data includes: For each layer of structure, the human movement speed parameter corresponding to the target grid cell in the distance field data is updated to the movement speed corresponding to the target grid cell and the weight value.
6. The method according to claim 1 or 2, characterized in that, For each layer of structure, the first mesh cell containing each triangular facet is determined, including: For each layer of structure, determine the origin position in the human body mesh data; For each triangular facet, the first grid cell in which the triangular facet is located is determined based on the vertex position of the triangular facet, the origin position, and the size of the grid cell of each layer.
7. The method according to claim 6, characterized in that, The step of determining the origin position in the human body mesh data for each layer of structure includes: For each layer of structure, the vertex position of each grid cell in the human body mesh data in the three-dimensional direction is obtained; For each dimension, determine the minimum value at each vertex position; The origin position is determined based on the minimum value among the vertex positions in the three-dimensional direction.
8. The method according to claim 6, characterized in that, For each triangular facet, the first mesh cell containing the triangular facet is determined based on the vertex position of the triangular facet, the origin position, and the mesh cell size of each layer, including: The center position of the triangular facet is determined based on the vertex positions of the triangular facet. Calculate the difference between the center position of the triangular facet and the origin position; The first grid cell containing the triangular facet is determined based on the ratio of the difference to the size of the grid cell in each layer of the structure.
9. The method according to claim 1, characterized in that, Updating the velocity field data of the fabric simulation model also includes: For grid cells in the velocity field data that have not been updated, determine the average velocity of multiple adjacent grid cells of that grid cell; The target velocity is obtained by performing thermal diffusion iteration processing based on the average velocity. Based on the target velocity, the human movement velocity parameters of the unupdated grid cells in the velocity field data are updated.
10. The method according to claim 1, characterized in that, The step of performing cloth simulation processing on the virtual human body based on the updated cloth simulation model to obtain cloth simulation results includes: The fabric data is updated based on the velocity field data of the updated fabric simulation model to obtain the updated fabric data. Based on the distance field data of the updated fabric simulation model and the updated fabric data, fabric simulation processing is performed to obtain fabric simulation results.
11. The method according to claim 10, characterized in that, The fabric data is updated based on the velocity field data of the updated fabric simulation model to obtain the updated fabric data, including: Calculate the product of the first time difference and the human movement velocity parameter in the velocity field data of the fabric simulation model at time i; where the first time difference is the time difference between time i+1 and time i, and i is a positive integer; The fabric data is updated based on the sum of the product and the first simulation result output by the fabric simulation model at the i-th time, resulting in updated fabric data.
12. The method according to claim 10, characterized in that, Based on the distance field data of the updated fabric simulation model and the updated fabric data, fabric simulation processing is performed to obtain fabric simulation results, including: Determine the target maximum value in the vector concatenation of the target value and the distance of each grid vertex of the fabric from the human distance field data of the updated fabric simulation model; The human collision distance field constraint force is determined by multiplying the target maximum value, the preset weight value, and the normal vector of the human distance field data of the updated fabric simulation model. Based on the human body collision distance field constraint force, the distance field data of the updated fabric simulation model, and the preset elastic material system, the target elastic material system is determined. The updated fabric data is input into the target elastic material system to obtain fabric simulation results.
13. The method according to claim 1, characterized in that, Before obtaining the human body mesh data corresponding to the virtual human body, the process also includes: Determine the bounding box of the human body based on the virtual human body; Based on the preset grid unit size, the human body bounding box is divided in three dimensions in a manner that increases or decreases layer by layer according to the grid unit size, resulting in multiple preset grid units corresponding to each layer of structure.
14. The method according to claim 13, characterized in that, Before updating the distance field data and velocity field data of the multi-layer structure of the fabric simulation model based on the human body mesh data, the process also includes: Based on multiple preset grid cells corresponding to each layer of structure, the initial distance field data and initial velocity field data are determined. In the initial distance field data, the distance parameter corresponding to each grid cell is the nearest distance value between that grid cell and the virtual human body surface; the movement speed parameter corresponding to each grid cell in the initial velocity field data is zero.
15. The method according to claim 12, characterized in that, The distance field data values of each grid vertex of the fabric from the updated fabric simulation model to the human body include: The data is taken from the bottom layer to the top layer of the updated fabric simulation model's human distance field data, and the process continues until a non-initialized value is obtained or until the top layer of the updated fabric simulation model is reached.
16. A fabric simulation processing device, characterized in that, include: The acquisition module is used to acquire human body mesh data corresponding to the virtual human body, wherein the human body mesh data is a mesh cell containing the virtual human body in a plurality of preset mesh cells; The first processing module is used to update the distance field data and velocity field data of the multi-layer structure of the fabric simulation model according to the human body mesh data, so as to obtain the updated fabric simulation model. The second processing module is used to perform cloth simulation processing on the virtual human body according to the updated cloth simulation model to obtain the cloth simulation result. The distance field data includes distance parameters from each preset grid cell to the virtual human body surface, and the velocity field data includes virtual human body movement velocity parameters corresponding to each preset grid cell; in the distance field data and the velocity field data, the grid cells corresponding to the same layer structure have the same size, and the grid cells corresponding to different layer structures have different sizes; The first processing module further includes: The fourth processing submodule is used to determine multiple target mesh units corresponding to each triangular facet for each layer of structure; wherein, the triangular facet is obtained by dividing the surface of the virtual human body into triangular facets; wherein, the fourth processing submodule includes: a fourth determining unit, used to determine the first mesh unit where each triangular facet is located for each layer of structure; and a fifth determining unit, used to determine the first mesh unit and multiple second mesh units adjacent to the first mesh unit as the multiple target mesh units; The fifth processing submodule is used to determine the movement speed of each target mesh cell corresponding to each triangular facet based on the movement speed of the triangular facet. The sixth processing submodule is used to update the human movement speed parameters corresponding to the target grid cell in the velocity field data for each layer of structure, based on the movement speed of the target grid cell.
17. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps in the cloth simulation processing method as described in any one of claims 1 to 15.
Citation Information
Patent Citations
Particle computer dynamic simulation method for 3D garment
CN106407605A