Three-dimensional clothing simulation method, device, terminal equipment and storage medium
By configuring virtual dynamic skeletons and virtual geometric bodies for 3D clothing, building a dynamic model and performing collision detection optimization, the problem of large computational complexity in 3D clothing simulation is solved and real-time simulation effects are achieved.
Patent Information
- Application Number
- CN202210447775.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-26
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2042-04-26
AI Technical Summary
The existing 3D clothing simulation technology has a large amount of calculation and it is difficult to achieve real-time simulation on an ordinary PC.
By configuring virtual dynamic bones and virtual geometric bodies for three-dimensional clothing, building a dynamic model, training the bone position prediction model, and performing collision detection optimization, the amount of calculation is reduced.
The computational effort is reduced to the order of 10e-4 compared to the original technology, achieving real-time simulation of three-dimensional clothing that can be run on handheld devices.
Smart Images

Figure CN114742952B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer vision, and in particular to a three-dimensional clothing simulation method, device, terminal equipment and storage medium. Background Art
[0002] As society continues to develop, people's dependence on the virtual world is growing, which in turn places higher demands on the visual effects of 3D technology. In order to achieve more realistic visual effects, in the specific technical implementation, the clothing of virtual dolls should be as close to that in the real world as possible, showing different visual effects in different situations. Therefore, 3D clothing simulation technology is very meaningful.
[0003] Current mainstream clothing simulation technologies are primarily implemented through two approaches: animator-generated and physics-based clothing dynamics models. However, as the quality of 3D clothing continues to improve, simulating clothing using animator-generated models requires significant time and computational effort. Furthermore, physics-based clothing dynamics models require tens of thousands or even hundreds of thousands of 3D vertices and facets to be calculated for a typical 3D figure, a computational burden that is difficult for a typical PC to handle. In summary, both approaches, using animator-generated and physics-based clothing dynamics models, present the problem of excessive computational effort.
[0004] Therefore, it is necessary to propose a three-dimensional clothing simulation technology solution that can effectively reduce the amount of calculation. Summary of the Invention
[0005] The main purpose of this application is to provide a three-dimensional clothing simulation method, apparatus, terminal device and storage medium, aiming to solve the problem of large computational complexity in existing three-dimensional clothing simulation technology.
[0006] To achieve the above object, the present invention provides a three-dimensional clothing simulation method, which includes:
[0007] Configure virtual dynamic bones for 3D clothing;
[0008] Configure virtual geometry for the virtual puppet;
[0009] Constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body;
[0010] Based on the parameters of the dynamic model, a skeleton position prediction model is trained;
[0011] Predicting the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton;
[0012] Based on the dynamic model, collision detection optimization is performed on the predicted position to obtain a simulation result.
[0013] Optionally, the steps of configuring a virtual dynamic skeleton for the three-dimensional garment and configuring a virtual geometric body for the virtual puppet include:
[0014] The steps of configuring a virtual dynamic skeleton for a three-dimensional garment include:
[0015] Obtaining the structural features of three-dimensional clothing;
[0016] Designing the structure of the virtual dynamic skeleton based on the structural characteristics of the three-dimensional clothing;
[0017] Setting weight information of the virtual dynamic skeleton based on the structure of the virtual dynamic skeleton;
[0018] Brushing the weight information into the structure of the virtual dynamic skeleton to obtain the virtual dynamic skeleton;
[0019] The step of configuring a virtual geometric body for the virtual puppet includes:
[0020] Obtaining a human body model of the virtual doll;
[0021] Extracting features of the limbs of the virtual doll that collide with the three-dimensional clothing based on the human body model of the virtual doll;
[0022] Based on the features of the limb part, a corresponding geometric body is selected as the virtual geometric body.
[0023] Optionally, the step of constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body includes:
[0024] Configuring information of each bone in the virtual dynamic skeleton, the bone information including: one or more of bone name, layer number, parent-child node, sibling node, weight, and elastic coefficient;
[0025] Configuring information of the virtual geometric body, wherein the information of the virtual geometric body includes one or more of the following: a name of the virtual geometric body, a position relative to a human body, and physical properties;
[0026] Based on the information of the skeleton and the information of the virtual geometric body, a dynamic model between the virtual dynamic skeleton and the virtual geometric body is constructed.
[0027] Optionally, the step of training a skeleton position prediction model based on the parameters of the dynamic model includes:
[0028] Create an initial neural network;
[0029] The initial neural network is trained using the parameters of the dynamic model, and the initial neural network learns the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body using the parameters of the dynamic model;
[0030] After completing the training, the skeleton position prediction model is obtained.
[0031] Optionally, the step of predicting the virtual dynamic skeleton using the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton includes:
[0032] Acquiring position information of the virtual dynamic skeleton and the virtual geometric body in a human body coordinate system;
[0033] Acquiring physical property information of the virtual geometric body;
[0034] The position information and physical property information are input into the bone position prediction model for prediction to obtain the predicted position of the dynamic bone.
[0035] Optionally, the step of performing collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result includes:
[0036] Based on the predicted position, calculating a positional relationship between the virtual geometric body and the predicted position;
[0037] Based on the dynamic model, collision detection is performed on the position relationship, and the following judgment processing is performed:
[0038] If the position relationship satisfies the collision detection, the predicted position of the virtual dynamic skeleton is used as the simulation result;
[0039] If the position relationship does not satisfy the collision detection, the predicted position of the virtual dynamic skeleton is corrected to obtain the simulation result.
[0040] Optionally, if the position relationship does not satisfy the collision detection, the predicted position of the virtual dynamic skeleton is corrected to obtain the simulation result, which includes:
[0041] calculating a correction direction of the predicted position based on the dynamic model;
[0042] calculating a corrected length of the predicted position based on the dynamic model;
[0043] The predicted position of the dynamic skeleton is corrected according to the correction direction and the correction length to obtain the simulation result.
[0044] The present application also provides a clothing simulation device, which includes:
[0045] Virtual dynamic skeleton configuration module, used to configure virtual dynamic skeleton for clothing;
[0046] A virtual geometry configuration module, used for configuring virtual geometry for a virtual puppet;
[0047] A dynamic model construction module, used for constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body;
[0048] A model training module, configured to train a skeletal position prediction model based on the parameters of the dynamic model;
[0049] The prediction module is used to predict the virtual dynamic skeleton by using the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton.
[0050] The collision detection optimization module is used to perform collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result.
[0051] An embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a three-dimensional clothing simulation program stored in the memory and runnable on the processor. When the three-dimensional clothing simulation program is executed by the processor, the steps of the three-dimensional clothing simulation method described above are implemented.
[0052] An embodiment of the present application further provides a computer-readable storage medium, on which a three-dimensional clothing simulation program is stored. When the three-dimensional clothing simulation program is executed by a processor, the steps of the three-dimensional clothing simulation method described above are implemented.
[0053] The three-dimensional clothing simulation method, apparatus, terminal device and storage medium proposed in the embodiment of the present application configure a virtual dynamic skeleton for the three-dimensional clothing; configure a virtual geometric body for the virtual puppet; construct a dynamic model between the virtual dynamic skeleton and the virtual geometric body; based on the parameters of the dynamic model, train a skeleton position prediction model; predict the virtual dynamic skeleton through the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton; perform collision detection optimization on the predicted position based on the dynamic model to obtain the simulation result. Based on the solution of the present application, in order to solve the problem of high computational complexity of three-dimensional clothing simulation technology, by designing a virtual dynamic skeleton for the clothing and using virtual geometric bodies to replace the limbs that collide with the clothing, the simulation body is indirectly calculated, so that the overall computational complexity is reduced to 10e of the prior art. -4 It can be transplanted to handheld devices and achieve real-time simulation, solving the problem of large computational load in existing clothing simulation technology. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 This is a schematic diagram of the functional modules of the terminal device of the three-dimensional clothing simulation device of this application;
[0055] Figure 2 This is a flow chart of a first exemplary embodiment of a three-dimensional clothing simulation method of the present application;
[0056] Figure 3 This is a flow chart of a second exemplary embodiment of the three-dimensional clothing simulation method of the present application;
[0057] Figure 4 A schematic diagram of a three-dimensional garment structure in the three-dimensional garment simulation method of this application;
[0058] Figure 5 This is a schematic diagram of a virtual dynamic bone structure in the three-dimensional clothing simulation method of this application;
[0059] Figure 6 This is a flow chart of a third exemplary embodiment of the three-dimensional clothing simulation method of the present application;
[0060] Figure 7 This is a flow chart of a fourth exemplary embodiment of the three-dimensional clothing simulation method of the present application;
[0061] Figure 8 This is a schematic diagram of a fully connected neural network in the three-dimensional clothing simulation method of this application;
[0062] Figure 9 This is a flowchart of the fifth exemplary embodiment of the three-dimensional clothing simulation method of the present application.
[0063] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0064] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0065] The main solution of the embodiment of the present application is: by configuring a virtual dynamic skeleton for the three-dimensional clothing; configuring a virtual geometric body for the virtual puppet; constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body; based on the parameters of the dynamic model, training a skeleton position prediction model; predicting the virtual dynamic skeleton through the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton; based on the dynamic model, performing collision detection optimization on the predicted position to obtain a simulation result. Based on the solution of the present application, starting from the problem of reducing the computational complexity of the three-dimensional clothing simulation technology, by designing the virtual dynamic skeleton of the clothing and using virtual geometric bodies to replace the limbs that collide with the clothing, the position of the clothing facets is indirectly calculated, so that the dynamic simulation calculation body of the three-dimensional clothing and the virtual puppet reaches the original 10e -2 The overall computational effort reaches 10e of the original computational effort. -4 The number of levels has been increased, solving the problem of large computational complexity in existing 3D clothing simulation technologies.
[0066] Specifically, refer to Figure 1 , Figure 1 This is a schematic diagram of the functional modules of the terminal device to which the 3D clothing simulation device of this application belongs. The 3D clothing simulation device can be a device independent of the terminal device that can perform 3D clothing simulation and can be hosted on the terminal device in the form of hardware or software. The terminal device can be a smart mobile terminal with data processing capabilities, such as a mobile phone or tablet computer, or a fixed terminal device or server with data processing capabilities.
[0067] In this embodiment, the terminal device to which the behavior recognition apparatus belongs includes at least an output module 110 , a processor 120 , a memory 130 and a communication module 140 .
[0068] The memory 130 stores an operating system and a 3D garment simulation program. The 3D garment simulation device can store information such as dynamic model parameters, predicted positions obtained by the skeletal prediction model, and simulation results in the memory 130. The output module 110 can be a display screen, etc. The communication module 140 can include a Wi-Fi module, a mobile communication module, and a Bluetooth module, etc., and communicates with external devices or servers through the communication module 140.
[0069] When the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are implemented:
[0070] Configure virtual dynamic bones for 3D clothing;
[0071] Configure virtual geometry for the virtual puppet;
[0072] Constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body;
[0073] Based on the parameters of the dynamic model, a skeleton position prediction model is trained;
[0074] Predicting the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton;
[0075] Based on the dynamic model, collision detection optimization is performed on the predicted position to obtain a simulation result.
[0076] Furthermore, when the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are also implemented:
[0077] Configure virtual dynamic bones for 3D clothing:
[0078] Obtaining the structural features of three-dimensional clothing;
[0079] Designing the structure of the virtual dynamic skeleton based on the structural characteristics of the three-dimensional clothing;
[0080] Setting weight information of the virtual dynamic skeleton based on the structure of the virtual dynamic skeleton;
[0081] Brushing the weight information into the structure of the virtual dynamic skeleton to obtain the virtual dynamic skeleton;
[0082] To configure virtual geometry for an avatar:
[0083] Obtaining a human body model of the virtual doll;
[0084] Extracting features of the limbs of the virtual doll that collide with the three-dimensional clothing based on the human body model of the virtual doll;
[0085] Based on the features of the limb part, a corresponding geometric body is selected as the virtual geometric body.
[0086] Furthermore, when the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are also implemented:
[0087] Configuring information of each bone in the virtual dynamic skeleton, the bone information including: one or more of bone name, layer number, parent-child node, sibling node, weight, and elastic coefficient;
[0088] Configuring information of the virtual geometric body, wherein the information of the virtual geometric body includes one or more of the following: a name of the virtual geometric body, a position relative to a human body, and physical properties;
[0089] Based on the information of the skeleton and the information of the virtual geometric body, a dynamic model between the virtual dynamic skeleton and the virtual geometric body is constructed.
[0090] Furthermore, when the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are also implemented:
[0091] Create an initial neural network;
[0092] The initial neural network is trained using the parameters of the dynamic model, and the initial neural network learns the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body using the parameters of the dynamic model;
[0093] After completing the training, the skeleton position prediction model is obtained.
[0094] Furthermore, when the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are also implemented:
[0095] Acquiring position information of the virtual dynamic skeleton and the virtual geometric body in a human body coordinate system;
[0096] Acquiring physical property information of the virtual geometric body;
[0097] The position information and physical property information are input into the bone position prediction model for prediction to obtain the predicted position of the dynamic bone.
[0098] Furthermore, when the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are also implemented:
[0099] Based on the predicted position, calculating a positional relationship between the virtual geometric body and the predicted position;
[0100] Based on the dynamic model, collision detection is performed on the position relationship, and the following judgment processing is performed:
[0101] If the position relationship satisfies the collision detection, the predicted position of the virtual dynamic skeleton is used as the simulation result;
[0102] If the position relationship does not satisfy the collision detection, the predicted position of the virtual dynamic skeleton is corrected to obtain the simulation result.
[0103] Furthermore, when the three-dimensional clothing simulation program in the memory 130 is executed by the processor, the following steps are also implemented:
[0104] calculating a correction direction of the predicted position based on the dynamic model;
[0105] calculating a corrected length of the predicted position based on the dynamic model;
[0106] The predicted position of the dynamic skeleton is corrected according to the correction direction and the correction length to obtain the simulation result.
[0107] This embodiment adopts the above scheme, specifically by configuring a virtual dynamic skeleton for a three-dimensional garment; configuring a virtual geometric body for a virtual puppet; constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body; training a skeleton position prediction model based on the parameters of the dynamic model; predicting the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton; and performing collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result. Based on the scheme of this application, starting from the problem of reducing the computational complexity of three-dimensional garment simulation technology, by designing a virtual dynamic skeleton for the garment and using virtual geometric bodies to replace the limbs that collide with the garment, the position of the garment facets is indirectly calculated, reducing the computational complexity to 10e that of the prior art. -4 The number of levels has been increased, solving the problem of large computational complexity in existing clothing simulation technologies.
[0108] Based on the above-mentioned terminal device architecture but not limited to the above-mentioned architecture, an embodiment of the method of the present application is proposed. It should be noted that although a logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than here. The execution subject of the embodiment of the method of the present application can be a three-dimensional clothing simulation device, or a three-dimensional clothing simulation terminal device or server. This embodiment takes a three-dimensional clothing simulation device as an example. The three-dimensional clothing simulation device can be integrated into a terminal device such as a desktop computer, a laptop computer, etc. with a data processing function.
[0109] Reference Figure 2 The first embodiment of the three-dimensional clothing simulation method of the present application provides a flow chart, and the three-dimensional clothing simulation method includes:
[0110] Step S100, configuring a virtual dynamic skeleton for the three-dimensional garment;
[0111] Specifically, in this step, this embodiment designs a set of virtual dynamic skeletons for the three-dimensional clothing based on the physical structure of the three-dimensional clothing. The number of bones is between 40 and 60, and each bone is assigned a weight for the clothing patch information surrounding the bone. The weight information represents the degree of control the virtual dynamic skeleton has over the surrounding clothing patches. The greater the weight information of the bone, the stronger the skeleton's control over the surrounding clothing patches. After the setting is completed, the three-dimensional clothing will move along with the virtual dynamic skeleton through the rendering of the external engine. Subsequent calculations on this virtual dynamic skeleton indirectly calculate a large number of three-dimensional clothing patch vertices, effectively reducing the amount of direct calculations while ensuring the simulation effect.
[0112] Step S200, configuring a virtual geometric body for the virtual puppet;
[0113] Specifically, in the application of 3D technology, the number of three-dimensional vertices and facets of a virtual doll is generally in the tens of thousands or even hundreds of thousands. Even if the body model is simplified, the number is still in the thousands to tens of thousands. If calculations are performed directly on the virtual doll, the amount of calculations is too large, affecting the calculation efficiency.
[0114] Taking this situation into consideration, in this step, the part where the virtual doll collides with the three-dimensional clothing is abstracted into a virtual geometric body with a similar shape. This virtual geometric body replaces the real human limbs to participate in the analysis and calculation of subsequent steps. On the basis of achieving the original effect, the amount of calculation can be effectively reduced.
[0115] Step S300, constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body;
[0116] Specifically, in this step, the information of the virtual dynamic skeleton and virtual geometric body is further configured, such as the name, number of layers, parent-child node information, sibling node information, weight, elastic coefficient, etc. of each virtual bone; the identification of the virtual geometric body, its position relative to the human body, shape, radius and other information.
[0117] After the configuration is completed, a dynamic model of the virtual dynamic skeleton and the virtual geometric body is obtained. The model contains dynamic constraint information between the virtual dynamic skeleton and the virtual geometric body. Through this model, the virtual dynamic skeleton and the virtual geometric body can be unified, which facilitates the subsequent training of the neural network and collision detection optimization of the prediction results.
[0118] Step S400, training a skeleton position prediction model based on the parameters of the dynamic model;
[0119] Specifically, in this step, the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body are learned through a pre-created fully connected neural network consisting of two hidden layers, an input layer, and an output layer. This structure makes the neural network less time-consuming during use and supports real-time solutions.
[0120] The fully connected neural network is trained using the parameters of the dynamic model. After the training, a prediction model for the bone position is obtained. The input of this model is the position information of the virtual dynamic skeleton and virtual geometric body in the human coordinate system, as well as the physical property information of the virtual geometric body. The output of this model is the predicted position of the virtual dynamic skeleton, thereby achieving the purpose of real-time solution of the position of the virtual dynamic skeleton.
[0121] Step S500, predicting the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton;
[0122] Specifically, in this step, the input layer of the skeletal position prediction model inputs the current position information of the virtual dynamic skeleton and virtual geometric body, as well as the physical property information of the virtual geometric body. The output layer of the prediction model obtains the predicted position of the virtual dynamic skeleton at the next moment, achieving real-time solution. The skeletal position prediction model has been extensively trained to learn the dynamic constraints between the garment dynamic skeleton and the virtual geometric body. Based on the data of the virtual dynamic skeleton and virtual geometric body at the current moment, it can predict the position of the virtual dynamic skeleton at the next moment.
[0123] Step S600: performing collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result.
[0124] Although deep learning has the advantage of strong learning ability and can provide the most accurate prediction results based on the features learned during the training process, it still has the common problem of instability. Even the most accurate model may produce deviations. Therefore, the prediction results need to be corrected.
[0125] Specifically, in this step, a collision detection is performed on the predicted position based on the dynamic model. If the virtual geometric body and the predicted position meet the collision detection, there is no need to correct the predicted position. If the virtual geometric body and the predicted position do not meet the collision detection, it means that there will be penetration between the clothing and the virtual doll, and the predicted position needs to be corrected. The position of the corrected virtual dynamic skeleton is used as the simulation result, thereby realizing the simulation of the three-dimensional clothing.
[0126] This embodiment adopts the above scheme, specifically by configuring a virtual dynamic skeleton for the three-dimensional clothing; configuring a virtual geometric body for the virtual puppet; constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body; training a skeleton position prediction model based on the parameters of the dynamic model; predicting the virtual dynamic skeleton through the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton; performing collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result. Based on the scheme of this application, starting from the problem of reducing the computational complexity of three-dimensional clothing simulation technology, a virtual dynamic skeleton of the clothing is designed, and at the same time, virtual geometric bodies are used to replace the limbs that collide with the clothing, and the position of the clothing facets is indirectly calculated, so that the overall computational complexity is reduced to 10e of the existing technology. -4 The number of levels has been increased, solving the problem of large computational complexity in existing clothing simulation technologies.
[0127] Further, refer to Figure 3The second embodiment of the three-dimensional clothing simulation method of the present application provides a flow chart based on the above Figure 2 In step S100 of the illustrated embodiment, the step of configuring a virtual dynamic skeleton for a three-dimensional garment includes:
[0128] Step S101, obtaining structural features of three-dimensional clothing;
[0129] Specifically, in this step, the structural features of the 3D garment being simulated are extracted from its image. Different garments have different structural characteristics, such as a skirt and a pair of pants. To achieve a good simulation effect, the structural features of the garment must be extracted and used to design the structure of the virtual dynamic skeleton.
[0130] More specifically, refer to Figure 4 , Figure 4 This is a schematic diagram of a skirt worn by a virtual doll. Analysis of the skirt's image reveals that it consists of two main components: a waistband and a hem. The waistband is a circular structure that fits snugly around the doll's waist, while the hem is a fan-shaped structure. Extracting these two features will aid in the subsequent design of the skirt's virtual dynamic skeleton.
[0131] Step S102, designing the structure of the virtual dynamic skeleton based on the structural characteristics of the three-dimensional clothing;
[0132] Specifically, in this step, based on the structural features of the 3D garment acquired in the previous step, a virtual dynamic skeleton structure with similar characteristics is designed. Each column of bones in the virtual dynamic skeleton structure is composed of multiple nodes, where each lower-level child node follows the movement of the parent node in the upper layer, ultimately connecting to form a structure that can freely swing around the parent node. This virtual dynamic skeleton can simulate the movement process of the 3D garment, replacing complex surface vertices in the analysis and calculation, achieving the goal of reducing the amount of computation while ensuring the effect.
[0133] More specifically, refer to Figure 5 , Figure 5 To give Figure 4 Schematic diagram of the structure of the virtual dynamic skeleton of the skirt design shown. Figure 4 The structural features of the skirt shown. This step designs a total of 32 bones for the skirt shown. Among them, 8 fixed waist nodes are configured at the waist of the skirt. For the hem structure of the skirt, each waist node is connected to a column of evenly arranged bone strings. Each bone string consists of 4 child bones with flexible mobility. Except for the waist node, each bone node can move with its parent node, thereby realizing the simulation of the entire skirt structure.
[0134] Step S103, setting weight information of the virtual dynamic skeleton based on the structure of the virtual dynamic skeleton;
[0135] Specifically, in 3D simulation technology, a virtual skeleton model controls patch information through its weights. In this embodiment, the weight information of the virtual dynamic skeleton indicates its ability to control the surrounding clothing patches. The greater the weight of the virtual dynamic skeleton, the greater the influence of the virtual dynamic skeleton on the surrounding clothing patches, and the stronger the ability of the clothing patches to move with the virtual dynamic skeleton. The weight setting needs to take into account the desired effect. Generally, the most appropriate weight is determined through multiple trials based on the desired effect.
[0136] Step S104: brush the weights into the structure of the virtual dynamic skeleton to obtain the virtual dynamic skeleton.
[0137] Specifically, in this step, the weight information set in the previous step is applied to each bone in the entire virtual dynamic skeleton, achieving the binding between the virtual dynamic skeleton and the 3D garment. After the binding is completed, through the external 3D engine rendering, each virtual dynamic skeleton will move and move the surrounding garment patches, thus realizing the movement of the entire 3D garment. Calculating the position of the weighted virtual dynamic skeleton can replace the calculation of the 3D garment patch vertices, greatly reducing the amount of calculation.
[0138] This embodiment, through the above scheme, specifically includes: obtaining the structural features of the three-dimensional garment; designing the structure of the virtual dynamic skeleton based on the structural features of the three-dimensional garment; setting the weight of the virtual dynamic skeleton based on the structure of the virtual dynamic skeleton; and brushing the weight information into the structure of the virtual dynamic skeleton to obtain the virtual dynamic skeleton. Based on this embodiment, a virtual dynamic skeleton is configured for three dimensions. The virtual dynamic skeleton is a dynamic simulation of the three-dimensional garment. By brushing in the weight information, it can replace the vertices of the three-dimensional garment's patches in the calculation, thereby greatly reducing the amount of calculation for the three-dimensional garment patches, which helps to reduce the amount of calculation for the entire three-dimensional garment simulation process.
[0139] Further, refer to Figure 6 The third embodiment of the three-dimensional clothing simulation method of the present application provides a flow chart based on the above Figure 2 In step S200 of the illustrated embodiment, the step of configuring a virtual geometric body for the virtual puppet includes:
[0140] Step S201, obtaining a human body model of a virtual doll;
[0141] Specifically, the virtual doll is a virtual doll wearing three-dimensional clothing to be simulated. The image of the virtual doll is complex and specific. In order to facilitate analysis in advance, the image of the virtual doll needs to be simplified, retaining basic human features to obtain a human body model of the virtual doll.
[0142] Step S202: extracting features of the limbs of the virtual doll that collide with the clothing based on the human body model of the virtual doll;
[0143] Specifically, the human body model of the virtual doll and the structural features of the 3D clothing can be used to determine where the virtual doll collides with the 3D clothing, and further extract the features of the limbs of the virtual doll that collide with the clothing. For example, the virtual doll's image is that of an average woman, and the clothing is a skirt. It can be determined that the skirt collides with the virtual doll's body at the hips and thighs. Based on the virtual doll's image, the geometric features of the virtual doll's hips and thighs, such as shape, length, width, and height, are extracted.
[0144] Step S203: Based on the features of the limb part, a corresponding geometric body is selected as the virtual geometric body.
[0145] Specifically, in this step, based on the characteristics of the virtual figure's limbs that collide with the three-dimensional garment, the geometric body with the most similar shape is selected, and the geometric properties of the geometric body are further configured. For example, in step S202 above, we have already obtained the geometric characteristics of the virtual figure's hips and thighs. Based on these geometric characteristics, two similar spheres can be configured to replace the virtual figure's hips, and two cylinders can be configured to replace the virtual figure's thighs. Parameters such as the length, width, height, and radius of the geometric body can also be configured.
[0146] This embodiment utilizes the aforementioned scheme to obtain a human body model for a virtual avatar; based on this human body model, extract features of the limbs of the virtual avatar where they collide with the three-dimensional garment; and, based on these limb features, select a corresponding geometric body as the virtual geometric body. By configuring a virtual geometric body for the virtual avatar, complex human features are simplified into virtual geometric bodies, avoiding direct calculation of these complex features. This effectively reduces the amount of computation while maintaining simulation quality.
[0147] Further, refer to Figure 7 The fourth embodiment of the three-dimensional clothing simulation method of the present application provides a flow chart based on the above Figure 2 In step S400 of the illustrated embodiment, the step of training a skeleton position prediction model based on the parameters of the dynamic model includes:
[0148] Step S401, creating an initial neural network;
[0149] Specifically, neural networks are a type of machine learning technology that mimics the human brain's neural networks in an effort to achieve artificial intelligence-like capabilities. They are also the foundation of deep learning. Due to their exceptional recognition capabilities and superior performance, neural networks have become a preferred approach in the field of computer vision. Neural networks are composed of a large number of neurons and are trained using vast amounts of data to determine the bias and weight information for each neuron, ultimately enabling accurate recognition of pre-set targets.
[0150] More specifically, refer to Figure 8 , Figure 8 This is a schematic diagram of a fully connected neural network used in this embodiment. Figure 8 The fully connected neural network shown has a 4-layer structure, including an input layer, an output layer and two hidden layers. The two hidden layers process the data obtained by the input layer, and the output layer outputs the results. Figure 5 The structure of the virtual dynamic skeleton shown in the figure contains 32 dynamic bones. The limbs it collides with are the buttocks and thighs, and the corresponding virtual geometric bodies are two spheres and two cylinders. According to the characteristics of the fully connected neural network, its input layer is used to input the position information of the virtual dynamic skeleton and the virtual geometric body in the human body coordinate system, and should include 36 to 60 neurons. Its output layer is used to output the predicted positions of all virtual dynamic bones and should include 32 neurons. In order to ensure iterative efficiency, the number of neurons in the first hidden layer and the second hidden layer should be between 120 and 180. At this point, the number of neurons in the input layer and output layer of the fully connected neural network is determined, and the parameters of the neurons in the hidden layer need to be continuously iteratively updated during the training process.
[0151] Step S402: training the initial neural network using the parameters of the dynamic model, wherein the initial neural network learns the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body using the parameters of the dynamic model;
[0152] Specifically, the parameters of the dynamic model include: positional information of the virtual dynamic skeleton and the virtual geometric body, and physical property information of the virtual geometric body, which includes the dynamic constraint relationship between the virtual dynamic skeleton and the virtual geometric body. The neural network is trained using the parameters of the dynamic model, iteratively updating parameters such as neuron weights and biases, based on which the dynamic constraint relationship between the virtual dynamic skeleton and the virtual geometric body is fitted until the desired training effect is achieved.
[0153] Step S403: After completing the training, the skeleton position prediction model is obtained.
[0154] Specifically, during the training process, the neural network learns the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body through iterative training, and the learning effect is reflected in the output error. Neural networks are unstable and cannot achieve completely accurate prediction results. Therefore, it is necessary to determine an acceptable error range based on the actual application scenario. When this error range is reached, the training of the initial neural network is terminated, and the skeleton position prediction model is obtained. The resulting skeleton position prediction model can predict the position of the virtual dynamic skeleton at the next moment based on the data of the virtual dynamic skeleton and the virtual geometric body at the current moment.
[0155] This embodiment uses the above scheme, specifically by creating an initial neural network; training the initial neural network using the parameters of the dynamic model, wherein the initial neural network learns the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body using the parameters of the dynamic model; and after completing the training, the skeleton position prediction model is obtained. The skeleton position prediction model obtained by training in this embodiment is capable of learning the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body, and predicting the position of the virtual dynamic skeleton at the next moment based on the data of the virtual dynamic skeleton and the virtual geometric body at the current moment. The four-layer fully connected neural network selected can reduce time consumption, ensure efficiency, and support real-time solution while achieving accurate prediction.
[0156] Further, refer to Figure 9 The fifth embodiment of the three-dimensional clothing simulation method of the present application provides a flow chart based on the above Figure 2 In step S600 of the illustrated embodiment, the step of performing collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result includes:
[0157] Step S601, calculating the positional relationship between the virtual geometric body and the predicted position based on the predicted position;
[0158] Specifically, the predicted position is obtained by a skeleton position prediction model, and the position of the virtual geometric body can be directly captured in real time by an external three-dimensional engine. The position vector between the virtual geometric body and the predicted position can be obtained by calculation to obtain the position relationship.
[0159] Assuming that the predicted position of the virtual dynamic skeleton is pos_skin_1 and the position of the virtual geometric body is pos_ball, the vector dist (dist = pos_ball - pos_skin_1) between the virtual dynamic skeleton and the virtual geometric body can be calculated by subtracting the position vectors. The distance information and direction information between the virtual geometric body and the virtual dynamic skeleton can be obtained through the vector dist. Based on this information, the positional relationship between the virtual geometric body and the predicted position can be determined, and collision detection can be performed.
[0160] Step S602: Based on the dynamic model, collision detection is performed on the position relationship to perform judgment processing:
[0161] Step S603: If the position relationship satisfies the collision detection standard, the predicted position of the virtual dynamic skeleton is used as the simulation result;
[0162] Step S604: if the position relationship does not meet the collision detection standard, the predicted position of the virtual dynamic skeleton is corrected;
[0163] Specifically, in the above steps, the need for correction of the predicted position is determined based on the positional relationship between the virtual geometric body and the predicted position. If the positional relationship does not meet the collision detection requirement, it indicates that there is an error in the predicted position. If the 3D garment is located at the predicted position, the 3D garment and the virtual figure will be interwoven. Therefore, the predicted position that does not meet the collision detection requirement needs to be corrected to meet the collision detection requirement.
[0164] More specifically, in the above scheme Figure 5 The virtual dynamic skeleton shown is taken as an example for analysis. The virtual dynamic skeleton is configured for a skirt, and the body parts that the skirt collides with are the hips and thighs. Therefore, two spheres and two cylinders are configured for the hips and thighs respectively as approximate geometric bodies.
[0165] Assume that the positional relationship between the sphere and the virtual dynamic bone is represented by the vector dist between them. According to the principle of dynamic collision detection, if the modulus of the vector dist is greater than the radius of the sphere, it means that the predicted position is outside the virtual geometric body, the collision detection is satisfied, and the virtual dynamic bone and the virtual geometric body do not penetrate the mold; if the modulus of the vector dist is less than the radius of the sphere, the predicted position is inside the virtual geometric body, and the virtual dynamic bone and the virtual geometric body penetrate the mold. The virtual dynamic bone needs to be moved along the direction of the vector between them to a position where the modulus of the vector dist is greater than the radius of the sphere.
[0166] Assume that the top coordinate of the cylinder is pos_cylinder_1, the bottom coordinate of the cylinder is pos_cylinder_2, the vertex position of the dynamic bone is pos_bone_cloth, and the radius of the cylinder is radiu.
[0167] Calculate the vector between the bone vertex and the top vertex of the cylinder:
[0168] dist1=pos_bone_cloth-pos_cylinder_1;
[0169] Compute the vector dot product between dis1 and p12:
[0170] dot1=dis1.dotProduct(p12));
[0171] Calculate the distance between the bone vertex and the top vertex of the cylinder:
[0172] dis1Value = magnitude of vector dis1;
[0173] Calculate the length of the cylinder p12Value:
[0174] p12Value = modulus of vector p12;
[0175] Calculate the relationship between the vector and the cosine of the angle:
[0176] cos1=dot1 / (dis1Value*p12Value);
[0177] Calculate the distance between the skeleton point and the center of the cylinder with the same cross section = dis1Value*sqrtf(1-cos1*cos1);
[0178] Then, if the distance between the vertex of the virtual dynamic bone and the center of the cylinder of the same cross section is less than the radius of the cylinder, it means that the vertex of the virtual dynamic bone is inside the cylinder, that is, the thigh muscle of the 3D clothing-piercing virtual puppet. The position of the virtual dynamic bone needs to be corrected:
[0179] Calculate the projection of the virtual dynamic bone's vertex on the center of the cylinder:
[0180] k=dis1Value*cos1 / p12Value;
[0181] Calculate the projection point of the clothing bone vertex at the center of the cylinder:
[0182] p = pos_cylinder_1 + p12*k;
[0183] Calculate the direction of vector movement, the direction of movement is from the center of the projection cylinder to the bone point:
[0184] dist=p-pos_bone_cloth;
[0185] Finally, normalize the vector dist1 (that is, convert the vector into a unit vector, retaining only the direction and with a length of 1) and move the predicted position of the virtual dynamic bone outward from the center of the projection point cylinder:
[0186] pos_bone_cloth+=dist*|Distance between the skeleton point and the center of the cylinder with the same cross section - radiu|.
[0187] This embodiment uses the above scheme, specifically by: calculating the positional relationship between the virtual geometric body and the predicted position based on the predicted position; performing collision detection on the positional relationship based on the dynamic model, and performing judgment processing: if the positional relationship satisfies the collision detection, the predicted position of the virtual dynamic skeleton is used as the simulation result; if the positional relationship does not satisfy the collision detection, the predicted position of the virtual dynamic skeleton is corrected. Based on this embodiment, the prediction results obtained by deep learning are corrected through collision detection optimization, further improving the accuracy of the simulation results, while reducing the amount of calculation and ensuring that the simulation results are not affected.
[0188] In addition, the present application also provides a three-dimensional clothing simulation device, which includes:
[0189] Virtual dynamic skeleton design module, used to configure virtual dynamic skeleton for clothing;
[0190] A virtual geometry design module, used to configure virtual geometry for a virtual puppet;
[0191] A dynamic model design module, used for constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body;
[0192] A model training module, configured to train a skeletal position prediction model based on the parameters of the dynamic model;
[0193] A prediction module, which predicts the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton;
[0194] The collision detection optimization module is used to perform collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result.
[0195] The principle and implementation process of realizing three-dimensional clothing simulation in this embodiment can be referred to the above embodiments and will not be described in detail here.
[0196] In addition, an embodiment of the present application also proposes a terminal device, which includes a memory, a processor, and a three-dimensional clothing simulation program stored on the memory and runnable on the processor. When the three-dimensional clothing simulation program is executed by the processor, the steps of the three-dimensional clothing simulation method described above are implemented.
[0197] Since the present three-dimensional clothing simulation method program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought about by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0198] In addition, an embodiment of the present application further provides a computer-readable storage medium, on which a three-dimensional clothing simulation program is stored. When the three-dimensional clothing simulation program is executed by a processor, the steps of the three-dimensional clothing simulation method described above are implemented.
[0199] Since this three-dimensional clothing simulation program adopts all the technical solutions of all the aforementioned embodiments when executed by the processor, it has at least all the beneficial effects brought about by all the technical solutions of all the aforementioned embodiments, which will not be described one by one here.
[0200] Compared with the existing technology, the three-dimensional clothing simulation method, device, terminal device and storage medium proposed in the embodiment of the present application include: configuring a virtual dynamic skeleton for the three-dimensional clothing; configuring a virtual geometric body for the virtual puppet; constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body; training a skeleton position prediction model based on the parameters of the dynamic model; predicting the virtual dynamic skeleton through the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton; performing collision detection optimization on the predicted position based on the dynamic model to obtain the simulation result. Based on the solution of the present application, starting from the problem of excessive computational complexity of existing three-dimensional simulation technology, a virtual dynamic skeleton for the three-dimensional clothing and a virtual geometric body for the virtual puppet are designed, which indirectly realizes the calculation of the simulation subject, so that the dynamic simulation calculation subject of the three-dimensional clothing and the three-dimensional puppet is only 10e smaller than the original one. -2 At the same level, the overall computational effort is 10e of the original computational effort. -4 It solves the problem of excessive computational complexity in existing 3D clothing simulation technologies.
[0201] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0202] The serial numbers of the above embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0203] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as mentioned above, and includes a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, controlled terminal, or network device, etc.) to execute the method of each embodiment of the present application.
[0204] The above are only preferred embodiments of the present application and do not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A three-dimensional clothing simulation method, characterized in that: The steps of the three-dimensional clothing simulation method include: Configure virtual dynamic bones for 3D clothing; The step of configuring a virtual dynamic skeleton for the three-dimensional garment includes: Obtain the structural features of three-dimensional clothing; Designing the structure of the virtual dynamic skeleton based on the structural characteristics of the three-dimensional clothing; Setting weight information of the virtual dynamic skeleton based on the structure of the virtual dynamic skeleton; Brushing the weight information into the structure of the virtual dynamic skeleton to obtain the virtual dynamic skeleton; Configure virtual geometry for the virtual puppet; The step of configuring a virtual geometric body for the virtual puppet includes: Obtaining a human body model of the virtual doll; Extracting features of the limbs of the virtual doll that collide with the three-dimensional clothing based on the human body model of the virtual doll; Based on the features of the limb part, selecting a corresponding geometric body as the virtual geometric body; Constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body; The step of constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body includes: Configuring information of each bone in the virtual dynamic skeleton, the bone information including: one or more of bone name, layer number, parent-child node, sibling node, weight, and elastic coefficient; Configuring information of the virtual geometric body, wherein the information of the virtual geometric body includes one or more of the following: a name of the virtual geometric body, a position relative to a human body, and physical properties; Constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body based on the information of the skeleton and the information of the virtual geometric body; Based on the parameters of the dynamic model, a skeleton position prediction model is trained; Predicting the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton; Based on the dynamic model, collision detection optimization is performed on the predicted position to obtain a simulation result.
2. The three-dimensional clothing simulation method according to claim 1, characterized in that: The step of training a skeleton position prediction model based on the parameters of the dynamic model includes: Create an initial neural network; The initial neural network is trained using the parameters of the dynamic model, and the initial neural network learns the dynamic constraints between the virtual dynamic skeleton and the virtual geometric body using the parameters of the dynamic model; After completing the training, the skeleton position prediction model is obtained.
3. The three-dimensional clothing simulation method according to claim 1, characterized in that: The step of predicting the virtual dynamic skeleton by using the skeleton position prediction model to obtain the predicted position of the virtual dynamic skeleton includes: Acquiring position information of the virtual dynamic skeleton and the virtual geometric body in a human body coordinate system; Acquiring physical property information of the virtual geometric body; The position information and physical attribute information are input into the bone position prediction model for prediction to obtain the predicted position of the dynamic bone.
4. The three-dimensional clothing simulation method according to claim 1, characterized in that: The step of performing collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result includes: Based on the predicted position, calculating a positional relationship between the virtual geometric body and the predicted position; Based on the dynamic model, collision detection is performed on the position relationship, and the following judgment processing is performed: If the position relationship satisfies the collision detection, the predicted position of the virtual dynamic skeleton is used as the simulation result; If the position relationship does not satisfy the collision detection, the predicted position of the virtual dynamic skeleton is corrected to obtain the simulation result.
5. The clothing simulation method according to claim 4, characterized in that: If the position relationship does not satisfy the collision detection, the predicted position of the virtual dynamic skeleton is corrected to obtain the simulation result, comprising: calculating a correction direction of the predicted position based on the dynamic model; calculating a corrected length of the predicted position based on the dynamic model; The predicted position of the dynamic skeleton is corrected according to the correction direction and the correction length to obtain the simulation result.
6. A clothing simulation device, characterized in that: The clothing simulation device comprises: Skeleton design module, used to configure virtual dynamic skeletons for 3D clothing; Wherein, the skeleton design module is also used for: Obtaining the structural features of three-dimensional clothing; Designing the structure of the virtual dynamic skeleton based on the structural characteristics of the three-dimensional clothing; Setting weight information of the virtual dynamic skeleton based on the structure of the virtual dynamic skeleton; Brushing the weight information into the structure of the virtual dynamic skeleton to obtain the virtual dynamic skeleton; A virtual geometry design module, used to configure virtual geometry for a virtual puppet; Wherein, the virtual geometric body design module is further used for: Obtaining a human body model of the virtual doll; Extracting features of the limbs of the virtual doll that collide with the three-dimensional clothing based on the human body model of the virtual doll; Based on the features of the limb part, selecting a corresponding geometric body as the virtual geometric body; A dynamic model construction module, used for constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body; Wherein, the kinetic model construction module is further used for: Configuring information of each bone in the virtual dynamic skeleton, the bone information including: one or more of bone name, layer number, parent-child node, sibling node, weight, and elastic coefficient; Configuring information of the virtual geometric body, wherein the information of the virtual geometric body includes one or more of the following: a name of the virtual geometric body, a position relative to a human body, and physical properties; Constructing a dynamic model between the virtual dynamic skeleton and the virtual geometric body based on the information of the skeleton and the information of the virtual geometric body; A prediction model training module, which trains a bone position prediction model based on the parameters of the dynamic model; A prediction module, configured to predict the virtual dynamic skeleton using the skeleton position prediction model to obtain a predicted position of the virtual dynamic skeleton; The collision detection optimization module is used to perform collision detection optimization on the predicted position based on the dynamic model to obtain a simulation result.
7. A terminal device, characterized in that: The terminal device includes a memory, a processor, and a three-dimensional clothing simulation program stored in the memory and runnable on the processor. When the three-dimensional clothing simulation program is executed by the processor, the steps of the three-dimensional clothing simulation method according to any one of claims 1 to 5 are implemented.
8. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a three-dimensional clothing simulation program, which, when executed by a processor, implements the steps of the three-dimensional clothing simulation method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Stable spaces for rendering character garments in real-time
US20110273457A1