Virtual character costume fitting method, device, equipment, medium and program product
By establishing a three-dimensional spatial mesh and introducing smoothing constraints, the distortion problem of clothing models in cross-body shape clothing transfer was solved, achieving smooth adaptation of clothing to the target body shape and preservation of geometric features.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU BOGUAN TELECOMM TECH LTD
- Filing Date
- 2026-03-12
- Publication Date
- 2026-06-26
Smart Images

Figure CN122289602A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer graphics technology, specifically to methods, apparatus, devices, media, and program products for clothing adaptation of virtual characters. Background Technology
[0002] In game development, film and animation production, and virtual reality applications, it is often necessary to automatically adapt clothing models designed for specific body types to character models of different body types (such as varying heights and builds). Existing clothing transfer technologies typically employ deformation algorithms based on spatial position interpolation, driving clothing deformation according to the correspondence between the source and target human body surfaces. However, when dealing with looser clothing (such as long skirts, wide sleeves, and ribbons) or clothing components far from the human body surface, these existing technologies often rely solely on deformation information from the human body surface for simple spatial extrapolation, lacking effective control over the overall continuity of deformation in three-dimensional space. This results in clothing models exhibiting severe mesh distortion, stretching, or even interlacing in areas far from the human body, failing to maintain the original geometric features and design aesthetics of the clothing.
[0003] Therefore, there is an urgent need for a method for adapting clothing to virtual characters in order to solve the problem of unnatural deformation and distortion in the process of transferring clothing across body types. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, medium, and program product for adapting clothing to virtual characters, in order to solve the problem of unnatural deformation and distortion in the process of transferring clothing across body shapes in related technologies.
[0005] Firstly, this disclosure provides a method for clothing adaptation for virtual characters, the method comprising:
[0006] A three-dimensional spatial mesh is created, comprising a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure. Based on the positional correspondence between the source virtual character model and the target virtual character model, and the preset smoothing constraints, the deformation vector of each grid point in the 3D spatial grid is determined; the preset smoothing constraints are used to constrain the difference in deformation vectors between adjacent grid points. Based on the deformation vector of each grid point, the source position of each vertex in the source clothing model is mapped to the target position to generate a target clothing model that matches the target virtual character model.
[0007] Secondly, this disclosure provides a clothing adaptation device for virtual characters, the device comprising: The module is used to create a 3D spatial mesh containing a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure. The determination module is used to determine the deformation vector of each grid point in the 3D spatial grid based on the positional correspondence between the source virtual character model and the target virtual character model, as well as the preset smoothing constraints; the smoothing constraints are used to constrain the difference in deformation vectors between adjacent grid points. The migration module is used to map the source positions of each vertex in the source clothing model to the target positions based on the deformation vectors of each grid point, so as to generate a target clothing model that matches the target virtual character model.
[0008] Thirdly, this disclosure provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the virtual character clothing adaptation method of the first aspect or any corresponding embodiment described above.
[0009] Fourthly, this disclosure provides a computer-readable storage medium storing computer instructions for causing a computer to perform the virtual character clothing adaptation method of the first aspect or any corresponding embodiment described above.
[0010] Fifthly, this disclosure provides a computer program product, including computer instructions for causing a computer to execute the clothing adaptation method for a virtual character according to the first aspect or any corresponding embodiment described above.
[0011] The virtual character clothing adaptation method provided in this disclosure establishes a three-dimensional spatial mesh and introduces smoothing constraints to determine the deformation vector of the mesh points. The smoothing constraints constrain the difference in deformation vectors between adjacent mesh points, ensuring that the deformation field from the source virtual character to the target virtual character remains smooth and continuous throughout the entire three-dimensional space. This processing method smoothly diffuses the deformation of the human body surface throughout the entire space. Even for loose clothing parts far from the human body surface, the surrounding mesh points can be pulled by adjacent mesh points to produce coordinated deformation, effectively avoiding local collapse or severe distortion. While achieving automatic clothing adaptation to the target body shape, it preserves the geometric features and volumetric feel of the source clothing model to the greatest extent possible. Attached Figure Description
[0012] To more clearly illustrate the technical solutions in the specific embodiments of this disclosure or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0013] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this disclosure; Figure 2 This is a schematic flowchart of a first method for adapting clothing to a virtual character according to an embodiment of the present disclosure; Figure 3 This is a schematic diagram of a second process for a method of clothing adaptation for virtual characters according to an embodiment of the present disclosure. Figure 4 This is a scene diagram of a source human body model wearing source clothing and a target human body model not wearing clothing, according to embodiments of this disclosure. Figure 5 This is a schematic diagram of the execution flow of a clothing migration tool according to an embodiment of the present disclosure; Figure 6 This is a schematic diagram of clothing migration results according to an embodiment of the present disclosure; Figure 7 This is a structural block diagram of a clothing adaptation device for virtual characters according to an embodiment of the present disclosure; Figure 8 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this disclosure. Detailed Implementation
[0014] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.
[0015] It should be noted that the information (including but not limited to user input information, such as information entered into input boxes), data (including but not limited to data used for analysis, stored data, and displayed data, such as context code, all code of the current project, service pressure corresponding to operations performed on all code of the current project, and code development status of the current project), and signals involved in this disclosure are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of related data must comply with relevant laws, regulations, and standards. For example, the context code, operations performed on all code of the current project, the corresponding service pressure, and code development status involved in this disclosure were all obtained with full authorization.
[0016] Before providing a detailed description of the embodiments of this disclosure, some of the nouns and terms involved in the embodiments of this disclosure will be explained.
[0017] (1) DCC software (Digital Content Creation): refers to professional software used to create 3D models, animations, and special effects, such as Autodesk Maya and 3ds Max.
[0018] (2) Topology: In 3D modeling, topology refers to the connection method and layout structure of vertices, edges and faces on the surface of a mesh model. Two models with the same topology have the same number of vertices and the connection relationships between the vertices are exactly the same, only the spatial coordinates of the vertices are different.
[0019] (3) RBF (Radial Basis Function): A mathematical algorithm commonly used for interpolation. It is often used to calculate the 3D spatial deformation field from the source model to the target model. However, this method is prone to producing large deformations when dealing with loose clothing that is far from the human body.
[0020] (4) Faceform Wrap: A third-party 3D topology wrapping software commonly used in the industry. It is often used to wrap standard topology structures onto scanned data or other high-poly models to generate topology-consistent models.
[0021] (5) Skinning / Skinning Weights: A step in 3D animation production, which involves binding a 3D mesh to a skeleton. Skinning weights define the degree to which each vertex on the mesh moves when affected by the movement of the skeleton (between 0 and 1).
[0022] (6) Lattice deformation: a spatial deformation technique that drives the deformation of an internal object by changing the coordinates of the lattice nodes after constructing a regular cubic grid (lattice) around the object.
[0023] (7) Centroid coordinates: a local coordinate system that describes the position of a point inside a triangle.
[0024] (8) Trilinear interpolation: an interpolation method in a three-dimensional regular grid that estimates the value of any point inside the grid based on the values of the surrounding 8 vertices.
[0025] (9) Rigid / rigid retention: refers to the fact that the shape and volume of an object remain unchanged during the motion or deformation process (only rotation and translation occur).
[0026] (10) Soft Selection: A selection mode in DCC software. When a vertex is selected, the surrounding vertices will also be partially selected. The weight decreases with distance and is used to achieve smooth transition adjustment.
[0027] As one optional application scenario of this disclosure embodiment, such as Figure 1 As shown, the clothing adaptation method for the virtual character can be applied to a graphics processing system, which may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.
[0028] Specifically, the terminal device can be a desktop computer, laptop computer, or graphics workstation equipped with 3D modeling software (such as Maya, 3ds Max) or a game engine; it can also be a game console, VR (Virtual Reality) device, AR (Augmented Reality) device, etc., capable of running relevant graphics processing applications. Users can import source virtual characters, target virtual characters, and clothing models through the terminal device and execute the clothing adaptation method for virtual characters according to this embodiment. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired network or a wireless network, examples of which include, but are not limited to, the Internet, corporate intranets, local area networks, wide area networks, mobile communication networks, and combinations thereof.
[0029] According to an embodiment of this disclosure, a method for adapting clothing to a virtual character is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0030] This embodiment provides a method for adapting clothing for virtual characters, which can be used in the aforementioned terminal devices, such as desktop computers, laptops, etc. Figure 2 This is a flowchart of a method for adapting clothing for virtual characters according to an embodiment of the present disclosure, such as... Figure 2 As shown, the process includes the following steps: Step S201: Establish a three-dimensional spatial mesh containing a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure.
[0031] A source virtual character model refers to the original human body model used as a reference standard. For example, a standard medium-sized character model in a game. A target virtual character model refers to the human body model of the character to be dressed in clothing. For example, a strong or obese character model generated by a player's custom facial creation. A source clothing model refers to a pre-made clothing model that perfectly fits the source virtual character model. For example, a model of a long trench coat designed to fit a standard medium-sized figure.
[0032] A three-dimensional spatial mesh refers to a virtual three-dimensional lattice structure composed of numerous grid points that encloses the aforementioned model. It can be understood as a bounding box, internally divided into many small cubic units. For example, a cubic region with dimensions of 2 meters each is uniformly divided into 10... 10 There are 10 small squares, and all the characters and costumes are located inside this large cube.
[0033] Topology refers to the connection relationships and vertex index order of a model mesh. Having the same topology means that two models have the same number of vertices, and the connections between the vertices are identical, differing only in their spatial coordinates. For example, the nose tip vertex index of the source virtual character model is 101, and the nose tip vertex index of the target virtual character model is also 101; they correspond one-to-one.
[0034] The action of "establishing" refers to initializing the data structure in the computer memory or graphics processing system, importing the above model data into the same coordinate system, and generating the above spatial grid data according to the size of the model.
[0035] The goal of this step is to construct a unified deformation container. This involves considering not only the model's surface but also the entire 3D space in which the model exists. By requiring the source and target elements to have the same topology, this lays the foundation for subsequent calculations of precise point-to-point deformation.
[0036] For example, suppose in a game development scenario, the developer has a character A (source) of standard build and a character B (target) of tall build. First, a sufficiently large cubic mesh structure will be generated in the 3D scene to enclose character A, character B, and the shirt worn by character A (source clothing) inside this mesh structure.
[0037] Step S202: Based on the positional correspondence between the source virtual character model and the target virtual character model, and the preset smoothing constraint conditions, determine the deformation vector of each grid point in the three-dimensional space grid; the preset smoothing constraint conditions are used to constrain the difference in deformation vectors between adjacent grid points.
[0038] Positional correspondence refers to the spatial displacement difference between a point on a source virtual character and a corresponding point on a target virtual character. For example, the coordinates of the left shoulder of the source virtual character are (10, 100, 0), and the coordinates of the left shoulder of the target virtual character are (15, 105, 0), which reflect the deformation trend.
[0039] Preset smoothing constraints refer to a mathematical rule or algorithmic restriction that forces changes in adjacent positions in space to be gradual and not abrupt. For example, if grid point A moves 1 cm to the left, then the adjacent grid point B should ideally also move to the left by about 1 cm, rather than suddenly moving to the right or remaining stationary, to prevent jagged edges in the deformation field.
[0040] The deformation vector refers to the direction and distance that each grid point needs to move. For example, the deformation vector of grid point P is (0.5, 0.2, 0), which means that the point needs to move 0.5 units in the positive X-axis direction and 0.2 units in the positive Y-axis direction.
[0041] This step utilizes changes in the character's body shape (source to target) to drive the deformation of the spatial mesh. Since human body deformation is complex, relying solely on corresponding points may lead to uneven spatial distortion. Therefore, a smoothing constraint is introduced to ensure that the deformation of the entire space is gentle.
[0042] For the aforementioned tall character, it was observed that the character's arms were longer. Therefore, the spatial mesh points around the arms needed to be stretched. However, without smoothing constraints, the mesh at the elbows might be stretched excessively while the wrists remained stationary, causing the sleeves to distort. By adding smoothing constraints, the calculated deformation vector ensures that the entire spatial mesh from the shoulder to the wrist is stretched uniformly and linearly.
[0043] Step S203: Based on the deformation vector of each grid point, map the source position of each vertex in the source clothing model to the target position to generate a target clothing model that matches the target virtual character model.
[0044] The source position refers to the initial three-dimensional coordinates of the garment's vertices before deformation. For example, the coordinates of a vertex on the cuff of a trench coat are (30, 80, 5).
[0045] The target position refers to the new coordinates that the garment's vertex should move to after calculation. For example, after fitting, the new coordinates of the cuff vertex are (35, 90, 5).
[0046] The target clothing model refers to the final output clothing model that has been adapted to the new body shape. For example, a trench coat that has been enlarged and has longer sleeves, but whose shape has been maintained.
[0047] The "mapping" operation refers to calculating the vertex's deformation vector based on the vertex's relative position in the grid using the deformation vectors of the grid points, and then applying this transformation. Mathematical methods such as interpolation are typically used. For example, if a clothing vertex is located between grid points A, B, C, and D, then the movement of this vertex is determined by a weighted average of the movement patterns of points A, B, C, and D.
[0048] This step applies the deformation results. Since the clothing is enclosed in a spatial mesh, when the spatial mesh (based on the vector determined in step S202) deforms, the vertices of the clothing located inside the mesh are moved to new positions. Because the spatial deformation is smooth, the deformation of the clothing is also smooth, thus avoiding model overlap or overstretching.
[0049] For example, the spatial mesh has now been expanded and stretched according to the target character's body shape. By iterating through each vertex of the shirt, querying how the surrounding mesh points move, and then making the shirt vertices move accordingly, the shirt, which was originally worn on a standard human body, now naturally becomes wider and longer, perfectly fitting the taller character, generating the final target clothing model.
[0050] In summary, the clothing adaptation method for virtual characters provided in this disclosure establishes a three-dimensional spatial mesh and introduces smoothing constraints to determine the deformation vectors of mesh points. By using these constraints to limit the differences in deformation vectors between adjacent mesh points, the deformation field from the source virtual character to the target virtual character remains smooth and continuous throughout the entire three-dimensional space. This approach smoothly diffuses the deformation of the human body surface throughout the entire space. Even for loose clothing sections far from the body surface, the surrounding mesh points are still pulled by adjacent mesh points to produce coordinated deformations, effectively avoiding local collapse or severe distortion. While achieving automatic clothing adaptation to the target body shape, it also preserves the geometric features and volumetric feel of the source clothing model to the greatest extent possible.
[0051] This embodiment provides a method for adapting clothing for virtual characters, which can be used in the aforementioned terminal devices, such as desktop computers, laptops, etc. Figure 3 This is a flowchart of a method for adapting clothing for virtual characters according to an embodiment of the present disclosure, such as... Figure 3 As shown, the process includes the following steps: Step S301: Establish a three-dimensional spatial mesh containing a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure.
[0052] Before performing this step, in order to improve applicability and accuracy, this embodiment also introduces a pre-judgment mechanism: Determine the minimum Euclidean distance from each vertex of the source clothing model to the surface of the source virtual character model; when the maximum value of the minimum Euclidean distance is greater than the preset distance threshold, proceed with the subsequent steps of creating a 3D spatial mesh.
[0053] The minimum Euclidean distance is the length of the straight line connecting a given point (vertex) on the clothing to the point on the surface of the body model that is closest to it. For example, suppose the source clothing is a loose long skirt, and the straight-line distance from a vertex of the skirt hem to the surface of the thigh is 15 centimeters.
[0054] A distance threshold is a pre-defined criterion used to distinguish whether clothing is fitted or loose. For example, a threshold of 2 centimeters might be set. If all points on the clothing are less than 2 centimeters from the body, it is considered fitted clothing; if any point is more than 2 centimeters away (such as the 15-centimeter distance at the hem of a skirt mentioned above), it is considered loose clothing.
[0055] This step iterates through all vertices of the clothing model, performs spatial geometry calculations for each vertex, and finds its corresponding nearest distance value. Only when it is detected that this is a loose-fitting coat (distance greater than the threshold) will the step of creating a 3D spatial mesh in step S301 be executed.
[0056] If it's a tight-fitting garment, skip this step and use a simpler wrapping algorithm. For such form-fitting clothing, to avoid unnecessary computational overhead from lattice deformation and to ensure absolute fit between the clothing and skin, a centroid-based wrapping deformation method can be used. The core logic of this method is to anchor the vertices of the clothing onto triangular facets on the body surface. The specific implementation steps are as follows: First, iterate through every vertex of the source clothing model. For each clothing vertex, search the surface mesh of the source virtual character model to find the point with the closest spatial distance. Next, confirm which specific triangle facet the nearest point falls on, thus establishing the affiliation relationship between the clothing vertex and the specific triangle facet of the body model.
[0057] For example, suppose the clothing is a tight-fitting swimsuit. Select a vertex at the chest of the swimsuit. After searching, it is found that this vertex is closest to the "1024th triangle face" of the chest area of the source virtual character's body. Therefore, the vertex is bound to this face.
[0058] After determining the triangular facet to which the garment belongs, the relative position of the garment vertex with respect to the three corner points of that triangle is further calculated. This relationship is represented by a set of weight values, specifically describing the vertex's centroid position inside the triangle. For example, if the vertex is exactly at the center of the triangle, its weight relative to the three corner points is equal; if the vertex is closer to a corner point, its weight relative to that corner point will be greater. This is equivalent to recording the relative positioning information of the garment vertex on the body surface.
[0059] Since the source virtual character model and the target virtual character model have the same topological structure (i.e., the number of vertices and the connection relationship are completely consistent), the "triangle facet 1024" on the source virtual character model still exists on the deformed target model, and the index number remains unchanged. Only the absolute position of the three corner points of the triangle in space changes (for example, the distance increases as the body size widens).
[0060] Finally, using the previously calculated relative position weights and the positions of the three new corner points of the corresponding triangular facets on the target virtual character model, the spatial coordinates of the target clothing vertices are calculated. In other words, the clothing vertices move and deform along with the triangular facets on the body surface according to the same relative proportions.
[0061] For the aforementioned swimsuit vertex, since it is biased towards the lower left corner in the source character's "Triangle No. 1024", it will still be calculated in the corresponding position biased towards the lower left corner in the target character's "Triangle No. 1024", thus achieving follow-up.
[0062] For this type of form-fitting clothing, this purely geometric wrapping deformation method ensures that the clothing adheres precisely to the target character's body surface like a "second skin." No matter how fat or muscular the target character becomes, as long as the body topology remains unchanged, the calculated vertices of the clothing will always be tightly attached to the corresponding skin triangles, completely eliminating the phenomena of clothing "clipping" (embedding into the skin) or "floating" (being too far from the skin).
[0063] In addition, to ensure versatility, this embodiment also includes standardization procedures before formally establishing the three-dimensional spatial mesh: Scale the source virtual character model and source clothing model to a preset standard scale according to a preset ratio; determine the transformation parameters of the target virtual character model relative to the scaled source virtual character model; align the target virtual character model to the standard scale using the transformation parameters.
[0064] A standard scale refers to a uniform reference size set for ease of calculation. For example, the height of all characters is uniformly scaled to 180cm (or normalized to a unit length of 1.0).
[0065] Transformation parameters refer to a set of data required to move, rotate, or scale an object to coincide with another object. They typically include a rotation matrix, a translation vector, and a scaling factor. For example, a target virtual character model originally stands 5 meters to the right of the origin and is only 160cm tall. The transformation parameters record a 5-meter shift to the left and a scaling factor of 1.125.
[0066] Assuming the source character is 160cm tall and the target character is 200cm tall, direct calculation would lead to errors due to the large scale difference. First, the source character and its clothing are uniformly enlarged to 180cm. Then, the calculation is performed to determine how many times the giant model needs to be scaled down and how far it needs to move to match this 180cm standard model, and these parameters are then applied.
[0067] This normalization process eliminates the interference of differences in the basic height and position of different models on the deformation algorithm, so that subsequent mesh deformation only focuses on body shape differences (such as fatness and muscle mass), thereby simplifying the computational complexity and improving the adaptation accuracy.
[0068] Step S302: Based on the positional correspondence between the source virtual character model and the target virtual character model, and the preset smoothing constraint conditions, determine the deformation vector of each grid point in the three-dimensional space grid; the smoothing constraint conditions are used to constrain the difference in deformation vectors between adjacent grid points.
[0069] To accurately calculate the deformation vector, the specific process of determining the deformation vector of each grid point in the three-dimensional space grid may include: The energy function is obtained, which includes data terms determined based on position correspondence and smoothing constraint terms as preset smoothing constraints. The data terms are used to characterize the distance error between the deformed position of the vertex of the source virtual character model and the position of the corresponding vertex in the target virtual character model.
[0070] The energy function is a scalar function used to measure the "quality" of the current deformation result. The lower the energy, the better the result.
[0071] The data item is used to measure whether the deformation is accurate, that is, whether the vertices of the source human body fall accurately on the surface of the target human body after the mesh deformation (the smaller the distance error, the better).
[0072] The smoothness constraint term is used to measure whether the deformation is smooth, that is, whether the difference in movement between adjacent grid points is small enough.
[0073] By minimizing the energy function, the difference in deformation vectors between adjacent grid points in the three-dimensional spatial grid is minimized, thus obtaining the deformation vector of each grid point in the three-dimensional spatial grid.
[0074] "Minimization" involves using mathematical optimization algorithms to continuously adjust the movement scheme of each grid point until a scheme is found that allows the source character to fit the target character (small data items) while preventing the grid from becoming drastically distorted (small smoothing items).
[0075] This mechanism ensures that deformation of the human body surface can naturally "spread" to the surrounding space. For the skirt area between the legs, although there are no human body data points to pull it (data item is 0), the surrounding grid points will "pull" the central grid points to move evenly together through the smoothing constraint, thus effectively avoiding the problem of loose clothing collapsing towards the inner thighs.
[0076] Furthermore, the energy function also includes weighting coefficients, which are used to adjust the relative weights of data terms and smoothing constraint terms in the energy function.
[0077] The weighting factor is a numerical parameter used to balance accuracy and smoothness. If the weighting factor is set too high, "smoothness" will be prioritized, ensuring the garment is wrinkle-free even at the cost of some fit; if the weighting factor is set too low, "fit" will be prioritized, potentially resulting in sharp edges in certain areas.
[0078] It offers flexible adjustment options, allowing you to adjust the coefficient based on the fabric material (e.g., silk requires high smoothness, while leather may require lower smoothness) to achieve the best visual effect.
[0079] Step S303: Based on the deformation vector of each grid point, map the source position of each vertex in the source clothing model to the target position to generate a target clothing model that matches the target virtual character model.
[0080] To achieve high-precision mapping, this implementation method specifically adopts the following approach: Determine the mesh cell in the 3D space mesh where each vertex of the source clothing model is located; obtain the deformation vector of the vertex of the mesh cell; determine the displacement value of each vertex in the source clothing model based on the deformation vector of the vertex of the mesh cell using the trilinear interpolation method; map each vertex in the source clothing model to the target position based on the displacement value.
[0081] A grid cell is a small cube that makes up a large grid, and each cell has 8 corner points.
[0082] In one alternative implementation, the process of determining the displacement values of each vertex in the source clothing model based on the deformation vectors of the vertices of the mesh cells can be achieved through spatial interpolation (or weighted calculation). Since the vertices of the source clothing model are distributed within the mesh cells, their spatial distances from each vertex of the mesh cell vary. Therefore, different weights can be assigned to each mesh vertex based on the distance or spatial relative relationship between the vertices of the source clothing model and each vertex of the mesh cell; the closer the mesh vertex is, the greater the contribution weight of its deformation vector to the displacement of the clothing vertex. Through this spatial interpolation or weighted calculation, the macroscopic deformation of the spatial mesh can be smoothly and effectively transferred to the internal clothing model.
[0083] As a preferred implementation, the above interpolation calculation method can specifically be a trilinear interpolation method.
[0084] Trilinear interpolation is a method for estimating the value of an internal point in three-dimensional space based on the values of eight surrounding points. For example, the three-dimensional spatial mesh unit in this embodiment typically represents a cube structure with eight vertices. Using the trilinear interpolation algorithm, linear interpolation is performed in the X, Y, and Z spatial dimensions respectively to accurately calculate the three-dimensional weight distribution of the source clothing model vertices relative to these eight spatial mesh vertices. The deformation vectors of these eight mesh vertices are then weighted and summed to obtain the final displacement value of the clothing vertex. For example, a button on clothing is located inside a small cube. Each of the eight corner points of this small cube has its own direction of movement (deformation vector). Through trilinear interpolation, the movement data of these eight corner points are combined to calculate the specific value by which the button should move.
[0085] The "mapping" action applies the calculated displacement value to update the coordinates of the vertex. For example, if the original coordinates of the button are (10, 10, 10), and the calculated displacement is (+2, 0, 0), then the new coordinates become (12, 10, 10).
[0086] Trilinear interpolation ensures that the deformation inside the clothing model is continuous and smooth. Even if the clothing model has a high face count, it can achieve delicate deformation effects through low-resolution mesh driving without any breaks or interlacing.
[0087] After generating a target clothing model that matches the target virtual character model, this embodiment also includes the following steps to restore the correct size: Using the previously calculated transformation parameters (i.e., scaling, translation, and rotation), the target clothing model is inversely transformed to restore it to the original scale of the target virtual character model.
[0088] The inverse transformation is the opposite of the transformation operations described above. For example, if the previous transformation was "magnify by 2 times," this transformation is "shrink by 0.5 times"; if the previous transformation was "shift 5 meters to the left," this transformation is "shift 5 meters to the right." This restores the calculated clothing model back to the real coordinate system of the game scene.
[0089] The original scale is the actual size of the character (i.e., the target character) in the user's actual scenario.
[0090] In step S301, the model was uniformly scaled to 180cm for calculation. Now that the calculation is complete, the generated clothing needs to be scaled back to the actual size of the target character.
[0091] To meet the requirements of high-precision art, this embodiment also includes: Step S304, shape preservation area protection.
[0092] This step involves preserving the geometry of specific areas on the garment.
[0093] This specific area refers to the shape-preserving area, which is the region in the source garment model that should maintain its geometric characteristics in terms of physical properties and should not undergo non-uniform stretching or twisting with the human body surface. This area typically corresponds to hard surface components on the garment, such as metal buttons, belt buckles, badges, jewelry, hard armor plates, and shoe heels.
[0094] Unlike fabric areas (such as silk and cotton), which can stretch (non-uniform deformation) as the body deforms, shape-preserving areas must maintain their original aspect ratio and geometric topology.
[0095] In the aforementioned lattice deformation or encapsulation deformation steps, the deformation field is often calculated based on continuous changes in spatial location. This means that, without special handling, a circular button located in the deformation field might become elliptical because the grid in its region is stretched, or a square badge might become rhomboid. Such geometric distortion is visually unreasonable.
[0096] To solve this problem, this example step adopts a strategy of "extraction, calculation transformation, and backfilling", as detailed below: Obtain the set of vertices of the pre-annotated shape-preserving region in the source clothing model; determine the position transformation parameters based on the position information of the vertex set of the shape-preserving region in the source clothing model and the position information in the target clothing model; update the vertices of the corresponding shape-preserving region in the target clothing model using the position transformation parameters to preserve the geometry of the shape-preserving region.
[0097] It should be noted that, in the embodiments of this disclosure, although the transformation of the shape-preserving region is intended to preserve the shape, it is not limited to a strictly rigid transformation in the mathematical sense (i.e., only rotation and translation). When the body size of the target virtual character changes significantly relative to the source virtual character (e.g., from a child's body size to an adult's body size, or from a thin body size to a strong body size), the accessories on the clothing usually also need to be adjusted in terms of overall size.
[0098] Therefore, the position transformation parameters in this step actually describe a similarity transformation. These include one or more of the following: translation parameters, used to move the component to a new position; rotation parameters, used to adjust the orientation of the component to conform to the new human body surface normal; and scaling parameters, used to uniformly scale the component.
[0099] The "update" action replaces the previously deformed shape caused by the mesh with the transformed shape. For example, the previous mesh deformation stretched a round button into an ellipse. This step calculates the button's center displacement and rotation angle, then replaces the ellipse with a standard round button, ensuring the button remains round.
[0100] This solves the problem that general deformation methods cause metal and hard ornaments to twist and deform, greatly improving the sophistication and realism of clothing.
[0101] For the correction of local details, this embodiment also includes: Step S305, soft selection re-adaptation.
[0102] Specifically, the soft selection weight information and refit parameters for the target region of the target clothing model are obtained; the corrected position of the target region is determined based on the refit parameters; and the current position and corrected position of the target clothing model in the target region are weighted and fused based on the soft selection weight information to obtain the updated target clothing model.
[0103] Soft selection weight information is a gradual weight distribution, with a large influence at the center and a small influence at the edge.
[0104] Refit parameters are fine-tuning instructions manually entered by the user. For example, bulging outward by 2 centimeters.
[0105] The target area is the area that the user considers to be imperfectly deformed (such as the armpit).
[0106] If a user notices a slight clipping under the armpit, they can manually select the area (generating soft selection weights) and then manually drag these points outwards (generating corrective positions). Instead of simply overwriting, the automatically calculated results and the user's manual adjustments are smoothly blended based on the weights.
[0107] Finally, to make the clothing move, this embodiment also includes: Step S306, skin weight transfer.
[0108] Obtain the source skeleton set of the source clothing model and the target skeleton set of the target clothing model; establish the skeleton mapping relationship between the source skeleton set and the target skeleton set; based on the skeleton mapping relationship, transfer the skinning weights of the source clothing model to the target clothing model.
[0109] A skeleton set refers to a list of skeletal structures that drive the model's motion. Skinning weights define which bone influences each vertex and the degree of influence (e.g., the arm vertex is 100% influenced by the upper arm bone).
[0110] Migration refers to copying the weight data of the source vertex to the corresponding vertex in the target vertex.
[0111] Read the bone list bound to the source garment and find the bone list corresponding to the target garment. Since the garment topology remains unchanged, directly copy data such as "vertex A is affected by the left arm bone by 0.8" from the source garment to vertex A of the target garment.
[0112] To ensure the integrity of the mapping, the following steps are taken: Matching is performed based on the characters of the bone name, or based on a preset bone mapping file; if there is an independent bone in the source bone set that does not have a corresponding relationship in the target bone set, then the parent bone of the independent bone in the source bone set is determined, and the independent bone is mapped to the corresponding bone of the parent bone in the target bone set.
[0113] A separate skeleton is a bone that exists in the source model but not in the target model. For example, the source clothing might have a specific "ribbon," but the target's generic body skeleton doesn't have this bone. A parent skeleton is the next level higher in the hierarchical structure (such as the vertebrae). If no corresponding "ribbon" can be found, it's assigned to the "vertebrae" (parent) to ensure that the fabric can at least move with the body and doesn't remain stationary.
[0114] In summary, the clothing adaptation method for virtual characters provided in this disclosure first intelligently identifies the clothing fit and constructs a three-dimensional spatial mesh for loose clothing, transforming complex non-rigid model deformation into a low-resolution mesh spatial deformation problem. Based on this, an energy function containing data terms and smoothing constraints is introduced to solve the deformation vector, forcibly constraining the continuity of deformation between adjacent mesh points. Combined with interpolation mapping, this effectively smooths the spatial difference between the source and target body shapes. This significantly solves the geometric distortion problems such as local tearing, jagged edges, and excessive stretching that are easily generated when processing loose clothing (such as long skirts and coats) in related technologies, ensuring the naturalness and smoothness of the generated clothing model in terms of geometric topology.
[0115] Furthermore, by normalizing and inversely transforming the preset proportions, the interference of different character height scales on the algorithm is eliminated, achieving standardized and universal adaptation. While ensuring natural overall deformation, the combination of shape preservation in specific areas and local weighting adaptation effectively corrects abnormal stretching that may occur in rigid components such as buttons and accessories during deformation, balancing the visual requirements of overall clothing flexibility and local rigidity. Finally, with the automatic transfer of skeletal skinning weights, the output clothing model can be directly used for animation driving without manual secondary binding, greatly improving efficiency and quality.
[0116] To better illustrate the virtual character clothing adaptation method of this disclosure, a preferred embodiment will be provided below. This embodiment is intended to describe the implementation process of this disclosure in detail, but is not intended to limit the scope of protection of this disclosure.
[0117] Currently, two main automation solutions are used to adapt a set of clothing to characters of varying sizes and builds: The RBF-based deformation method calculates the deformation field through interpolation. This method works reasonably well for close-fitting clothing, but its core flaw lies in the lack of overall spatial constraint. For loose clothing (such as long skirts, ribbons, and coats), the RBF algorithm tends to produce severe and uncontrollable distortions in areas far from the body, rendering the model unusable and requiring artists to spend a significant amount of time manually fixing it.
[0118] The physical simulation method simulates the sag and fit of fabric through physical calculations. The drawback of this method is its slow calculation speed and difficulty in maintaining the original artistic design shape of the garment, often resulting in overall garment collapse or distortion.
[0119] Furthermore, the two existing solutions mentioned above typically only address the transfer of the "static model," not the transfer of "skinning weights." This means that the generated clothing is merely a static object that cannot follow skeletal movement, necessitating manual skinning and rigging.
[0120] To address the aforementioned shortcomings, this disclosure proposes an improved solution that combines spatial lattice constraints with automatic skinning migration. This disclosure also provides a clothing migration tool integrated into DCC software (such as Autodesk Maya), aiming to solve the problems of low efficiency in adapting multi-body clothing, the need to remake skinning, and severe deformation of loose clothing in game development.
[0121] First, open the DCC software and launch the clothing migration tool provided in this embodiment. At this point, you need to load the source character and the target character into the 3D scene.
[0122] At the beginning of the operation, the source human body model and its clothing are displayed in the 3D scene. Figure 4 This is a scene illustration of a source human body model wearing source clothing and a target human body model not wearing clothing, such as... Figure 4 As shown, Figure 4 The source human model is on the left. It's a standard-sized human model wearing a complex outfit, including a trench coat with collars and cuffs, loose shorts, and shoes. Simultaneously, the target virtual character model is loaded into the scene, such as... Figure 4 As shown, Figure 4 The target human body model is shown on the right. The target human body model has the same topological structure as the source human body model, but its body features are more robust.
[0123] On the clothing migration tool, the following information needs to be entered in sequence: Set source model information: The user specifies the source file path and picks the source body mesh (source_grp|body) and source root bone (source_grp|Bip01) from the scene. Then, add clothing assets such as trench coats, shorts, and shoes to the migration list in batches.
[0124] Setting target model information: The user specifies the target file path and picks the target body mesh (target_grp|body) and target root bone (target_grp|Bip01). If the bone names are inconsistent, the user can also import external bone mapping files in this step.
[0125] After completing the basic information entry, proceed to the parameter setting stage: Model transfer method selection: The clothing transfer tool offers multiple transfer method options. To handle... Figure 4 For loose-fitting garments like trench coats and shorts, users can choose lattice deformation as the core migration method. This method effectively prevents collapse in loose areas. The garment migration tool also offers alternative options such as wrap deformation (suitable for tight-fitting clothing) and RBF (radial basis function).
[0126] Target human body expansion: Set to 0.50cm. This parameter causes the target human body to expand slightly outward during calculation, leaving a safe distance for the clothing and preventing clipping in the final result.
[0127] Garment Stiffness Mark: Users can enable this option to protect the stiff buttons and shoulder embellishments on the trench coat from stretching.
[0128] Figure 5 This is a schematic diagram of the execution flow of the clothing migration tool in this embodiment. After the user completes the above settings, the following will be executed: Figure 5 The flowchart shown is as follows: Step 1: Standardization and preprocessing of data.
[0129] First, the source human body model (S) and the target human body model (T) are read. To ensure the universality of the algorithm parameters, the source human body model is automatically and uniformly scaled to a standard height of 180cm, and the same scaling ratio is applied to the source clothing model (G) worn by the target human body. Next, the rotation, translation, and scaling matrices of the target human body model relative to the scaled source human body model are calculated, aligning the target human body to the same standard spatial coordinate system. It should be noted that this embodiment requires S and T to have the same topological structure. If they are inconsistent, the user will be prompted to use tools such as Faceform Wrap to generate a model with the same topological structure.
[0130] Step 2: Clothing type identification and triage.
[0131] Within a standard space, the fit between the source clothing model (G) and the source human body model (S) is automatically detected. Each vertex on the clothing is traversed, and its minimum Euclidean distance to the human body surface is calculated.
[0132] If the maximum distance between all vertices is less than a preset threshold (based on a height standard of 180cm, this embodiment sets it to 1cm), the garment is determined to be close-fitting clothing (such as bodysuit or swimwear).
[0133] If the maximum distance is greater than the threshold, the garment is determined to be loose or complex clothing (such as a robe or jacket).
[0134] Step 3: Adaptive deformation calculation.
[0135] For underwear (that has deformed): If it is determined to be underwear, the wrapping and deformation method will be used, as follows: Calculate the projection point of each vertex of the source clothing onto the surface of the source human body, and record the triangle index and centroid coordinates of the projection point.
[0136] By utilizing the topological correspondence between the source human body and the target human body, the new position of the clothing vertex is reconstructed directly based on the vertex position of the triangle corresponding to the target human body and the recorded centroid coordinates.
[0137] This method is extremely fast and ensures that the clothing fits the changes in muscle lines perfectly, like a second skin.
[0138] For loose-fitting clothing (lattice deformation): If the garment is determined to be loose-fitting, the lattice deformation method is used, as follows: A cubic lattice surrounding all models is constructed in normalized space, with the grid cell size set to approximately 3.5 cm.
[0139] An energy function E(d) is constructed to solve for the deformation vector of the lattice nodes. The expression for this function is as follows: ; This function consists of two parts: The first term is the data term, used to calculate the deformation vector at the spatial grid points from the source and target human bodies. In the formula... Represents a set of human vertex indices. These are the vertex coordinates in the source human body S. These are the vertex coordinates in the target human body T. Since the source human body and the target human body model have the same topology and point order, and It's a one-to-one correspondence. It is at point The deformed vector after trilinear interpolation, i.e. The trilinear interpolation of the deformation vectors at the 8 grid points contained in the small grid cell.
[0140] The second term is a regularization term, which aims to ensure that the deformation vectors of adjacent grid points do not differ too much, thereby guaranteeing the smoothness of the entire spatial deformation field. Represents the set of indices of all spatial lattice points. This represents the set of indices of the cells adjacent to cell i. and These represent the deformation vectors at the spatial lattice points with indices i and j, respectively.
[0141] Weight Used to balance the relative importance between two energy terms The larger the size, the smoother the spatial deformation field, as revealed by testing. It achieves a good balance between fitting error and the smoothness of the deformed field. Minimizing this energy function allows us to calculate the deformation vector at each grid point, and trilinear interpolation can be used to obtain the deformation vector at any point in the entire space.
[0142] After calculating the deformation vectors of all grid points, trilinear interpolation is used to calculate the deformation of any point in the entire space, thereby driving the source clothing model G to deform into a clothing model O that fits the target body shape.
[0143] In addition, to further enhance the visual effect, this embodiment also provides refined control methods, as follows: For rigid components such as buttons and belt buckles that should not deform, users can annotate the indices of these vertices. A similarity transformation (rotation, translation, scaling) is calculated from the corresponding points before and after the migration, and the result of the rigid transformation is used to replace the deformed result, thus preserving its original shape. The expression for the similarity transformation is: ; In the formula, It is a set of rigid vertex indices labeled. These are the vertex coordinates of the source clothing G. These are the vertex coordinates of the clothing mesh O after the previous migration. , , These are rotation, scaling, and translation. After solving, the similarity transformation is applied to the corresponding vertices of the source clothing, replacing the corresponding vertices in the migrated clothing, to obtain the updated clothing migration result.
[0144] If a user is not satisfied with the local effect and needs to refit a local area of the clothing, they can use the soft selection function in existing software, such as Autodesk Maya and 3ds Max, to manually select the vertices of the clothing that need to be refitted, obtain the weight information of the soft selection, refit the selected vertices according to the new configuration parameters, and then weight and combine the existing migration results and the re-migration results according to the weight of the soft selection to obtain the new vertex positions and update the clothing migration results.
[0145] After the model shape transfer is completed, skinning transfer will be performed to give the clothing animation capabilities, as detailed below: The user specifies the root skeleton of the source and target garments, and the skeleton list is automatically matched based on the skeleton name.
[0146] Copy the skinning weights of the source garment to the target garment. In most cases, the bone naming and hierarchy are consistent across different body types. If a source bone cannot be found in the target (an isolated bone), it will be automatically mapped to its parent bone. Users can also provide files containing bone mappings to correct or supplement the bone mappings.
[0147] After establishing the mapping, the skinning weights of the source garment are precisely copied to the deformed target garment.
[0148] After completing all the above steps, perform an inverse transformation to restore the generated target clothing model (O) to the original actual size of the target character. The final clothing transfer result is as follows. Figure 6 As shown, Figure 6 The left side shows the source human body and source clothing model, while the right side shows the effect of the transferred clothing on the target human body model. Figure 6 As shown on the right, this embodiment ensures that the skirt area between the legs does not collapse due to a lack of human support, but rather maintains a smooth transition due to the traction of surrounding nodes, perfectly preserving the volume of the clothing. The final output is a clothing model that adapts to the new body type and has complete skeletal rigging, which can be directly imported into a game engine for animation playback.
[0149] In summary, the clothing transfer tool in this embodiment achieves automated transfer of clothing models and skinning weights between characters of different body types. By employing spatial mesh deformation and smoothing constraint mechanisms, it can adapt to the target body type while preserving the original geometry and design features of the clothing to the greatest extent possible. This effectively solves the problem of severe distortion caused by loose clothing in related technologies, significantly reducing the amount of subsequent manual repair work. In addition, this embodiment simultaneously completes the transfer of skeletal skinning weights, allowing the generated clothing model to be directly used for animation driving without secondary binding, thereby greatly improving the production efficiency of game character clothing.
[0150] This embodiment also provides a clothing adaptation device for virtual characters, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0151] This embodiment provides a clothing adaptation device for virtual characters, such as... Figure 7 As shown, it includes: Module 701 is used to create a three-dimensional space mesh containing a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure. The determination module 702 is used to determine the deformation vector of each grid point in the three-dimensional space grid based on the positional correspondence between the source virtual character model and the target virtual character model, as well as the preset smoothing constraint conditions; the preset smoothing constraint conditions are used to constrain the difference in deformation vectors between adjacent grid points. The migration module 703 is used to map the source position of each vertex in the source clothing model to the target position according to the deformation vector of each grid point, so as to generate a target clothing model that matches the target virtual character model.
[0152] In some alternative implementations, the establishment module 701 is further configured to: Scaling the source virtual character model and source clothing model to a preset standard scale according to a preset ratio; Determine the transformation parameters of the target virtual character model relative to the scaled source virtual character model; By transforming parameters, the target virtual character model is aligned to a standard scale.
[0153] In some alternative implementations, migration module 703 is further configured to: Based on the transformation parameters, an inverse transformation is performed on the target clothing model to restore it to the original scale of the target virtual character model.
[0154] In some alternative implementations, the determining module 702 is used for: The energy function is obtained, which includes data terms determined based on position correspondence and smoothing constraint terms as preset smoothing constraints. The data terms are used to characterize the distance error between the deformed position of the vertex of the source virtual character model and the position of the corresponding vertex in the target virtual character model. By minimizing the energy function, the difference in deformation vectors between adjacent grid points in the three-dimensional spatial grid is minimized, thus obtaining the deformation vector of each grid point in the three-dimensional spatial grid.
[0155] The energy function also includes weighting coefficients, which are used to adjust the relative weight of data terms and smoothing constraint terms in the energy function.
[0156] In some alternative implementations, migration module 703 is used for: Determine the mesh cell in the three-dimensional space mesh where each vertex of the source clothing model is located; Obtain the deformation vector of the vertex of the mesh cell; Based on the deformation vector of the vertices of the mesh cells, determine the displacement values at each vertex in the source clothing model; Based on the displacement values, each vertex in the source clothing model is mapped to the target position.
[0157] In some alternative implementations, the migration module 1003 is further configured to: Obtain the set of vertices of the pre-annotated shape-preserving region in the source clothing model; Based on the position information of the vertex set of the shape-preserving region in the source clothing model and the position information in the target clothing model, the position transformation parameters are determined; the position transformation parameters include one or more of the following: rotation parameters, translation parameters, and scaling parameters. The vertices of the corresponding shape-preserving region in the target clothing model are updated by changing the position transformation parameters to maintain the geometry of the shape-preserving region.
[0158] In some alternative implementations, migration module 703 is further configured to: Obtain soft selection weight information and refit parameters for the target region of the target clothing model; Based on the refit parameters, determine the correction location of the target area; Based on the soft selection weight information, the current position and the corrected position of the target clothing model in the target region are weighted and fused to obtain the updated target clothing model.
[0159] In some alternative implementations, migration module 703 is further configured to: Obtain the source skeleton set of the source clothing model and the target skeleton set of the target clothing model; Establish a bone mapping relationship between the source bone set and the target bone set; Based on the skeleton mapping relationship, the skin weights of the source clothing model are transferred to the target clothing model.
[0160] In some alternative implementations, migration module 703 is further configured to: Matching can be performed based on bone name characters, or based on a preset bone mapping file. If there is an independent bone in the source bone set that does not have a corresponding relationship in the target bone set, then determine the parent bone of the independent bone in the source bone set and map the independent bone to the corresponding bone of the parent bone in the target bone set.
[0161] In some alternative implementations, the establishment module 701 is further configured to: Determine the minimum Euclidean distance from each vertex of the source clothing model to the surface of the source virtual character model; When the maximum value of the minimum Euclidean distance is greater than the preset distance threshold, the step of creating a three-dimensional spatial mesh containing the source virtual character model, the target virtual character model, and the source clothing model that matches the source virtual character model is executed.
[0162] The virtual character clothing adaptation device provided in this disclosure can execute the virtual character clothing adaptation method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the above modules and units are the same as in the corresponding embodiments described above, and will not be repeated here.
[0163] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure.
[0164] The following is a detailed reference. Figure 8 The diagram illustrates a structural schematic suitable for implementing an electronic device according to embodiments of the present disclosure. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 802 or a program loaded from memory 808 into random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device. The processor 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0165] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 808 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 8 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.
[0166] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a memory 808, or installed from a ROM 802. When the computer program is executed by the processor 801, it performs the functions defined in the virtual character clothing adaptation method of embodiments of this disclosure.
[0167] Figure 8 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0168] This disclosure also provides a computer-readable storage medium in which the methods described in this disclosure can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and subsequently stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium may also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the virtual character clothing adaptation method shown in the above embodiments is implemented.
[0169] A portion of this disclosure can be applied to computer program products, such as computer program instructions, which, when executed by a computer, can invoke or provide methods and / or technical solutions according to this disclosure through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, and installation package files. Accordingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions; the computer compiling the instructions and then executing the corresponding compiled program; the computer reading and executing the instructions; or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0170] Although embodiments of the present disclosure have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of the present disclosure, and such modifications and variations all fall within the scope defined by the appended claims.
Claims
1. A method for clothing adaptation for virtual characters, characterized in that, The method includes: A three-dimensional spatial mesh is established, comprising a source virtual character model, a target virtual character model, and a source clothing model matching the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure. Based on the positional correspondence between the source virtual character model and the target virtual character model, and the preset smoothing constraint conditions, the deformation vector of each grid point in the three-dimensional spatial grid is determined; the preset smoothing constraint conditions are used to constrain the difference in deformation vectors between adjacent grid points. Based on the deformation vectors of each grid point, the source positions of each vertex in the source clothing model are mapped to the target positions to generate a target clothing model that matches the target virtual character model.
2. The method according to claim 1, characterized in that, Before the step of establishing a three-dimensional spatial mesh comprising a source virtual character model, a target virtual character model, and a source clothing model matching the source virtual character model, the method further includes: The source virtual character model and the source clothing model are scaled to a preset standard size according to a preset ratio; Determine the transformation parameters of the target virtual character model relative to the scaled source virtual character model; The target virtual character model is aligned to the standard scale using the transformation parameters.
3. The method according to claim 2, characterized in that, After the step of generating a target clothing model that matches the target virtual character model, the method further includes: Based on the transformation parameters, the target clothing model is subjected to an inverse transformation to restore the target clothing model to the original scale of the target virtual character model.
4. The method according to claim 1, characterized in that, Determining the deformation vector of each grid point in the three-dimensional spatial grid includes: An energy function is obtained, the energy function including data items determined based on the position correspondence, and smoothing constraint items as the preset smoothing constraint conditions; wherein, the data items are used to characterize the distance error between the position of the deformed vertex of the source virtual character model and the position of the corresponding vertex in the target virtual character model; By minimizing the energy function to minimize the difference in deformation vectors between adjacent grid points in the three-dimensional spatial grid, the deformation vector of each grid point in the three-dimensional spatial grid is obtained.
5. The method according to claim 4, characterized in that, The energy function also includes weighting coefficients, which are used to adjust the relative weights of the data items and the smoothing constraint items in the energy function.
6. The method according to claim 1, characterized in that, The step of mapping the source position of each vertex in the source clothing model to the target position based on the deformation vector of each grid point includes: Determine the mesh cell in which each vertex of the source clothing model is located in the three-dimensional space mesh; Obtain the deformation vector of the vertex of the mesh unit; Based on the deformation vector of the vertex of the mesh unit, determine the displacement value at each vertex in the source clothing model; Based on the displacement value, each vertex in the source clothing model is mapped to the target position.
7. The method according to claim 1, characterized in that, After generating the target clothing model that matches the target virtual character model, the method further includes: Obtain the set of vertices of the pre-annotated shape-preserving region in the source clothing model; Based on the position information of the vertex set of the shape-preserving region in the source clothing model and the position information in the target clothing model, the position transformation parameters are determined; the position transformation parameters include one or more of the following: rotation parameters, translation parameters, and scaling parameters; The vertices of the corresponding shape-preserving region in the target clothing model are updated using the position transformation parameters to maintain the geometry of the shape-preserving region.
8. The method according to claim 1, characterized in that, After generating a target clothing model that matches the target virtual character model, the method further includes: Obtain soft selection weight information and refit parameters for the target region of the target clothing model; The corrected position of the target region is determined based on the refit parameters; Based on the soft selection weight information, the current position of the target clothing model in the target region and the corrected position are weighted and fused to obtain the updated target clothing model.
9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: Obtain the source skeleton set of the source clothing model and the target skeleton set of the target clothing model; Establish a bone mapping relationship between the source bone set and the target bone set; Based on the skeletal mapping relationship, the skinning weights of the source clothing model are transferred to the target clothing model.
10. The method according to claim 9, characterized in that, Establishing the bone mapping relationship between the source bone set and the target bone set includes: Matching can be performed based on bone name characters, or based on a preset bone mapping file. If there is an independent bone in the source bone set that does not have a corresponding relationship in the target bone set, then the parent bone of the independent bone in the source bone set is determined, and the independent bone is mapped to the corresponding bone of the parent bone in the target bone set.
11. The method according to claim 1, characterized in that, Before the step of establishing a three-dimensional spatial mesh comprising a source virtual character model, a target virtual character model, and a source clothing model matching the source virtual character model, the method further includes: Determine the minimum Euclidean distance from each vertex of the source clothing model to the surface of the source virtual character model; When the maximum value of the minimum Euclidean distance is greater than a preset distance threshold, the step of establishing a three-dimensional spatial mesh containing a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model is executed.
12. A clothing adaptation device for a virtual character, characterized in that, The device includes: A module is used to create a three-dimensional spatial mesh containing a source virtual character model, a target virtual character model, and a source clothing model that matches the source virtual character model; the source virtual character model and the target virtual character model have the same topological structure. The determination module is used to determine the deformation vector of each grid point in the three-dimensional spatial grid based on the positional correspondence between the source virtual character model and the target virtual character model, as well as preset smoothing constraints; the preset smoothing constraints are used to constrain the difference in deformation vectors between adjacent grid points. The migration module is used to map the source position of each vertex in the source clothing model to the target position according to the deformation vector of each grid point, so as to generate a target clothing model that matches the target virtual character model.
13. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory storing computer instructions, and the processor executing the computer instructions to perform the clothing adaptation method for a virtual character as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the clothing adaptation method for a virtual character as described in any one of claims 1 to 11.
15. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the clothing adaptation method for a virtual character as described in any one of claims 1 to 11.