# Real-Time Animation Complexity of Interactive Clothing Design Based on Computer Simulation

Authors: Yufeng Xin; Dongliang Zhang; Guopeng Qiu
Journal: Complexity
 (2021)

---

## Abstract

With the innovation of computer, virtual clothing has also emerged. This research mainly discusses the real-time animation complex of interactive clothing design based on computer simulation. In the process of realizing virtual clothing, the sample interpolation synthesis method is used, and the human body sample library is constructed using the above two methods (primitive construction method and model reconstruction method) first, and then, the human body model is obtained by interpolation calculation according to the personalized parameters. Building a clothing model is particularly important for the effect of trying on. The clothing that needs to be displayed can be scanned and then input into the computer to build the model. The model can be directly built in 3DMAX and other software and then its surface texture can be mapped, or the clothing model can be directly built. The 3D model in the 3ds file is loaded by the loop body nested switch branch selection structure. Correspondingly, the write-back operation of 3ds files is similar. Just follow the general structure of the 3ds file and write the root block, version information block, edit information block, key frame information block, etc. to a brand new file in sequence. The main reason for this article to perform the 3ds file write-back operation is that, after the clothing model is dynamically simulated through the dynamic principle, the deformed key animation frame needs to be saved as a 3ds file so that it can be further imported into the 3DSMAX software and generated by the renderer, form high-quality picture information, and finally get high-definition animation video. In the CPU-GPU hybrid method, modules such as force calculation, collision processing, and position update use the GPU method, while overstretching is processed by the CPU method, making the overall performance 10 times higher than the pure CPU method. This research helps to promote the development of 3D virtual clothing design.


---

## Body

## 1. Introduction

Clothes are generally made of fabric. Many techniques are used in clothes animation, and naturally most of them come from fabric simulation. Fabrics in clothes are very soft and deformable, especially those light and thin fabrics in the real world, which can also show rich wrinkles. This brings opportunities and challenges to the simulation of deformable bodies such as fabrics and clothes. How to simulate the effect of cloth and clothes that are close to the reality through computer simulation and how to make the simulation speed meet the real-time requirements of animation have always been research hotspots and difficulties in the field of virtual reality.The research goal of this paper is to study the feasibility of dynamic simulation-based clothing animation and online fitting based on the difficulty of fitting on existing online clothing sales channels and to carry out in-depth research and improvement on the key technologies. First, introduce the basic concepts of 3D virtual clothes animation, then describe the relevant research background, status, prospects, etc., and introduce the key issues, main innovations, and contributions in the 3D virtual clothes animation, including the key issues in the 3D virtual clothes animation, clothing modeling, numerical solution, and key frame animation program.As the key of virtual reality, computer simulation has been widely used in the field of sports. Yili believes that this revolutionary has had a huge impact on traditional teaching ideas and teaching methods and has brought huge opportunities for the development of sports. In view of the limitations of the traditional physical education model, combined with the theory of stimulus response, he analyzed the simulation in the field of physical education and innovated the physical education model. It provides a reference for the better development of sports. His research-assisted teaching can help students make better use of simulation to strengthen physical learning theory and physical practice, but it lacks a teaching model that can provide an effective reference for the innovation of physical education [1]. In interior design, the computer's drawing function can greatly improve the design efficiency, with the advantages of accuracy, repeatability, and modification. Sai analyzed the architectural design and interior decoration based on virtual reality and computer simulation. In his research, the computer’s drawing function is an important tool for the computer-aided design of interior designers, but the research process lacks data [2]. Ahmed demonstrated a Ku-band patch antenna with a larger bandwidth. He used the skills of Defective Ground Structure (DGS) and Defect Driven Patch to expand his BW. He proposed an impedance bandwidth of 8 GHz, which is suitable for a variety of applications. It can be easily installed in related convenient electronic devices. In this case, computer software called computer simulation will be used for investigation and analysis. Although the simulation design in his research shows very good gain and efficiency, the research lacks novelty [3]. Kajiwara believes that composite is very important for the production of high-functional or high-quality materials and products. He has researched composite technologies in polymer and glass processing. For the multilayer process of polymer films, he has developed a multilayer flow simulation for viscoelastic fluids and discussed the instability and encapsulation phenomena at the interface from case studies considering mold configuration, rheological properties, etc. Although the multilayer film phenomenon in his research can also be understood from simulation, the research process still has no data induction [4].In the process of realizing virtual clothing, the sample interpolation synthesis method is used, and the human body sample library is constructed using the above two methods first, and then, the human body model is obtained by interpolation calculation according to the personalized parameters. Building a clothing model is particularly important for the effect of trying on. The clothing that needs to be displayed can be scanned and then input into the computer to build the model. You can also directly build the model in 3DMAX and other software and then map its surface texture. The 3D model in the 3ds file is loaded by the loop body nested switch branch selection structure. Correspondingly, the write-back operation of 3ds files is similar. Just follow the general structure of the 3ds file and write the root block, version information block, edit information block, key frame information block, etc. to a brand new file in sequence. The main reason for this article to perform the 3ds file write-back operation is that, after the clothing model is dynamically simulated through the dynamic principle, the deformed key animation frame needs to be saved as a 3ds file so that it can be further imported into the 3DSMAX software and generated by the renderer, form high-quality picture information, and finally get high-definition animation video.


## 2. Real-Time Animation Complex for Interactive Clothing Design

### 2.1. Computer Simulation

