Construction method and device of skeleton model, electronic equipment and storage medium

By constructing the bone path tree and determining the bone transformation data, the problem of hierarchy being destroyed when the automatic skinning algorithm exports the USD bone model is solved, and the USD bone model export is realized without changing the original model, which improves the efficiency of animation production .

CN118982607APending Publication Date: 2024-11-19BEIJING IQIYI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410998637.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

After the existing automatic skinning algorithm plug-in imports the original model, exporting will destroy the original USD hierarchy and the USD bone model cannot be exported.

Method used

By obtaining the bone information after the original model is skinned, building a bone path tree, determining the hierarchical relationship and transforming data of the bone nodes, creating an initial bone model, and writing the data into the USD bone model to ensure the integrity of the hierarchy.

Benefits of technology

It realizes the export of USD bone model without changing the original model hierarchy, which solves the problem of hierarchy being destroyed during the export process, and improves the efficiency and productivity of animation production.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118982607A_ABST
    Figure CN118982607A_ABST
Patent Text Reader

Abstract

The invention relates to a skeleton model construction method and device, electronic equipment and a storage medium, and is applied to the technical field of computers.The method comprises the steps that skeleton information generated after an original model is skinned is obtained, and the skeleton information comprises skeleton nodes; constructing a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model; based on the skeleton information and the skeleton path tree, skeleton transformation data of each skeleton node are determined, and the skeleton transformation data are skeleton data in a USD skeleton model; creating an initial skeleton model, wherein the initial skeleton model comprises a skeleton root node and a plurality of skeleton child nodes of the skeleton root node; and writing the skeleton transformation data into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model. The problems that in the prior art, after an original model is imported into a plug-in of an automatic skin algorithm, the original USD hierarchical structure can be damaged, and a USD skeleton model cannot be exported are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for constructing a skeleton model. Background Art

[0002] Modern 3D digital content creation software is a tool used to create and edit 3D models, animations, scenes and effects. They are widely used in game development, film and animation production, advertising and architecture.

[0003] In addition to static models, 3D digital assets usually need to produce corresponding animations to meet the needs of different industries. The current main animation technologies include keyframe animation, dynamic simulation, skeletal animation, programmed animation and other methods. Skeletal animation is the most widely used in the industry and can simulate the joint movement of objects in the physical world. However, the pre-step of skeletal animation, that is, skinning operation, associates each vertex of the static model with the corresponding bone node.

[0004] The automatic skinning algorithm plug-in provided in the related art can complete the corresponding skinning operation. However, after the original model is imported into the plug-in (such as blender), the original USD hierarchy will be destroyed when it is exported, and it cannot be exported into a USD skeleton model. Summary of the invention

[0005] The present application provides a method, device, electronic device and storage medium for constructing a skeleton model, which are used to solve the problem in the prior art that after the original model is imported into the plug-in of the automatic skinning algorithm, the original USD hierarchy will be destroyed after exporting, and it cannot be exported into a USD skeleton model.

[0006] In a first aspect, an embodiment of the present application provides a method for constructing a skeleton model, comprising:

[0007] Obtaining skeleton information generated after skinning the original model, wherein the skeleton information includes skeleton nodes;

[0008] Building a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model;

[0009] Determine the bone transformation data of each of the bone nodes based on the bone information and the bone path tree;

[0010] Creating an initial skeleton model, wherein the initial skeleton model includes a skeleton root node and a plurality of skeleton child nodes of the skeleton root node;

[0011] The skeleton transformation data is written into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

[0012] Optionally, the skeleton information further includes the first spatial coordinates of each of the skeleton nodes;

[0013] The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises:

[0014] Generate a first binding transformation matrix for the skeleton node based on the first space coordinates;

[0015] Determine the position information of the skeleton node in the skeleton path tree;

[0016] Determine the skeleton node space transformation matrix based on the position information and the first binding transformation matrix;

[0017] The position information, the first binding transformation matrix, and the space transformation matrix are determined to be the bone transformation data.

[0018] Optionally, the skeleton information further includes a geometric node bound to the skeleton node, and the second space coordinate of the geometric node is:

[0019] The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises:

[0020] generating a second binding transformation matrix for the geometric node based on the second spatial coordinates;

[0021] Obtaining binding information of the vertices of the geometric node, the binding information including the number of bound bone nodes and the initial weight of each of the bone nodes;

[0022] Based on the number of bone nodes, the bone nodes bound to the vertices and the initial weights are processed to obtain a preset number of target bone nodes and a target weight of each target bone node;

[0023] The vertices, target weights and second binding transformation matrix of each bone node in the bone path tree are determined as the bone transformation data.

[0024] Optionally, the processing of the bone nodes bound to the vertices and the initial weights based on the number of bone nodes to obtain a preset number of target bone nodes and a target weight of each of the target bone nodes includes:

[0025] When the number of bone nodes is equal to the preset number, the bone node bound to the vertex is the target bone node and the initial weight is the target weight;

[0026] In the case where the number of bone nodes is less than the preset number, a bone node with a weight of zero is added, the added bone node and the bone node bound to the vertex are determined as target bone nodes, and the weight of the added bone node and the initial weight are determined as target weights;

[0027] When the number of bone nodes is greater than a preset number, the bone nodes before the preset number with the largest initial weights are determined as target bone nodes, and the initial weights of the target bone nodes are normalized to obtain the target weights of the target bone nodes.

[0028] Optionally, the initial skeleton model also includes a skeleton index space of skeleton child nodes;

[0029] Writing the bone transformation data into the initial bone model based on the hierarchical relationship includes:

[0030] Storing the skeleton root node in the pseudo root node of the skeleton path tree;

[0031] Writing the first binding transformation matrix and the space transformation matrix into the bone child nodes in sequence according to the order of the bone nodes in the bone path tree;

[0032] The position information is written into the bone index space of the bone child node.

[0033] Optionally, the initial skeleton model also includes a geometric index space;

[0034] Writing the bone transformation data into the initial bone model based on the hierarchical relationship includes:

[0035] Write the vertices, target weights, and second bind transformation matrix in geometry index space.

[0036] Optionally, constructing a skeleton path tree based on the skeleton nodes includes:

[0037] Configure the pseudo root node;

[0038] Determine that the skeleton node is a child node of the pseudo root node;

[0039] Determine that the structure formed by the pseudo-root node and the child nodes is the skeleton path tree.

[0040] Optionally, the skeleton information includes the first spatial coordinates of the skeleton node, and the acquiring of the skeleton information generated after the original model is skinned includes:

[0041] Obtaining the initial spatial coordinates of the skeleton nodes of the original model after skinning;

[0042] Determine whether the coordinate system of the initial space coordinates is a coordinate system in the direction of the specified coordinate axis;

[0043] If so, determining the initial space coordinates as the first space coordinates;

[0044] If not, the initial space coordinates are transformed into a coordinate system along the specified coordinate axis to obtain the first space coordinates.

[0045] In a second aspect, an embodiment of the present application provides a device for constructing a skeleton model, comprising:

[0046] An acquisition module, used for acquiring the skeleton information generated after the original model is skinned, wherein the skeleton information includes skeleton nodes;

[0047] A construction module, used for constructing a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model;

[0048] A determination module, used for determining the bone transformation data of each of the bone nodes based on the bone information and the bone path tree;

[0049] A creation module, used for creating an initial skeleton model, wherein the initial skeleton model includes a skeleton root node and a plurality of skeleton child nodes of the skeleton root node;

[0050] A configuration module is used to write the skeleton transformation data into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

[0051] Optionally, the skeleton information further includes the first spatial coordinates of each of the skeleton nodes;

[0052] The building blocks are specifically used for:

[0053] Generate a first binding transformation matrix for the skeleton node based on the first space coordinates;

[0054] Determine the position information of the skeleton node in the skeleton path tree;

[0055] Determine the skeleton node space transformation matrix based on the position information and the first binding transformation matrix;

[0056] The position information, the first binding transformation matrix, and the space transformation matrix are determined to be the bone transformation data.

[0057] Optionally, the skeleton information further includes a geometric node bound to the skeleton node, and the second space coordinate of the geometric node is:

[0058] The building blocks are specifically used for:

[0059] generating a second binding transformation matrix for the geometric node based on the second spatial coordinates;

[0060] Obtaining binding information of the vertices of the geometric node, the binding information including the number of bound bone nodes and the initial weight of each of the bone nodes;

[0061] Based on the number of bone nodes, the bone nodes bound to the vertices and the initial weights are processed to obtain a preset number of target bone nodes and a target weight of each target bone node;

[0062] The vertices, target weights and second binding transformation matrix of each bone node in the bone path tree are determined as the bone transformation data.

[0063] Optionally, the building module is specifically used for:

[0064] When the number of bone nodes is equal to the preset number, the bone node bound to the vertex is the target bone node and the initial weight is the target weight;

[0065] In the case where the number of bone nodes is less than the preset number, a bone node with a weight of zero is added, the added bone node and the bone node bound to the vertex are determined as target bone nodes, and the weight of the added bone node and the initial weight are determined as target weights;

[0066] When the number of bone nodes is greater than a preset number, the bone nodes before the preset number with the largest initial weights are determined as target bone nodes, and the initial weights of the target bone nodes are normalized to obtain the target weights of the target bone nodes.

[0067] Optionally, the initial skeleton model also includes a skeleton index space of skeleton child nodes;

[0068] The configuration module is specifically used for:

[0069] Storing the skeleton root node in the pseudo root node of the skeleton path tree;

[0070] Writing the first binding transformation matrix and the space transformation matrix into the bone child nodes in sequence according to the order of the bone nodes in the bone path tree;

[0071] The position information is written into the bone index space of the bone child node.

[0072] Optionally, the initial skeleton model also includes a geometric index space;

[0073] The configuration module is specifically used for:

[0074] Write the vertices, target weights, and second bind transformation matrix in geometry index space.

[0075] Optionally, the building block is specifically used for:

[0076] Configure the pseudo root node;