The so-called fabric computer simulation refers to a computer that uses the computer's powerful graphics processing capabilities and image display functions to quickly and realistically simulate the appearance of the fabric after obtaining the fabric CAD product data and related process parameters [5, 6]. Under normal circumstances, the fabric of computer simulation is mainly reflected in the simulation function module of the fabric CAD, but sometimes it is also directly used in a special fabric computer simulation. It is an important means of testing the results of fabric computer-aided design [7]. The powerful fabric computer simulation function will greatly facilitate the designer to check the fabric effect of the designed product at any time during the design process and then be able to make timely and effective design modifications [8, 9]. This fabric computer simulation can greatly improve the design quality and work efficiency, but more importantly, it has completely changed the traditional mode of fabric design and production [10]:(1)FRj=D2jp×q,where FRj represents the quality of the fabric, D represents the diameter of the fabric, and p and q represent the correlation coefficient of the fabric. The frame rate of change is a physical quantity that describes the speed of frame movement [11]:(2)FCMk=1p×q×omax∑t=1p∑j=1qoi,j.Among them,FCMk represents the frame change rate of the k th image frame. Because the color peak value of the fabric is constantly changing with the correlation coefficient, therefore, try not to use a single peak as the main color feature of the venue [2, 12]:(3)mean=∑i=imini=imaxhisti×i∑i=imini=imaxhisti.Among them,histi represents color statistics [13]:(4)SEc=exp1−ncα.Among them,SE is the lens conversion rate and c is the lens index value [14]. The specific definition of frame motion intensity is as follows:(5)LMIc=1nc×mc∑j=1ncmcj,where LMIc represents the lens motion intensity of the c lens [15]. Kalman filtering is an algorithm that uses linear state equations to optimally estimate state through input and output observation data. Since the observation data includes the influence of noise and interference in the outside world, the optimal estimation can also be regarded as a filtering process. When using Kalman filter [16],(6)Xk|k−1=AXk|k−1+BUk.Calculate the optimal estimate from the observed valueZk to modify the predicted value:(7)Xk|k−1=Xk|k−1+KkZk−HXk|k−1.Among them,A and B are parameters and H represents the observation parameters.In the execution stage, the connection structure and weight coefficients of the network have been determined and will not change. At this time, there are [17](8)Ut+1=∑j=1nWijt+1Xjt−θt+1.Among them,Wij is the weight coefficient of the connection between the i neuron and the previous j neuron. The motion attitude determination optimization algorithm has faster convergence speed and better optimization effect, which is very suitable for large-scale data or large-scale model problems [4]:(9)mt=β1mt−1+1−β1gt,vt=β1vt−1+1−β1gt2,θt+1=θ−ηv+εm.Among them,mt and vt calculate the first and second moments of the gradient. In order to ensure stability, it is necessary to simulate the applications installed on the cloud computing and the entire operating environment of the cloud computing [18]:(10)lqm=ΔQQ0∗100%=1−exp∑i−kmaxtiexp−ERT∗100%.Among them,ΔQ and Q0 are the data entered before and after:(11)CLi=LNodei×CACrCNodep+LAC×1−CACrCNodepLevel.Among them,CLi represents the resource service capabilities provided. In this basic framework, it is very important to study the interaction and collaboration between the edge (fog) and the core (cloud) [19]:(12)Mt=Mt1+Mt−11+⋯+Mt−N+11N=Mt2+Mt1−Mt−N1N.Among them,N is the number of data and Mt is the test data. The 3D fitting process based on computer simulation is shown in Figure 1.Figure 1
3D fitting process based on computer simulation (http://alturl.com/vq2gu).


### 2.2. Three-Dimensional Fabric Geometric Model

In addition to the weight of the fabric itself, the forces it receives are only external forces, such as wind and air resistance. This divides the effect of wind on the fabric into two parts, namely, the regular part and the irregular part in the wind. In order to describe the effect of wind on the deformation of fabric texture, we apply an external force to the fabric texture deformation model and then use this to describe the effect of wind and air resistance on fabric texture deformation [20]:(13)FD=0.5MDρvr2Ssinθ,FL=0.5MLρvr2Scosθ.The liftF is perpendicular to the direction of relative velocity. The wind force acting on the fabric is divided into a regular part and an irregular part. The regular part force is simulated by establishing the fabric dynamic equation, and the irregular force is simulated by using a random signal method [21, 22]. In addition, we can also simulate the influence of fabric material properties on fabric deformation [23]. The irregular part of the wind can be controlled by a set of cosine functions Gi [24]:(14)Gix,y,z=AicosωDix+Diy.A piecewise linear equation is used to express the relationship between the amplitudeA and the abscissa x [25, 26]:(15)A=kix+b.The wave equation of the fabric movement process is simulated by the superposition of several cosine functions. Through amplitude modulation (for example, the waveform may correspond to the sound reproduced by the speaker or it may correspond to the light intensity of the TV pixel. This method is in contrast to the frequency modulation, where the carrier frequency changes, and the phase modulation, where the phase changes.), the final signal can be expressed as,(16)Fx,y,z=∑Hjx,y,z×∑cosωDix+Diy+S1t.The combination of fabric dynamics equation and random signal is realized through the process of amplitude modulation. Due to the influence of gravity, rod tension, and wind rules on the movement of the fabric, the carrier signal of the baseband function is realized by the amplitude modulation method. The wind can be modeled as an incompressible constant-density fluid, and the numerical approximation method can be significantly simplified. The simplified N-S equation can be expressed in a compact vector representation:(17)∂F∂t=−F⋅∇F−1β∇p+v∇2F,where F represents the three-dimensional velocity field and v represents the kinematic viscosity of the fluid [27].


## 2.1. Computer Simulation

The so-called fabric computer simulation refers to a computer that uses the computer's powerful graphics processing capabilities and image display functions to quickly and realistically simulate the appearance of the fabric after obtaining the fabric CAD product data and related process parameters [5, 6]. Under normal circumstances, the fabric of computer simulation is mainly reflected in the simulation function module of the fabric CAD, but sometimes it is also directly used in a special fabric computer simulation. It is an important means of testing the results of fabric computer-aided design [7]. The powerful fabric computer simulation function will greatly facilitate the designer to check the fabric effect of the designed product at any time during the design process and then be able to make timely and effective design modifications [8, 9]. This fabric computer simulation can greatly improve the design quality and work efficiency, but more importantly, it has completely changed the traditional mode of fabric design and production [10]:(1)FRj=D2jp×q,where FRj represents the quality of the fabric, D represents the diameter of the fabric, and p and q represent the correlation coefficient of the fabric. The frame rate of change is a physical quantity that describes the speed of frame movement [11]:(2)FCMk=1p×q×omax∑t=1p∑j=1qoi,j.Among them,FCMk represents the frame change rate of the k th image frame. Because the color peak value of the fabric is constantly changing with the correlation coefficient, therefore, try not to use a single peak as the main color feature of the venue [2, 12]:(3)mean=∑i=imini=imaxhisti×i∑i=imini=imaxhisti.Among them,histi represents color statistics [13]:(4)SEc=exp1−ncα.Among them,SE is the lens conversion rate and c is the lens index value [14]. The specific definition of frame motion intensity is as follows:(5)LMIc=1nc×mc∑j=1ncmcj,where LMIc represents the lens motion intensity of the c lens [15]. Kalman filtering is an algorithm that uses linear state equations to optimally estimate state through input and output observation data. Since the observation data includes the influence of noise and interference in the outside world, the optimal estimation can also be regarded as a filtering process. When using Kalman filter [16],(6)Xk|k−1=AXk|k−1+BUk.Calculate the optimal estimate from the observed valueZk to modify the predicted value:(7)Xk|k−1=Xk|k−1+KkZk−HXk|k−1.Among them,A and B are parameters and H represents the observation parameters.In the execution stage, the connection structure and weight coefficients of the network have been determined and will not change. At this time, there are [17](8)Ut+1=∑j=1nWijt+1Xjt−θt+1.Among them,Wij is the weight coefficient of the connection between the i neuron and the previous j neuron. The motion attitude determination optimization algorithm has faster convergence speed and better optimization effect, which is very suitable for large-scale data or large-scale model problems [4]:(9)mt=β1mt−1+1−β1gt,vt=β1vt−1+1−β1gt2,θt+1=θ−ηv+εm.Among them,mt and vt calculate the first and second moments of the gradient. In order to ensure stability, it is necessary to simulate the applications installed on the cloud computing and the entire operating environment of the cloud computing [18]:(10)lqm=ΔQQ0∗100%=1−exp∑i−kmaxtiexp−ERT∗100%.Among them,ΔQ and Q0 are the data entered before and after:(11)CLi=LNodei×CACrCNodep+LAC×1−CACrCNodepLevel.Among them,CLi represents the resource service capabilities provided. In this basic framework, it is very important to study the interaction and collaboration between the edge (fog) and the core (cloud) [19]:(12)Mt=Mt1+Mt−11+⋯+Mt−N+11N=Mt2+Mt1−Mt−N1N.Among them,N is the number of data and Mt is the test data. The 3D fitting process based on computer simulation is shown in Figure 1.Figure 1
3D fitting process based on computer simulation (http://alturl.com/vq2gu).


## 2.2. Three-Dimensional Fabric Geometric Model

In addition to the weight of the fabric itself, the forces it receives are only external forces, such as wind and air resistance. This divides the effect of wind on the fabric into two parts, namely, the regular part and the irregular part in the wind. In order to describe the effect of wind on the deformation of fabric texture, we apply an external force to the fabric texture deformation model and then use this to describe the effect of wind and air resistance on fabric texture deformation [20]:(13)FD=0.5MDρvr2Ssinθ,FL=0.5MLρvr2Scosθ.The liftF is perpendicular to the direction of relative velocity. The wind force acting on the fabric is divided into a regular part and an irregular part. The regular part force is simulated by establishing the fabric dynamic equation, and the irregular force is simulated by using a random signal method [21, 22]. In addition, we can also simulate the influence of fabric material properties on fabric deformation [23]. The irregular part of the wind can be controlled by a set of cosine functions Gi [24]:(14)Gix,y,z=AicosωDix+Diy.A piecewise linear equation is used to express the relationship between the amplitudeA and the abscissa x [25, 26]:(15)A=kix+b.The wave equation of the fabric movement process is simulated by the superposition of several cosine functions. Through amplitude modulation (for example, the waveform may correspond to the sound reproduced by the speaker or it may correspond to the light intensity of the TV pixel. This method is in contrast to the frequency modulation, where the carrier frequency changes, and the phase modulation, where the phase changes.), the final signal can be expressed as,(16)Fx,y,z=∑Hjx,y,z×∑cosωDix+Diy+S1t.The combination of fabric dynamics equation and random signal is realized through the process of amplitude modulation. Due to the influence of gravity, rod tension, and wind rules on the movement of the fabric, the carrier signal of the baseband function is realized by the amplitude modulation method. The wind can be modeled as an incompressible constant-density fluid, and the numerical approximation method can be significantly simplified. The simplified N-S equation can be expressed in a compact vector representation:(17)∂F∂t=−F⋅∇F−1β∇p+v∇2F,where F represents the three-dimensional velocity field and v represents the kinematic viscosity of the fluid [27].


## 3. Interactive Clothing Design Experiment

### 3.1. 3D Model Source

In the virtual fitting room, the main objects involved are people and clothes. Therefore, the 3D model here also mainly refers to the human body model and the clothes model. At present, 3D model-making software such as 3DSMAX, MAYA, and AutoCAD has been very popular and mature, and related instructional tutorials are also spread in bookstores and networks. Take AutoDesk’s 3DSMAX software as an example, and we can use it to easily create various 3D models of clothes, mannequins, and so on. The software can view objects from multiple different perspectives and perform real-time rendering and display.The produced 3D model can be saved as a model file with the suffix max for later use or further modification. In addition to our own use of 3DSMAX software to make models, there are also many ready-made, very rich 3D model resources in the network. Most of them can be downloaded for free and used in our simulation for exploration and research. Regarding the human body model, we need to consider different information such as gender, height, fat, and thin. In addition, different facial expressions, hairstyles, etc. need to be considered. For this reason, regarding the difference between height, fat, and thin, we either use algorithms, software, and other means to parameterize the human body of a specific gender, or we can make a specific model for the human body of different height and weight and build a human body model library. Various hairstyles also need to establish a hairstyle library. After selecting the corresponding model from the model library according to the customer’s measurement information and then using texture mapping, the customer’s own facial photos can be pasted to the head of the mannequin with the help of texture mapping so that the body shape of the customer can be almost completely established.


### 3.2. Realization of Virtual Clothing

#### 3.2.1. Establishment of Human Body Model

In the field of 3D clothing, a more important research topic is human body modeling. On the one hand, the model is the object to be drawn by computer graphics, and its intuitive performance is different body characteristics such as tall, short, fat, and thin. On the other hand, the spatial characteristics of the human body model is an important calculation basis to realize collision detection. According to the characteristics and mechanism of the realization process, modeling is mainly divided into the following three categories: primitive construction method requires the modeler to have a relatively complete background knowledge of human body structure and geometric modeling skills, which is the most difficult, model reconstruction method requires three-dimensional scanning equipment to reconstruct the human body in three dimensions with the help of instrument measurement information, and sample interpolation synthesis method first uses the above two methods to construct a human body sample library and then obtains the human body model according to the personalized parameter interpolation calculation.


#### 3.2.2. Establishment of Clothing Model

Building a clothing model is particularly important for the effect of trying on. The clothing that needs to be displayed can be scanned and then input into the computer to build the model. You can also directly build the model in 3DMAX and other software and then map its surface texture or use it directly built the clothing model. At present, clothing modeling methods mainly include geometric, physical, and hybrid modeling. The hybrid modeling method combines the advantages of geometric modeling and physical modeling. It uses geometric methods to build clothing models and then uses physical methods to simulate local physical characteristics.


### 3.3. Model Loading and Key Frame Storage

3ds model file is one of the most common 3D model file types. The advantage of this kind of model file is that it is directly supported by the 3DSMAX software and can easily export the max format model file to the 3ds format, which is good for general purpose. The 3ds file structure logic is rigorous and hierarchical. It has decoded and disclosed the internal structure features of the file to facilitate the direct secondary and use of third-party programs. The idea of this article is to give priority to support models such as flags, clothes, and mannequins made up of triangles in the program. For this reason, the 3ds model file format can meet our current needs. The specific method is to first generate the max model file through 3DSMAX software (or search some shared max files from the Internet) and then export it as a 3ds file; then, the program can load and store the 3ds file.3ds files are based on the “chunk” storage structure. Each block contains two parts: the block header and the block content. The block number is an unsignedshort type of 2 bytes, and the block length is an unsignedint type of 4 bytes, as shown in Table1.Table 1
Unsignedint type.
OffsetLengthDescription02Block ID24Block length n6n−6Block dataThe blocks in the 3ds file are stored in a nested manner, and multiple child blocks can be stored in a parent block. Under normal circumstances, first is a top-level root block (block name: MAIN3DS, ID: 0x4D4D), the root block contains a version information block (block name: VERSION, ID: 0x0002) and an editing information block (block name: EDIT3DS, ID: 0x3D3D). There is also a key frame information block (block name: KEYF3DS, ID: 0xB000). Editing information block EDIT3DS further contains more subblocks, such as model vertices, faces, lighting, texture materials, and other subblock information. For each type of data in the 3ds file, it is stored in the order of low byte first and high byte last. The 3D model in the 3ds file is analyzed by the loop body nested switch branch selection structure. Load operation: the advantage of this is that when you detect any type of block, you can read which block, without worrying about the sequence and presence of the blocks in the file. Correspondingly, the write-back operation of 3ds files is similar. According to the general structure of the 3ds file, write the root block, version information block, edit information block, key frame information block, etc. in sequence to a brand new file. The reason why this article needs to write back the 3ds file is mainly that, after the clothing model is dynamically simulated by the dynamics principle, the deformed key animation frame needs to be saved as a 3ds file so that it can be further imported into the 3DSMAX software to generate higher quality picture information with a renderer and finally get a high-definition clothing animation video. For this reason, in most cases, we only need to rewrite the coordinate position information of the vertices in the original 3ds file, and other textures, patches, and other information can be copied directly.


### 3.4. Mannequin Action Library

The method of this article is similar, using the bone skinning in 3DSMAX to realize the animation frame of human walking. In order to allow the program to further read and load the human walking animation, it is necessary to try to convert the animation done in 3DSMAX into a way that can be read by a third-party program, as in the previous section. For this reason, our final plan is to make the human model and walking animation we need in the 3DSMAX software, then move the time slider to a certain key point in turn, and export the human model actions at this time as a 3ds file. Continuing the same procedure, you can get the file sequence of human walking 3ds format in the chronological order. We found in actual operation that, in these 3ds files, not only the shape of the key points after the deformation of the human body is saved, but the corresponding bone block data is also saved at the same time. To this end, we also need to re-import these 3ds files into 3DSMAX software in turn, delete the bone-related data, and then re-export them to 3ds format model files. In this way, we can use the 3ds model loading module in the previous section to directly read the key sequence of human walking motion from these 3ds file sequences and prepare for the subsequent key frame animation of clothes.


### 3.5. Key Frame Animation

In computers, key frames are generally used to achieve animation effects. Usually, when the continuous action key frames of more than 25 frames are played continuously every second, the visually continuous animation effect can be realized. The traditional movie film is actually composed of continuous pictures one after another to form a coherent video. Computer monitors also use this principle to display frames of pictures on the screen. The physics-based dynamics simulation animation actually generates a frame of image sequence according to a certain time step. Later, by continuously replaying these image sequences, continuous animation can be realized. Due to the complexity of clothing simulation, with the current level of computer performance, it is still difficult to achieve real-time animation while simulating. In order to solve this problem, our approach is to store each key frame obtained by simulation in a disk file in time order. Before playing the animation, first load the first K animation frames into the memory at once and then use multithreading to play, while continuing to load the subsequent animation frames. The value of K can be determined according to the specific performance. On a PC with a 2.91Ghz dual-core CPU and 2.0 GB memory, it is completely acceptable to load 20,000 frames of data at one time and then play the animation. In the process of clothing simulation, whenever a frame of animation is generated, we need to save it to a disk file in time. For the animation frames of clothes following the movement of the mannequin, in order to further reduce the storage space and loading time during post-play, we have designed the binary file structure of each clothing animation frame by ourselves. In each frame, the first is the frame unique identifier, frame type, frame version number, etc., followed by the index sequence number. Then, the sequence number and position offset of the mannequin action key frame associated with the current clothes frame are stored. In this way, the information in the mannequin action library can be directly reused to achieve cycle walking without additional storage and loading. The position offset is mainly realized by using a cycle of walking motion frames of the human body to realize a cyclic walking animation. Next, it is to record the status information of the current clothes, that is, the number of vertices and the list of coordinates of each vertex. In order to further improve the loading performance of key frames, dozens of frames of motion information can be stored in one file.


## 3.1. 3D Model Source

In the virtual fitting room, the main objects involved are people and clothes. Therefore, the 3D model here also mainly refers to the human body model and the clothes model. At present, 3D model-making software such as 3DSMAX, MAYA, and AutoCAD has been very popular and mature, and related instructional tutorials are also spread in bookstores and networks. Take AutoDesk’s 3DSMAX software as an example, and we can use it to easily create various 3D models of clothes, mannequins, and so on. The software can view objects from multiple different perspectives and perform real-time rendering and display.The produced 3D model can be saved as a model file with the suffix max for later use or further modification. In addition to our own use of 3DSMAX software to make models, there are also many ready-made, very rich 3D model resources in the network. Most of them can be downloaded for free and used in our simulation for exploration and research. Regarding the human body model, we need to consider different information such as gender, height, fat, and thin. In addition, different facial expressions, hairstyles, etc. need to be considered. For this reason, regarding the difference between height, fat, and thin, we either use algorithms, software, and other means to parameterize the human body of a specific gender, or we can make a specific model for the human body of different height and weight and build a human body model library. Various hairstyles also need to establish a hairstyle library. After selecting the corresponding model from the model library according to the customer’s measurement information and then using texture mapping, the customer’s own facial photos can be pasted to the head of the mannequin with the help of texture mapping so that the body shape of the customer can be almost completely established.


## 3.2. Realization of Virtual Clothing

### 3.2.1. Establishment of Human Body Model

In the field of 3D clothing, a more important research topic is human body modeling. On the one hand, the model is the object to be drawn by computer graphics, and its intuitive performance is different body characteristics such as tall, short, fat, and thin. On the other hand, the spatial characteristics of the human body model is an important calculation basis to realize collision detection. According to the characteristics and mechanism of the realization process, modeling is mainly divided into the following three categories: primitive construction method requires the modeler to have a relatively complete background knowledge of human body structure and geometric modeling skills, which is the most difficult, model reconstruction method requires three-dimensional scanning equipment to reconstruct the human body in three dimensions with the help of instrument measurement information, and sample interpolation synthesis method first uses the above two methods to construct a human body sample library and then obtains the human body model according to the personalized parameter interpolation calculation.


### 3.2.2. Establishment of Clothing Model

Building a clothing model is particularly important for the effect of trying on. The clothing that needs to be displayed can be scanned and then input into the computer to build the model. You can also directly build the model in 3DMAX and other software and then map its surface texture or use it directly built the clothing model. At present, clothing modeling methods mainly include geometric, physical, and hybrid modeling. The hybrid modeling method combines the advantages of geometric modeling and physical modeling. It uses geometric methods to build clothing models and then uses physical methods to simulate local physical characteristics.


## 3.2.1. Establishment of Human Body Model

In the field of 3D clothing, a more important research topic is human body modeling. On the one hand, the model is the object to be drawn by computer graphics, and its intuitive performance is different body characteristics such as tall, short, fat, and thin. On the other hand, the spatial characteristics of the human body model is an important calculation basis to realize collision detection. According to the characteristics and mechanism of the realization process, modeling is mainly divided into the following three categories: primitive construction method requires the modeler to have a relatively complete background knowledge of human body structure and geometric modeling skills, which is the most difficult, model reconstruction method requires three-dimensional scanning equipment to reconstruct the human body in three dimensions with the help of instrument measurement information, and sample interpolation synthesis method first uses the above two methods to construct a human body sample library and then obtains the human body model according to the personalized parameter interpolation calculation.


## 3.2.2. Establishment of Clothing Model

Building a clothing model is particularly important for the effect of trying on. The clothing that needs to be displayed can be scanned and then input into the computer to build the model. You can also directly build the model in 3DMAX and other software and then map its surface texture or use it directly built the clothing model. At present, clothing modeling methods mainly include geometric, physical, and hybrid modeling. The hybrid modeling method combines the advantages of geometric modeling and physical modeling. It uses geometric methods to build clothing models and then uses physical methods to simulate local physical characteristics.


## 3.3. Model Loading and Key Frame Storage

3ds model file is one of the most common 3D model file types. The advantage of this kind of model file is that it is directly supported by the 3DSMAX software and can easily export the max format model file to the 3ds format, which is good for general purpose. The 3ds file structure logic is rigorous and hierarchical. It has decoded and disclosed the internal structure features of the file to facilitate the direct secondary and use of third-party programs. The idea of this article is to give priority to support models such as flags, clothes, and mannequins made up of triangles in the program. For this reason, the 3ds model file format can meet our current needs. The specific method is to first generate the max model file through 3DSMAX software (or search some shared max files from the Internet) and then export it as a 3ds file; then, the program can load and store the 3ds file.3ds files are based on the “chunk” storage structure. Each block contains two parts: the block header and the block content. The block number is an unsignedshort type of 2 bytes, and the block length is an unsignedint type of 4 bytes, as shown in Table1.Table 1
Unsignedint type.
OffsetLengthDescription02Block ID24Block length n6n−6Block dataThe blocks in the 3ds file are stored in a nested manner, and multiple child blocks can be stored in a parent block. Under normal circumstances, first is a top-level root block (block name: MAIN3DS, ID: 0x4D4D), the root block contains a version information block (block name: VERSION, ID: 0x0002) and an editing information block (block name: EDIT3DS, ID: 0x3D3D). There is also a key frame information block (block name: KEYF3DS, ID: 0xB000). Editing information block EDIT3DS further contains more subblocks, such as model vertices, faces, lighting, texture materials, and other subblock information. For each type of data in the 3ds file, it is stored in the order of low byte first and high byte last. The 3D model in the 3ds file is analyzed by the loop body nested switch branch selection structure. Load operation: the advantage of this is that when you detect any type of block, you can read which block, without worrying about the sequence and presence of the blocks in the file. Correspondingly, the write-back operation of 3ds files is similar. According to the general structure of the 3ds file, write the root block, version information block, edit information block, key frame information block, etc. in sequence to a brand new file. The reason why this article needs to write back the 3ds file is mainly that, after the clothing model is dynamically simulated by the dynamics principle, the deformed key animation frame needs to be saved as a 3ds file so that it can be further imported into the 3DSMAX software to generate higher quality picture information with a renderer and finally get a high-definition clothing animation video. For this reason, in most cases, we only need to rewrite the coordinate position information of the vertices in the original 3ds file, and other textures, patches, and other information can be copied directly.


## 3.4. Mannequin Action Library

The method of this article is similar, using the bone skinning in 3DSMAX to realize the animation frame of human walking. In order to allow the program to further read and load the human walking animation, it is necessary to try to convert the animation done in 3DSMAX into a way that can be read by a third-party program, as in the previous section. For this reason, our final plan is to make the human model and walking animation we need in the 3DSMAX software, then move the time slider to a certain key point in turn, and export the human model actions at this time as a 3ds file. Continuing the same procedure, you can get the file sequence of human walking 3ds format in the chronological order. We found in actual operation that, in these 3ds files, not only the shape of the key points after the deformation of the human body is saved, but the corresponding bone block data is also saved at the same time. To this end, we also need to re-import these 3ds files into 3DSMAX software in turn, delete the bone-related data, and then re-export them to 3ds format model files. In this way, we can use the 3ds model loading module in the previous section to directly read the key sequence of human walking motion from these 3ds file sequences and prepare for the subsequent key frame animation of clothes.


## 3.5. Key Frame Animation

In computers, key frames are generally used to achieve animation effects. Usually, when the continuous action key frames of more than 25 frames are played continuously every second, the visually continuous animation effect can be realized. The traditional movie film is actually composed of continuous pictures one after another to form a coherent video. Computer monitors also use this principle to display frames of pictures on the screen. The physics-based dynamics simulation animation actually generates a frame of image sequence according to a certain time step. Later, by continuously replaying these image sequences, continuous animation can be realized. Due to the complexity of clothing simulation, with the current level of computer performance, it is still difficult to achieve real-time animation while simulating. In order to solve this problem, our approach is to store each key frame obtained by simulation in a disk file in time order. Before playing the animation, first load the first K animation frames into the memory at once and then use multithreading to play, while continuing to load the subsequent animation frames. The value of K can be determined according to the specific performance. On a PC with a 2.91Ghz dual-core CPU and 2.0 GB memory, it is completely acceptable to load 20,000 frames of data at one time and then play the animation. In the process of clothing simulation, whenever a frame of animation is generated, we need to save it to a disk file in time. For the animation frames of clothes following the movement of the mannequin, in order to further reduce the storage space and loading time during post-play, we have designed the binary file structure of each clothing animation frame by ourselves. In each frame, the first is the frame unique identifier, frame type, frame version number, etc., followed by the index sequence number. Then, the sequence number and position offset of the mannequin action key frame associated with the current clothes frame are stored. In this way, the information in the mannequin action library can be directly reused to achieve cycle walking without additional storage and loading. The position offset is mainly realized by using a cycle of walking motion frames of the human body to realize a cyclic walking animation. Next, it is to record the status information of the current clothes, that is, the number of vertices and the list of coordinates of each vertex. In order to further improve the loading performance of key frames, dozens of frames of motion information can be stored in one file.


## 4. Results and Discussion

### 4.1. 3D Fabric Texture Deformation Simulation

It is realized by combining the MATLABFEM toolbox and the NN toolbox. In the simulation process, the fabric wrinkle model is first established by the B-spline curve method. 20 control points are selected on each B-spline curve, and a total of 20 B-spline curves are used to establish the wrinkles of the fabric. In this way, a total of 400 control nodes complete a fabric surface model. Then, use the FEM toolbox to load the fabric force, including the fabric gravity, the fabric is pulled by the rod, and there is a parallel and stable wind force. In the process of FEM meshing, the neural network model is used to control the dynamic meshing of finite element. The effect of MATLAB meshing is shown in Figure2. The specifications of clothing accessories are shown in Table 2.Figure 2
The effect of MATLAB meshing (http://alturl.com/c4dkq).Table 2
Clothing accessories’ specifications.
Specification speciesSizeFabric25  cm × 7  cmPocket pad17  cm × 5  cmNoodles50 pcsBottom line50 pcsLining15 cm × 2 cmFor the texture color value of the three-dimensional deformed fabric, the analysis problem of the viewing angle parameter is added. Regarding the plane deformation from any angle, as long as the viewpoint is above the fabric, the observed texture deformation is the same. For 3D fabric texture deformation, the observed texture deformation effects are quite different. Therefore, we need to consider the difference in visual effects caused by different viewing angles. When calculating the points on the spline control curve and other points on the surface, a projection transformation operation is required, that is, the distance between two points is calculated. We control the parameters in the B-spline curve for analysis according to the different deformation of the fabric texture. The color value of the control point on the curve can be set according to the curve length in advance, and the color value of the point outside the control point can be obtained by using linear interpolation. In order to realize the smooth playback of clothes animation, we use linked list storage in the memory. For deformable bodies such as cloth and clothes, since the vertex position and normal information change in each frame, we are the same as the storage format in the disk file and mainly store thise key information in each frame node. The gray-scale processing effect of MATLAB on the fabric is shown in Figure3. The key action frame information structure is shown in Table 3.Figure 3
The gray-scale processing effect of MATLAB on the fabric.Table 3
Key action frame information.
OffsetLengthDescription02Frame ID22Frame type42Version number64Frame number104Human action frame number144Human body action frame position offset182Apex days20nItem coordinate listNo. 01–04 fabrics are affected by various influencing factors. Among them, No. 04 woolen thick material is most affected by the back needle length, which is −0.787. The experimental average bag length is only 131.21 mm. Worsted thin material is hardly affected by the length of the back needle, the stitch length, the start/tail seam length, and the correlation coefficient between the bag length and the back needle length is only 0.143, while the experimental average bag length is 138.48 mm. The length of the clothes pockets made in the experiment are all 140 mm, but due to the different degree of influence, the experimental results show that each clothes pocket cannot reach this ideal value. It can be seen that the general trend is the thinner the fabric, the smaller the pocket size change, and the thicker the fabric, the greater the change. The average length of the clothes pocket of No. 03 fabric is slightly larger than that of No. 02 fabric, and the thickness and weight of No. 03 fabric are larger than those of No. 02 fabric. This is contrary to the experimental conclusion. However, we found that the fabric of No. 03 is sparser than that of No. 02, so we believe that the change in the length of the clothes pocket has a very important relationship with the tightness of the fabric. The experimental average values of 01 and 02 fabrics are shown in Table4. The experimental average values of 03 and 04 fabrics are shown in Table 5. The comparison of elastic coefficients of the four fabrics is shown in Figure 4. Figure 5 shows the animation types of clothes pockets made of 4 kinds of fabrics.Table 4
01 and 02 fabric experimental average.
Pocket parametersNumerical valueMean01Mean02Bag length138.48138.22Beginning and ending stitch length1.4501.466Middle stitch length2.2002.22Back needle length6.606.77Table 5
03 and 04 fabric experimental average.
Pocket parametersNumerical valueMean03Mean04Bag length158.22178.22Beginning and ending stitch length2.4664.466Middle stitch length4.226.22Back needle length8.7710.77Figure 4
Comparison of elastic coefficients of various fabrics.Figure 5
Animation types of clothes pockets made of different fabrics (http://alturl.com/qb5jb).Because the fabrics 01 to 03 used in this experiment are fabrics commonly used in general suit making, fabrics 04 are thick and sparse fabrics commonly used in autumn and winter. It can be seen from the experimental results that the change of the 01–03 fabric is 1.5mm-2 mm, and the change of the 04 fabric is much larger than the changes of the other three fabrics, about 8 mm. In the actual operation process, if the size of a clothing pocket changes to 8 mm, on the one hand, it will exceed the customer order tolerance (allowable error range) and face the risk of return. On the other hand, due to the reduction of too much volume, it may cause the clothes to be returned. The pockets shrink and affect the appearance of clothing pockets. The experimental data of No. 04 fabric can be seen: when setting the same pocket length, the longer the back stitch, the shorter the bag length; when the same back stitch length, the longer the starting stitch length, the shorter the pocket. As the sewing thread will shuttle back and forth in the fabric during the sewing process, it will inevitably cause a certain amount of traction on the fabric, so the chance of such traction should be minimized. This should shorten the length of the reverse needle and the starting needle length within the allowable range. In addition, clothing pockets of the same length and different stitch lengths will produce different numbers of stitches. In order to reduce the number of stitches and the chance of contact between the suture and the fabric, the stitch length can be increased appropriately. For fabrics that are thicker and sparser, they are more sensitive to changes in various factors, so you should appropriately reduce the size of the back stitch length and the starting seam length, increase the stitch length, and think that the back stitch is 3 mm, the start/tail seam is 5 mm, and the stitch length is 3 mm, and this set of data is more suitable for fabrics such as No. 04. The research data of No. 04 fabric is shown in Table6. The analysis of the research data of No. 04 fabric is shown in Figure 6.Table 6
04 fabric research data.
NumberBag lengthBeginning and ending stitch lengthMiddle stitch lengthBack needle length11301.82.51021301.82.5103130.51.81.51041311.81.51051311.82.5561321.82.5571312.52.510813 12.52.510Figure 6
Analysis of the research data of fabric No. 4.


### 4.2. Animation Simulation analysis

The simulations were performed using pure CPU mode, pure GPU mode, and CPU/GPU hybrid architecture mode. Time statistics are shown in Table7, and the performance comparison of each stage is shown in Figure 7. It can be seen from Figure 7 that the GPU has a speedup of 30–40 times compared to the CPU in the higher parallel stages such as force calculation, collision processing, and position update. However, when dealing with over-stretching, the degree of parallelism is not high, and the performance drops instead so that the overall performance is only improved by less than 2 times compared with the CPU method. In the CPU-GPU hybrid method, modules such as force calculation, collision processing, and position update use the GPU method, while over-stretching is processed by the CPU method, making the overall performance 10 times higher than the pure CPU method. The clothing animation interface is shown in Figure 8.Table 7
Simulation time statistics.
MethodForce calculation (S)Collision detection (s)Location update (S)Stretching treatment (S)Data transmission (s)Total time (s)CPU20.35221068.3356127.3097835.5845850.00000099.642260GPU0.5831961.7661770.24160150.5234340.97467850.629531CPU-GPU0.5825131.8048240.2411955.5891831.86206510.333219Figure 7
Performance comparison of each stage.Figure 8
Clothing animation interface display (http://alturl.com/f877f).


## 4.1. 3D Fabric Texture Deformation Simulation

It is realized by combining the MATLABFEM toolbox and the NN toolbox. In the simulation process, the fabric wrinkle model is first established by the B-spline curve method. 20 control points are selected on each B-spline curve, and a total of 20 B-spline curves are used to establish the wrinkles of the fabric. In this way, a total of 400 control nodes complete a fabric surface model. Then, use the FEM toolbox to load the fabric force, including the fabric gravity, the fabric is pulled by the rod, and there is a parallel and stable wind force. In the process of FEM meshing, the neural network model is used to control the dynamic meshing of finite element. The effect of MATLAB meshing is shown in Figure2. The specifications of clothing accessories are shown in Table 2.Figure 2
The effect of MATLAB meshing (http://alturl.com/c4dkq).Table 2
Clothing accessories’ specifications.
Specification speciesSizeFabric25  cm × 7  cmPocket pad17  cm × 5  cmNoodles50 pcsBottom line50 pcsLining15 cm × 2 cmFor the texture color value of the three-dimensional deformed fabric, the analysis problem of the viewing angle parameter is added. Regarding the plane deformation from any angle, as long as the viewpoint is above the fabric, the observed texture deformation is the same. For 3D fabric texture deformation, the observed texture deformation effects are quite different. Therefore, we need to consider the difference in visual effects caused by different viewing angles. When calculating the points on the spline control curve and other points on the surface, a projection transformation operation is required, that is, the distance between two points is calculated. We control the parameters in the B-spline curve for analysis according to the different deformation of the fabric texture. The color value of the control point on the curve can be set according to the curve length in advance, and the color value of the point outside the control point can be obtained by using linear interpolation. In order to realize the smooth playback of clothes animation, we use linked list storage in the memory. For deformable bodies such as cloth and clothes, since the vertex position and normal information change in each frame, we are the same as the storage format in the disk file and mainly store thise key information in each frame node. The gray-scale processing effect of MATLAB on the fabric is shown in Figure3. The key action frame information structure is shown in Table 3.Figure 3
The gray-scale processing effect of MATLAB on the fabric.Table 3
Key action frame information.
OffsetLengthDescription02Frame ID22Frame type42Version number64Frame number104Human action frame number144Human body action frame position offset182Apex days20nItem coordinate listNo. 01–04 fabrics are affected by various influencing factors. Among them, No. 04 woolen thick material is most affected by the back needle length, which is −0.787. The experimental average bag length is only 131.21 mm. Worsted thin material is hardly affected by the length of the back needle, the stitch length, the start/tail seam length, and the correlation coefficient between the bag length and the back needle length is only 0.143, while the experimental average bag length is 138.48 mm. The length of the clothes pockets made in the experiment are all 140 mm, but due to the different degree of influence, the experimental results show that each clothes pocket cannot reach this ideal value. It can be seen that the general trend is the thinner the fabric, the smaller the pocket size change, and the thicker the fabric, the greater the change. The average length of the clothes pocket of No. 03 fabric is slightly larger than that of No. 02 fabric, and the thickness and weight of No. 03 fabric are larger than those of No. 02 fabric. This is contrary to the experimental conclusion. However, we found that the fabric of No. 03 is sparser than that of No. 02, so we believe that the change in the length of the clothes pocket has a very important relationship with the tightness of the fabric. The experimental average values of 01 and 02 fabrics are shown in Table4. The experimental average values of 03 and 04 fabrics are shown in Table 5. The comparison of elastic coefficients of the four fabrics is shown in Figure 4. Figure 5 shows the animation types of clothes pockets made of 4 kinds of fabrics.Table 4
01 and 02 fabric experimental average.
Pocket parametersNumerical valueMean01Mean02Bag length138.48138.22Beginning and ending stitch length1.4501.466Middle stitch length2.2002.22Back needle length6.606.77Table 5
03 and 04 fabric experimental average.
Pocket parametersNumerical valueMean03Mean04Bag length158.22178.22Beginning and ending stitch length2.4664.466Middle stitch length4.226.22Back needle length8.7710.77Figure 4
Comparison of elastic coefficients of various fabrics.Figure 5
Animation types of clothes pockets made of different fabrics (http://alturl.com/qb5jb).Because the fabrics 01 to 03 used in this experiment are fabrics commonly used in general suit making, fabrics 04 are thick and sparse fabrics commonly used in autumn and winter. It can be seen from the experimental results that the change of the 01–03 fabric is 1.5mm-2 mm, and the change of the 04 fabric is much larger than the changes of the other three fabrics, about 8 mm. In the actual operation process, if the size of a clothing pocket changes to 8 mm, on the one hand, it will exceed the customer order tolerance (allowable error range) and face the risk of return. On the other hand, due to the reduction of too much volume, it may cause the clothes to be returned. The pockets shrink and affect the appearance of clothing pockets. The experimental data of No. 04 fabric can be seen: when setting the same pocket length, the longer the back stitch, the shorter the bag length; when the same back stitch length, the longer the starting stitch length, the shorter the pocket. As the sewing thread will shuttle back and forth in the fabric during the sewing process, it will inevitably cause a certain amount of traction on the fabric, so the chance of such traction should be minimized. This should shorten the length of the reverse needle and the starting needle length within the allowable range. In addition, clothing pockets of the same length and different stitch lengths will produce different numbers of stitches. In order to reduce the number of stitches and the chance of contact between the suture and the fabric, the stitch length can be increased appropriately. For fabrics that are thicker and sparser, they are more sensitive to changes in various factors, so you should appropriately reduce the size of the back stitch length and the starting seam length, increase the stitch length, and think that the back stitch is 3 mm, the start/tail seam is 5 mm, and the stitch length is 3 mm, and this set of data is more suitable for fabrics such as No. 04. The research data of No. 04 fabric is shown in Table6. The analysis of the research data of No. 04 fabric is shown in Figure 6.Table 6
04 fabric research data.
NumberBag lengthBeginning and ending stitch lengthMiddle stitch lengthBack needle length11301.82.51021301.82.5103130.51.81.51041311.81.51051311.82.5561321.82.5571312.52.510813 12.52.510Figure 6
Analysis of the research data of fabric No. 4.


## 4.2. Animation Simulation analysis

The simulations were performed using pure CPU mode, pure GPU mode, and CPU/GPU hybrid architecture mode. Time statistics are shown in Table7, and the performance comparison of each stage is shown in Figure 7. It can be seen from Figure 7 that the GPU has a speedup of 30–40 times compared to the CPU in the higher parallel stages such as force calculation, collision processing, and position update. However, when dealing with over-stretching, the degree of parallelism is not high, and the performance drops instead so that the overall performance is only improved by less than 2 times compared with the CPU method. In the CPU-GPU hybrid method, modules such as force calculation, collision processing, and position update use the GPU method, while over-stretching is processed by the CPU method, making the overall performance 10 times higher than the pure CPU method. The clothing animation interface is shown in Figure 8.Table 7
Simulation time statistics.
MethodForce calculation (S)Collision detection (s)Location update (S)Stretching treatment (S)Data transmission (s)Total time (s)CPU20.35221068.3356127.3097835.5845850.00000099.642260GPU0.5831961.7661770.24160150.5234340.97467850.629531CPU-GPU0.5825131.8048240.2411955.5891831.86206510.333219Figure 7
Performance comparison of each stage.Figure 8
Clothing animation interface display (http://alturl.com/f877f).


## 5. Conclusion

This research mainly discusses the real-time animation complex of interactive clothing design based on computer simulation. In the process of realizing virtual clothing, the sample interpolation synthesis method is used, and the human body sample library is constructed using the above two methods first, and then, the human body model is obtained by interpolation calculation according to the personalized parameters. Building a clothing model is particularly important for the effect of trying on. The clothing that needs to be displayed can be scanned and then input into the computer to build the model. You can also directly build the model in 3DMAX and other software and then map its surface texture or use it directly built clothing model. The 3D model in the 3ds file is loaded by the loop body nested switch branch selection structure. Correspondingly, the write-back operation of 3ds files is similar. Just follow the general structure of the 3ds file and write the root block, version information block, edit information block, key frame information block, etc. to a brand new file in sequence. The main reason for this article to perform the 3ds file write-back operation is that, after the clothing model is dynamically simulated through the dynamic principle, the deformed key animation frame needs to be saved as a 3ds file so that it can be further imported into the 3DSMAX software and generated by the renderer, form high-quality picture information, and finally get high-definition animation video. This research helps to promote the development of 3D virtual clothing design.



---

*Source: 9988623-2021-05-11.xml*