[0077] Determine that the skeleton node is a child node of the pseudo root node;

[0078] Determine that the structure formed by the pseudo-root node and the child nodes is the skeleton path tree.

[0079] Optionally, the skeleton information includes the first spatial coordinates of the skeleton node, and the acquisition module is specifically used to:

[0080] Obtaining the initial spatial coordinates of the skeleton nodes of the original model after skinning;

[0081] Determine whether the coordinate system of the initial space coordinates is a coordinate system in the direction of the specified coordinate axis;

[0082] If so, determining the initial space coordinates as the first space coordinates;

[0083] If not, the initial space coordinates are transformed into a coordinate system along the specified coordinate axis to obtain the first space coordinates.

[0084] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;

[0085] The memory is used to store computer programs;

[0086] The processor is used to execute the program stored in the memory to implement the method for constructing the skeleton model described in the first aspect.

[0087] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the method for constructing a skeleton model described in the first aspect.

[0088] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: the method provided by the embodiment of the present application obtains the skeleton information generated after the original model is skinned, and the skeleton information includes skeleton nodes; constructs a skeleton path tree based on the skeleton nodes, and the skeleton path tree indicates the hierarchical relationship of each of the skeleton nodes in the original model; determines the skeleton transformation data of each of the skeleton nodes based on the skeleton information and the skeleton path tree; creates an initial skeleton model, and the initial skeleton model includes a skeleton root node and a plurality of skeleton child nodes of the skeleton root node; writes the skeleton transformation data into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model. In this way, the skinning of the original model will not be exported using the skinning tool, but the skeleton information obtained after skinning is used to recreate the initial skeleton model and calculate the skeleton transformation data of the line pipe, so that the purpose of outputting the USD skeleton model can be achieved without changing the hierarchical structure in the original model. BRIEF DESCRIPTION OF THE DRAWINGS

[0089] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0090] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0091] Figure 1 An application scenario diagram of a method for constructing a skeleton model provided in an embodiment of the present application;

[0092] Figure 2 A flowchart of a method for constructing a skeleton model provided in one embodiment of the present application;

[0093] Figure 3 A flowchart of a method for constructing a skeleton model provided in another embodiment of the present application;

[0094] Figure 4 A structural diagram of a device for constructing a skeleton model provided in one embodiment of the present application;

[0095] Figure 5 A structural diagram of an electronic device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0096] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0097] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following explanations.

[0098] Skinning is a 3D animation term and is also used in 3D games. It is a production technology of 3D animation. Based on the model created in 3D software, bones are added to the model. Since the bones and the model are independent of each other, in order to make the bones drive the model to produce reasonable movements. The technology of binding the model to the bones is called skinning. Skinning is to control the morphological nodes of the model with bones to achieve a reasonable binding effect. The so-called morphological nodes are the external contours.

[0099] USD (Universal Scene Description) is a file format and framework developed by Pixar for describing 3D scenes. In USD, the Skeleton Model is an important data structure used to define and operate character animation.

[0100] Skeleton model: In order to apply controllable motion deformation to the character's 3D mesh model, animators need to add bones and controllers to the character's face model. This process is called skeletal binding. The added bones constitute a skeletal model, which is usually used in the production process of game characters. By reasonably allocating the skinning weights of the bones, the original model can be smoothly controlled and deformed under the controller.

[0101] According to an embodiment of the present application, a method for constructing a skeleton model is provided. Optionally, in the embodiment of the present application, the method for constructing the skeleton model can be applied to Figure 1 In the hardware environment composed of the terminal 101 and the server 102 shown in FIG. Figure 1 As shown, the server 102 is connected to the terminal 101 via a network, and can be used to provide services (such as video services, application services, etc.) for the terminal or a client installed on the terminal. A database can be set up on the server or independently of the server to provide data storage services for the server 102. The above-mentioned network includes but is not limited to: a wide area network, a metropolitan area network or a local area network, and the terminal 101 is not limited to a PC, a mobile phone, a tablet computer, etc.

[0102] The method for constructing the skeleton model of the embodiment of the present application can be executed by the server 102, or by the terminal 101, or by both the server 102 and the terminal 101. The method for constructing the skeleton model of the embodiment of the present application can be executed by the terminal 101, or by the client installed thereon.

[0103] Taking the method for constructing a skeleton model in the embodiment of the present application executed by a terminal as an example, Figure 2 is a flow chart of an optional method for constructing a skeleton model according to an embodiment of the present application, such as Figure 2 As shown, the process of the method may include the following steps:

[0104] Step 201: Obtain the skeleton information generated after the original model is skinned, wherein the skeleton information includes skeleton nodes.

[0105] In some embodiments, the original model refers to a static model. The skinning of the original model may be performed using an automatic skinning plug-in provided in the related art, for example, blender may be used but is not limited to it.

[0106] After skinning the original model, some bone information is usually generated, such as bone nodes, first space coordinates of each of the bone nodes, geometric nodes bound to the bone nodes, and second space coordinates of the geometric nodes.

[0107] Among them, the number of bones generated in the skinning process can be identified by bone nodes. The bone node numbering starts from 0. By traversing the geometric nodes of the bound bones, it is possible to obtain which bones the vertices of each geometric node are associated with, the extent to which the vertices are affected by these bones (i.e., bone weights), and the world space coordinates of each bone node.

[0108] In an optional embodiment, the skeleton information includes the first spatial coordinates of the skeleton node, and the step of obtaining the skeleton information generated after the original model is skinned includes:

[0109] Obtaining the initial spatial coordinates of the skeleton nodes of the original model after skinning;

[0110] Determine whether the coordinate system of the initial space coordinates is a coordinate system in the direction of the specified coordinate axis;

[0111] If so, determining the initial space coordinates as the first space coordinates;

[0112] If not, the initial space coordinates are transformed into a coordinate system along the specified coordinate axis to obtain the first space coordinates.

[0113] In some embodiments, taking into account the different definitions of the world space axis by different 3D modeling software, the world space required by the present invention is a right-handed coordinate space on the y-axis. Therefore, after obtaining the spatial coordinates of the bone node, first determine whether the world space it uses meets its own needs. If not, the obtained spatial coordinates need to be converted.

[0114] Exemplarily, the world space coordinates of the bone node in Blender are calculated. Blender's spatial coordinate system is a right-handed coordinate system on the z-axis, while this application requires a right-handed coordinate system on the y-axis. Therefore, after obtaining the spatial coordinates of the bone node, it is necessary to multiply it by a rotation matrix of minus 90 degrees around the x-axis and transform it to the right-handed coordinate space on the y-axis.

[0115] Step 202: construct a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model.

[0116] In some embodiments, by constructing a bone path tree, the hierarchical relationship between the bone nodes in the bone path tree can be utilized to retain the hierarchical relationship of the obtained bone nodes in the original model, and maintain the hierarchical relationship without being destroyed.

[0117] In an optional embodiment, constructing a skeleton path tree based on the skeleton nodes includes:

[0118] Configure the pseudo root node;

[0119] Determine that the skeleton node is a child node of the pseudo root node;

[0120] Determine that the structure formed by the pseudo-root node and the child nodes is the skeleton path tree.

[0121] In some embodiments, the world space coordinates of the pseudo-root node can be, but are not limited to, (0,0,0), as a skeletal node with a vertex weight of 0, and the skinned skeletal nodes are all used as child nodes of the pseudo-root node, thereby obtaining the skeletal path tree. Among them, in the skeletal path tree, the pseudo-root node and each skeletal node are configured with corresponding node subscripts according to their hierarchical relationship. For example, the subscript of the pseudo-root node is set to 0, and the subscripts of the skeletal nodes are set to 1, 2...N in sequence according to their positions in the skeletal path tree.

[0122] Step 203: Determine the bone transformation data of each of the bone nodes based on the bone information and the bone path tree.

[0123] In some embodiments, the USD skeleton model usually includes the following key components: 1. Skeleton Skeleton is the core of character animation and defines the skeletal structure of the character. Each bone (or joint) has a unique name and is connected through a hierarchical structure to form the entire skeleton. 2. Bind Transforms Bind Transforms define the transformation matrix of each bone in the initial bind pose. This transformation matrix is ​​used to bind the character's geometric vertices to the bones. 3. Initial Transforms The initial transformation refers to the transformation matrix of each bone in the character's default pose. This pose is usually a T-shaped or A-shaped pose, which is used as a benchmark for animation. 4. Bone Weights Bone weights define how each vertex is affected by multiple bones. Each vertex usually has a set of weight values, which determine how the vertex is transformed by different bones during the animation process.

[0124] Based on this, it is determined that the above-mentioned bone transformation data is the key data for the subsequent generation of the USD bone model.

[0125] In an optional embodiment, the skeleton information further includes the first spatial coordinates of each of the skeleton nodes;

[0126] The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises:

[0127] Generate a first binding transformation matrix for the skeleton node based on the first space coordinates;

[0128] Determine the position information of the skeleton node in the skeleton path tree;

[0129] Determine the skeleton node space transformation matrix based on the position information and the first binding transformation matrix;

[0130] The position information, the first binding transformation matrix, and the space transformation matrix are determined to be the bone transformation data.

[0131] In some embodiments, the first spatial coordinates of the bone node are obtained, and the first bind transformation (bindTransforms) matrix of each bone node is generated. The bindTransforms matrix converts the spatial coordinates of each bone node into a matrix form. The pseudo root node set in the bone path tree is a bone with a weight influence of 0, and its bindTransforms is set to the unit matrix.

[0132] Through the generated bindTransforms matrix and the generated bone path tree, the local space transformation (restTransforms) matrix is ​​calculated according to the bindTransforms matrix and the position of each bone node in the bone path tree.

[0133] In an optional embodiment, the skeleton information further includes a geometric node bound to the skeleton node, and the second space coordinate of the geometric node is:

[0134] The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises:

[0135] generating a second binding transformation matrix for the geometric node based on the second spatial coordinates;

[0136] Obtaining binding information of the vertices of the geometric node, the binding information including the number of bound bone nodes and the initial weight of each of the bone nodes;

[0137] Based on the number of bone nodes, the bone nodes bound to the vertices and the initial weights are processed to obtain a preset number of target bone nodes and a target weight of each target bone node;

[0138] The vertices, target weights and second binding transformation matrix of each bone node in the bone path tree are determined as the bone transformation data.

[0139] In some embodiments, the original model generally includes M vertices. The vertices are connected to form F triangular faces or quadrilateral faces through a specific connection relationship, and the triangular faces or quadrilateral faces are the above-mentioned geometric (mesh) nodes.

[0140] In order to prevent the bones from being separated during the movement of the bones, it is also necessary to calculate the bone node number and corresponding weight value referenced by each geometric node for each affected mesh node, and calculate the binding transformation matrix when the current geometric node is bound to the bone, so that the geometric node bound to the bone can move along with it during the movement of the bone.

[0141] In an optional embodiment, the processing of the bone nodes bound to the vertices and the initial weights based on the number of bone nodes to obtain a preset number of target bone nodes and a target weight of each of the target bone nodes includes:

[0142] When the number of bone nodes is equal to the preset number, the bone node bound to the vertex is the target bone node and the initial weight is the target weight;

[0143] In the case where the number of bone nodes is less than the preset number, a bone node with a weight of zero is added, the added bone node and the bone node bound to the vertex are determined as target bone nodes, and the weight of the added bone node and the initial weight are determined as target weights;

[0144] When the number of bone nodes is greater than a preset number, the bone nodes before the preset number with the largest initial weights are determined as target bone nodes, and the initial weights of the target bone nodes are normalized to obtain the target weights of the target bone nodes.

[0145] In some embodiments, each vertex is usually affected by 4 bone nodes, and the above preset number is set to 4. The number of bone nodes bound to each vertex is determined. If it is less than 4, a bone with a bone weight of 0 is added to ensure that each vertex is affected by 4 bone nodes. If the number of bones bound to a vertex is greater than 4, these bone weights are sorted, 4 bones are selected from large to small, and the four bone weights are normalized.

[0146] Step 204: Create an initial skeleton model, wherein the initial skeleton model includes a skeleton root node and a plurality of skeleton child nodes of the skeleton root node.

[0147] In some embodiments, the initial skeletal model may be created by creating an empty skelRoot node and creating skeleton child nodes as child prims of skelRoot.

[0148] Step 205: Write the skeleton transformation data into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

[0149] In some embodiments, after obtaining the above-mentioned bone transformation data, it is written into the initial bone model, so that the initial bone model writes the bone transformation data associated with the original model while maintaining the original structure, so that the exported USD bone model maintains the same data format as the original model, that is, the USD format, and does not destroy the original hierarchical structure.

[0150] Wherein, the initial skeleton model also includes the skeleton index space and the geometric index space of the skeleton subnodes;

[0151] In an optional embodiment, writing the bone transformation data into the initial bone model based on the hierarchical relationship includes:

[0152] Storing the skeleton root node in the pseudo root node of the skeleton path tree;

[0153] Writing the first binding transformation matrix and the space transformation matrix into the bone child nodes in sequence according to the order of the bone nodes in the bone path tree;

[0154] The position information is written into the bone index space of the bone child node.

[0155] Write the vertices, target weights, and second bind transformation matrix in geometry index space.

[0156] In some embodiments, the storage path of the bone root node in the initial bone model is set to the pseudo root node in the original model, so that the root node of the initial bone model is consistent with the root node of the bone path tree.

[0157] By setting the bone index space (joints metadata), the information of the bone path tree is written into the joints metadata, including the position information of the bone node in the bone path tree and the subscript of the bone node.

[0158] By setting the geometry index space, the relevant bone transformation data of the geometry node can be configured. Specifically, the geometry index space can be constructed: geoTransforms metadata, jointIndices metadata, and jointWeights metadata. Among them, the bone path tree is used for mapping in the jointIndices metadata to record the bone node index that affects the vertex; the target weight of the vertex is written in the jointWeights metadata; and the second binding transformation matrix is ​​written in the geoTransforms metadata.

[0159] In a specific embodiment, the method for constructing the skeleton model of the present application is as follows: Figure 3 As shown, this may include:

[0160] Input the original USD model, use Blender to automatically skin the original model, obtain the space coordinates of the skinned bone nodes and the affected mesh vertices, convert the coordinate space, and unify the different world coordinate axes to the right-handed coordinate system with the y axis upward. Process the bone weights of the vertices and construct a bone path tree. If a vertex is bound to more than 4 bone nodes, select the bone nodes with the greatest impact, process these bone weights, and normalize the results.

[0161] Calculate the coordinates of each bone node in the world space along the y-axis, store them in matrix form, and get the bindtransforms matrix at the binding moment. Then, calculate the resttransform matrix of each bone node in the bone node tree based on the constructed bone path tree and the bindtransforms matrix.

[0162] Furthermore, by creating skeleton nodes and skeleton nodes, and writing the bone path and the transformation information calculated above (i.e., the bindtransforms matrix and the resttransform matrix), writing the vertex weights and bone indices by traversing the mesh nodes, and calculating the binding matrix of the mesh nodes, all of which are written into the initial bone model, thereby inputting the USD model with bones.

[0163] The method for constructing the skeleton model of the present application solves the problem that the current blender can realize skinning but cannot export the skeleton model in USD format. And it will not destroy the original USD hierarchy after the USD model is imported into blender and then exported. It can be convenient for art production personnel to use the present invention to speed up the skeleton binding work of the human body model, and the generated model can be imported into various 3D modeling and animation software for use, so as to reduce the time cost in animation production.

[0164] It can be applied to the automatic skinning function of the client. Most digital assets are stored in USD format. Blender has a good automatic skinning algorithm, which can speed up the efficiency of multiple utilization of digital assets, and make it more convenient for artists to make model animations, greatly improving production efficiency. There is no need to bind bones from scratch, only slight adjustments or direct use, which can speed up the production of animations, reduce the company's production costs and speed up the production cycle. However, blender cannot export the results of skinning, and some of the supported model formats are not as suitable for the film and television industry as USD. Therefore, the present invention solves the problem that blender cannot export USD bone models.

[0165] Based on the same concept, a device for constructing a skeleton model is provided in the embodiment of the present application. The specific implementation of the device can be found in the description of the method embodiment part, and the repeated parts will not be repeated. Figure 4 As shown, the device mainly includes:

[0166] An acquisition module 401 is used to acquire the skeleton information generated after the original model is skinned, wherein the skeleton information includes skeleton nodes;

[0167] A construction module 402 is used to construct a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model;

[0168] A determination module 403, used to determine the skeleton transformation data of each skeleton node based on the skeleton information and the skeleton path tree;

[0169] A creation module 404 is used to create an initial skeleton model, wherein the initial skeleton model includes a skeleton root node and a plurality of skeleton child nodes of the skeleton root node;

[0170] The configuration module 405 is used to write the skeleton transformation data into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

[0171] Optionally, the skeleton information further includes the first spatial coordinates of each of the skeleton nodes;

[0172] The building blocks are specifically used for:

[0173] Generate a first binding transformation matrix for the skeleton node based on the first space coordinates;

[0174] Determine the position information of the skeleton node in the skeleton path tree;

[0175] Determine the skeleton node space transformation matrix based on the position information and the first binding transformation matrix;

[0176] The position information, the first binding transformation matrix, and the space transformation matrix are determined to be the bone transformation data.

[0177] Optionally, the skeleton information further includes a geometric node bound to the skeleton node, and the second space coordinate of the geometric node is:

[0178] The building blocks are specifically used for:

[0179] generating a second binding transformation matrix for the geometric node based on the second spatial coordinates;

[0180] Obtaining binding information of the vertices of the geometric node, the binding information including the number of bound bone nodes and the initial weight of each of the bone nodes;

[0181] Based on the number of bone nodes, the bone nodes bound to the vertices and the initial weights are processed to obtain a preset number of target bone nodes and a target weight of each target bone node;

[0182] The vertices, target weights and second binding transformation matrix of each bone node in the bone path tree are determined as the bone transformation data.

[0183] Optionally, the building module is specifically used to:

[0184] When the number of bone nodes is equal to the preset number, the bone node bound to the vertex is the target bone node and the initial weight is the target weight;

[0185] In the case where the number of bone nodes is less than the preset number, a bone node with a weight of zero is added, the added bone node and the bone node bound to the vertex are determined as target bone nodes, and the weight of the added bone node and the initial weight are determined as target weights;

[0186] When the number of bone nodes is greater than a preset number, the bone nodes before the preset number with the largest initial weights are determined as target bone nodes, and the initial weights of the target bone nodes are normalized to obtain the target weights of the target bone nodes.

[0187] Optionally, the initial skeleton model also includes a skeleton index space of skeleton child nodes;

[0188] The configuration module is specifically used for:

[0189] Storing the skeleton root node in the pseudo root node of the skeleton path tree;

[0190] Writing the first binding transformation matrix and the space transformation matrix into the bone child nodes in sequence according to the order of the bone nodes in the bone path tree;

[0191] The position information is written into the bone index space of the bone child node.

[0192] Optionally, the initial skeleton model also includes a geometric index space;

[0193] The configuration module is specifically used for:

[0194] Write the vertices, target weights, and second bind transformation matrix in geometry index space.

[0195] Optionally, the building block is specifically used for:

[0196] Configure the pseudo root node;

[0197] Determine that the skeleton node is a child node of the pseudo root node;

[0198] Determine that the structure formed by the pseudo-root node and the child nodes is the skeleton path tree.

[0199] Optionally, the skeleton information includes the first spatial coordinates of the skeleton node, and the acquisition module is specifically used to:

[0200] Obtaining the initial spatial coordinates of the skeleton nodes of the original model after skinning;

[0201] Determine whether the coordinate system of the initial space coordinates is a coordinate system in the direction of the specified coordinate axis;

[0202] If so, determining the initial space coordinates as the first space coordinates;

[0203] If not, the initial space coordinates are transformed into a coordinate system along the specified coordinate axis to obtain the first space coordinates.

[0204] Based on the same concept, an electronic device is also provided in the embodiment of the present application, such as Figure 5 As shown, the electronic device mainly includes: a processor 501, a memory 502 and a communication bus 503, wherein the processor 501 and the memory 502 communicate with each other through the communication bus 503. The memory 502 stores a program executable by the processor 501, and the processor 501 executes the program stored in the memory 502 to implement the following steps:

[0205] Obtaining skeleton information generated after skinning the original model, wherein the skeleton information includes skeleton nodes;

[0206] Building a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model;

[0207] Determine the bone transformation data of each of the bone nodes based on the bone information and the bone path tree;

[0208] Creating an initial skeleton model, wherein the initial skeleton model includes a skeleton root node and a plurality of skeleton child nodes of the skeleton root node;

[0209] The skeleton transformation data is written into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

[0210] Optionally, the skeleton information further includes the first spatial coordinates of each of the skeleton nodes;

[0211] The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises:

[0212] Generate a first binding transformation matrix for the skeleton node based on the first space coordinates;

[0213] Determine the position information of the skeleton node in the skeleton path tree;

[0214] Determine the skeleton node space transformation matrix based on the position information and the first binding transformation matrix;

[0215] The position information, the first binding transformation matrix, and the space transformation matrix are determined to be the bone transformation data.

[0216] Optionally, the skeleton information further includes a geometric node bound to the skeleton node, and the second space coordinate of the geometric node is:

[0217] The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises:

[0218] generating a second binding transformation matrix for the geometric node based on the second spatial coordinates;

[0219] Obtaining binding information of the vertices of the geometric node, the binding information including the number of bound bone nodes and the initial weight of each of the bone nodes;

[0220] Based on the number of bone nodes, the bone nodes bound to the vertices and the initial weights are processed to obtain a preset number of target bone nodes and a target weight of each target bone node;

[0221] The vertices, target weights and second binding transformation matrix of each bone node in the bone path tree are determined as the bone transformation data.

[0222] Optionally, the processing of the bone nodes bound to the vertices and the initial weights based on the number of bone nodes to obtain a preset number of target bone nodes and a target weight of each of the target bone nodes includes:

[0223] When the number of bone nodes is equal to the preset number, the bone node bound to the vertex is the target bone node and the initial weight is the target weight;

[0224] In the case where the number of bone nodes is less than the preset number, a bone node with a weight of zero is added, the added bone node and the bone node bound to the vertex are determined as target bone nodes, and the weight of the added bone node and the initial weight are determined as target weights;

[0225] When the number of bone nodes is greater than a preset number, the bone nodes before the preset number with the largest initial weights are determined as target bone nodes, and the initial weights of the target bone nodes are normalized to obtain the target weights of the target bone nodes.

[0226] Optionally, the initial skeleton model also includes a skeleton index space of skeleton child nodes;

[0227] Writing the bone transformation data into the initial bone model based on the hierarchical relationship includes:

[0228] Storing the skeleton root node in the pseudo root node of the skeleton path tree;

[0229] Writing the first binding transformation matrix and the space transformation matrix into the bone child nodes in sequence according to the order of the bone nodes in the bone path tree;

[0230] The position information is written into the bone index space of the bone child node.

[0231] Optionally, the initial skeleton model also includes a geometric index space;

[0232] Writing the bone transformation data into the initial bone model based on the hierarchical relationship includes:

[0233] Write the vertices, target weights, and second bind transformation matrix in geometry index space.

[0234] Optionally, constructing a skeleton path tree based on the skeleton nodes includes:

[0235] Configure the pseudo root node;

[0236] Determine that the skeleton node is a child node of the pseudo root node;

[0237] Determine that the structure formed by the pseudo-root node and the child nodes is the skeleton path tree.

[0238] Optionally, the skeleton information includes the first spatial coordinates of the skeleton node, and the acquiring of the skeleton information generated after the original model is skinned includes:

[0239] Obtaining the initial spatial coordinates of the skeleton nodes of the original model after skinning;

[0240] Determine whether the coordinate system of the initial space coordinates is a coordinate system in the direction of the specified coordinate axis;

[0241] If so, determining the initial space coordinates as the first space coordinates;

[0242] If not, the initial space coordinates are transformed into a coordinate system along the specified coordinate axis to obtain the first space coordinates.

[0243] The communication bus 503 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 503 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0244] The memory 502 may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Alternatively, the memory may also be at least one storage device located away from the processor 501 .

[0245] The above-mentioned processor 501 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc., and can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.

[0246] In another embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program runs on a computer, the computer executes the method for constructing a skeleton model described in the above embodiment.

[0247] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instruction can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instruction is transmitted from a website site, a computer, a server or a data center by wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integration. The available medium can be a magnetic medium (such as a floppy disk, a hard disk, a magnetic tape, etc.), an optical medium (such as a DVD) or a semiconductor medium (such as a solid-state hard disk), etc.

[0248] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0249] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A method for constructing a skeleton model, characterized in that: include: Obtaining skeleton information generated after skinning the original model, wherein the skeleton information includes skeleton nodes; Building a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model; Based on the skeleton information and the skeleton path tree, determine the skeleton transformation data of each skeleton node, wherein the skeleton transformation data is the skeleton data in the USD skeleton model; Create an initial skeletal model; The skeleton transformation data is written into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

2. The method for constructing a skeleton model according to claim 1, characterized in that: The skeleton information also includes the first spatial coordinates of each of the skeleton nodes; The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises: Generate a first binding transformation matrix for the skeleton node based on the first space coordinates; Determine the position information of the skeleton node in the skeleton path tree; Determine the skeleton node space transformation matrix based on the position information and the first binding transformation matrix; The position information, the first binding transformation matrix, and the space transformation matrix are determined to be the bone transformation data.

3. The method for constructing a skeleton model according to claim 1 or 2, characterized in that: The skeleton information also includes a geometric node bound to the skeleton node, and the second space coordinates of the geometric node are: The determining of the bone transformation data of each of the bone nodes based on the bone information and the bone path tree comprises: generating a second binding transformation matrix for the geometric node based on the second spatial coordinates; Obtaining binding information of the vertices of the geometric node, the binding information including the number of bound bone nodes and the initial weight of each of the bone nodes; Based on the number of bone nodes, the bone nodes bound to the vertices and the initial weights are processed to obtain a preset number of target bone nodes and a target weight of each target bone node; The vertices, target weights and second binding transformation matrix of each bone node in the bone path tree are determined as the bone transformation data.

4. The method for constructing a skeleton model according to claim 3, characterized in that: The processing of the bone nodes bound to the vertices and the initial weights based on the number of bone nodes to obtain a preset number of target bone nodes and a target weight of each target bone node includes: When the number of bone nodes is equal to the preset number, the bone node bound to the vertex is the target bone node and the initial weight is the target weight; In the case where the number of bone nodes is less than the preset number, a bone node with a weight of zero is added, the added bone node and the bone node bound to the vertex are determined as target bone nodes, and the weight of the added bone node and the initial weight are determined as target weights; When the number of bone nodes is greater than a preset number, the bone nodes before the preset number with the largest initial weights are determined as target bone nodes, and the initial weights of the target bone nodes are normalized to obtain the target weights of the target bone nodes.

5. The method for constructing a skeleton model according to claim 2, characterized in that: The initial skeleton model includes a skeleton root node, a plurality of skeleton child nodes of the skeleton root node, and a skeleton index space of the skeleton child nodes; Writing the bone transformation data into the initial bone model based on the hierarchical relationship includes: Storing the skeleton root node in the pseudo root node of the skeleton path tree; Writing the first binding transformation matrix and the space transformation matrix into the bone child nodes in sequence according to the order of the bone nodes in the bone path tree; The position information is written into the bone index space of the bone child node.

6. The method for constructing a skeleton model according to claim 3, characterized in that: The initial skeleton model also includes a geometric index space; Writing the bone transformation data into the initial bone model based on the hierarchical relationship includes: Write the vertices, target weights, and second bind transformation matrix in geometry index space.

7. The method for constructing a skeleton model according to claim 1, characterized in that: The step of constructing a skeleton path tree based on the skeleton nodes includes: Configure the pseudo root node; Determine that the skeleton node is a child node of the pseudo root node; Determine that the structure formed by the pseudo-root node and the child nodes is the skeleton path tree.

8. The method for constructing a skeleton model according to claim 1, characterized in that: The skeleton information includes the first spatial coordinates of the skeleton node, and the skeleton information generated after the original model is skinned is obtained, including: Obtaining the initial spatial coordinates of the skeleton nodes of the original model after skinning; Determine whether the coordinate system of the initial space coordinates is a coordinate system in the direction of the specified coordinate axis; If so, determining the initial space coordinates as the first space coordinates; If not, the initial space coordinates are transformed into a coordinate system along the specified coordinate axis to obtain the first space coordinates.

9. A device for constructing a skeleton model, characterized in that: include: An acquisition module, used to acquire the skeleton information generated after the original model is skinned, wherein the skeleton information includes skeleton nodes; A construction module, used for constructing a skeleton path tree based on the skeleton nodes, wherein the skeleton path tree indicates the hierarchical relationship of each skeleton node in the original model; A determination module, used to determine the bone transformation data of each of the bone nodes based on the bone information and the bone path tree, wherein the bone transformation data is the bone data in the USD bone model; Creation module, used to create the initial skeleton model; A configuration module is used to write the skeleton transformation data into the initial skeleton model based on the hierarchical relationship to obtain a USD skeleton model.

10. An electronic device, characterized in that: include: A processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is used to execute the program stored in the memory to implement the method for constructing a skeleton model according to any one of claims 1 to 8.

11. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for constructing a skeleton model according to any one of claims 1 to 8 is implemented.