Method for synchronously updating three-dimensional human body model and skeleton and electronic device
By binding a preset skeleton to a 3D human body model and calculating the position of the bone nodes, the matching problem of skeletal animation in detail is solved, improving the realism and flexibility of the 3D human body model, which is suitable for scenarios such as virtual live streaming and gesture recognition.
Patent Information
- Application Number
- CN202211211710.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-30
- Publication Date
- 2026-02-06
- Estimated Expiration
- 2042-09-30
AI Technical Summary
Existing skeletal animation technology struggles to achieve high-precision matching in the details of 3D human models, resulting in poor animation flexibility and low model realism. This is especially true in scenarios such as virtual live streaming and gesture recognition, where the skeleton and model do not match, affecting the animation effect.
A preset skeleton is bound to the initial 3D human body model. The model changes are driven by non-skeletal animation. The positions of the bone nodes are calculated in reverse, and the skeleton is updated to achieve skeletal animation. The consistency of the skeleton structure and the bone skinning data are maintained, and the synchronization between the model and the skeleton is improved.
It improves the realism and flexibility of skeletal animation, reduces the error between the skeleton and the model, maintains the consistency of the skeleton, and is suitable for virtual human animation scenarios with high detail requirements.
Smart Images

Figure CN115908651B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of virtual reality, and provides a three-dimensional human body model and skeleton synchronous updating method and electronic equipment. BACKGROUND
[0002] Virtual human animation technology, as an important part of virtual reality, has become an indispensable technology in system simulation, three-dimensional animation, and game entertainment scenarios.
[0003] At present, virtual human animation technology mainly includes two model animation methods of vertex animation and skeleton animation. In the vertex animation process, each frame of animation is a specific pose of a three-dimensional model, and through key frame technology, interpolation is performed between frames to generate smooth virtual human motion. In the skeleton animation process, after the skeleton composed of geometric vertices on the surface of a three-dimensional model and "skeleton nodes" connected to each other inside the three-dimensional model is bound to a skeleton, virtual human animation is realized by changing the orientation and position of the skeleton nodes. Since skeleton animation does not need to store vertex data of each frame of model, only a set of skeleton data needs to be stored, compared with vertex animation, skeleton animation occupies smaller storage space and is more widely applied.
[0004] In order to reduce the storage space occupied by virtual human animation, a skeleton is often bound to a preset three-dimensional human body model, and a skeleton animation form is used to drive the pose of the model in real time. Although this animation method reduces the storage space pressure to a certain extent, it also brings the problems of poor animation flexibility and low model reality due to the mismatch between the skeleton and the three-dimensional human body model in the real-time driving process.
[0005] Therefore, it is of great research significance to provide a matching skeleton for a three-dimensional human body model. SUMMARY
[0006] The present application provides a three-dimensional human body model and skeleton synchronous updating method and electronic equipment, which can improve the reality and flexibility of a three-dimensional human body model in skeleton animation.
[0007] In one aspect, the present application provides a three-dimensional human body model and skeleton synchronous updating method, which includes:
[0008] According to the parent-child relationship between each skeleton node in a preset skeleton bound to an initial three-dimensional human body model, the geometric vertices in the initial three-dimensional human body model and the skeleton nodes in the preset skeleton are initialized to determine the initial parameters of the skeleton nodes.
[0009] Obtain vertex data corresponding to the initial three-dimensional human body model, and drive the initial three-dimensional human body model according to the vertex data to obtain a target three-dimensional human body model.
[0010] determine the three-dimensional coordinates of the bone nodes according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters of the bone nodes;
[0011] update the skeleton used for performing the skeletal animation on the target three-dimensional human body model according to the three-dimensional coordinates of the bone nodes and the parent-child relationship between the bone nodes.
[0012] In another aspect, an electronic device is provided, including a processor and a memory, the processor and the memory are connected through a bus, the memory stores a computer program, and the processor executes the following operations according to the computer program:
[0013] initialize the geometric vertices in the initial three-dimensional human body model and the bone nodes in the preset skeleton according to the parent-child relationship between the bone nodes in the preset skeleton bound with the initial three-dimensional human body model, and determine initial parameters of the bone nodes;
[0014] obtain vertex data corresponding to the initial three-dimensional human body model, and drive the initial three-dimensional human body model according to the vertex data to obtain a target three-dimensional human body model;
[0015] determine the three-dimensional coordinates of the bone nodes according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters of the bone nodes;
[0016] update the skeleton used for performing the skeletal animation on the target three-dimensional human body model according to the three-dimensional coordinates of the bone nodes and the parent-child relationship between the bone nodes.
[0017] In another aspect, a computer readable storage medium is provided, which stores computer executable instructions for causing a computer device to execute the method for synchronously updating a three-dimensional human body model and a skeleton provided in the embodiments of the present application.
[0018] The method and the electronic device provided by the embodiment of the present application can bind a preset skeleton to an initial three-dimensional human body model, initialize geometric vertices and skeleton nodes of the initial three-dimensional human body model according to parent-child relationships between the skeleton nodes in the preset skeleton, obtain initial parameters of the skeleton nodes for subsequent skeleton updating, drive the initial three-dimensional human body model with the obtained vertex data, determine three-dimensional coordinates of the skeleton nodes according to three-dimensional coordinates of geometric vertices in a target three-dimensional human body model and the initial parameters of the skeleton nodes, and update the preset skeleton according to the three-dimensional coordinates of the skeleton nodes and the parent-child relationships between the skeleton nodes to obtain a skeleton matching the target three-dimensional human body model. Since the preset skeleton is updated, the updating process does not substantially move the skeleton positions, the organization structure of the skeleton nodes does not change, the original structure and the number of skeleton nodes of the preset skeleton and the original skeleton skin data are maintained, the consistency of the skeleton in the model animation process is ensured, the skeleton animation driving of the target three-dimensional model can be performed based on the updated skeleton, and the authenticity and flexibility of the skeleton animation are improved. BRIEF DESCRIPTION OF DRAWINGS
[0019] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0020] Figure 1 The overall architecture diagram of updating the skeleton of the three-dimensional human body model in a non-skeleton animation manner is provided for the embodiments of the present application.
[0021] Figure 2A The schematic diagram of the initial three-dimensional human body model in a T pose is provided for the embodiments of the present application.
[0022] Figure 2B The T pose skeleton adapted to the initial three-dimensional human body model is provided for the embodiments of the present application.
[0023] Figure 2C The binding relationship diagram of the initial three-dimensional human body model and the preset skeleton is provided for the embodiments of the present application.
[0024] Figure 3 The flowchart of the method for synchronously updating the three-dimensional human body model and the skeleton is provided for the embodiments of the present application.
[0025] Figure 4 The flowchart of the method for initializing the initial three-dimensional human body model and the preset skeleton is provided for the embodiments of the present application.
[0026] Figure 5 A flowchart for calculating the influence weight of each target geometric vertex on the key bone node is provided for the embodiments of the present application.
[0027] Figure 6 A flowchart for calculating the proportion of the centroid of each target geometric vertex on the bone length is provided for the embodiments of the present application.
[0028] Figure 7 A method flowchart for calculating the three-dimensional coordinates of each bone node after driving is provided for the embodiments of the present application.
[0029] Figure 8 A method flowchart for determining the local transformation matrix between each bone node after driving is provided for the embodiments of the present application.
[0030] Figure 9 A complete flowchart for synchronous updating of the three-dimensional human body model and the skeleton is provided for the embodiments of the present application.
[0031] Figure 10 An electronic device structure diagram is provided for the embodiments of the present application. DETAILED DESCRIPTION
[0032] To make the objectives, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions of the present application will be described below in detail with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments described in the present application document, all other embodiments obtained by those of ordinary skill in the art without any creative work fall within the scope of protection of the technical solutions of the present application.
[0033] Virtual human animation technology mainly includes two model animation methods of vertex animation and skeleton animation. Compared with vertex animation, skeleton animation does not need to store the vertex data of each frame model, but only needs to store a set of skeleton data. Therefore, skeleton animation occupies less storage space. Thus, when performing virtual human animation, the skeleton animation method is often used. The structure of the three-dimensional human body model and the bound skeleton in the initial state is designed in advance. The action of the three-dimensional human body model is changed by adjusting the skeleton data, so as to drive the synchronous change of the three-dimensional human body model and the skeleton.
[0034] Most virtual human animation methods mainly focus on the body motion of a three-dimensional human model, and even can drive the human body to complete more complex movements by combining different skeletal animation data together. However, in a scene with high requirements for details of a three-dimensional human model (such as facial expressions, hands, etc.), such as virtual live broadcast, gesture recognition, etc., if the skeletal animation method is used, in order to ensure the detail information of the model, many skeletal nodes need to be added at the details, and the positions of the skeletal nodes at the details need to be adjusted frequently and finely. Therefore, whether from the workload of skeleton making or the complexity of the skeleton structure at the details, the traditional skeletal animation is difficult to meet the needs of such a scene.
[0035] Currently, in a scene with high requirements for details, when a virtual human is animated, the related technology generally sets a skeleton with relatively simple structure at the details (such as the head, the hands, etc.) of a three-dimensional human model, and then uses the BlendShape component in the Maya animation software to drive the changes of the details of the model. In this way, when the vertex data at the details changes, the high-precision detail information can be displayed by rendering the human geometry model. However, in order to reduce the storage space pressure, when the skeletal animation of the three-dimensional human model is performed subsequently, the skeleton structure under the existing model posture needs to be extracted in real time, and the skeletal animation is performed based on the extracted skeleton to ensure that the skeleton and the model are synchronized. If the original skeleton is directly used for skeletal animation, there will be a deviation between the skeleton and the three-dimensional human model driven after the skeleton, which affects the authenticity of the model and the flexibility of the animation operation.
[0036] Among them, there are mainly two methods for extracting the skeleton from a three-dimensional human model: one is a static model-based extraction method, which extracts the position of the skeletal node by analyzing the geometric features of the three-dimensional human model, so as to extract the skeleton of the model, for a static three-dimensional human model in a specific posture. The other is a dynamic model-based extraction method, which forms a dynamic three-dimensional human model according to the animation sequence of different postures of the same human body, takes one of the postures as a reference posture, calculates the transformation matrix between the reference posture and other postures, clusters the vertices or faces of the model based on the calculated transformation matrix, and determines the position of the skeletal node according to the adjacency of the class, so as to extract the skeleton of the model. However, both of these two skeleton extraction methods are difficult to accurately locate the position information of the skeletal node, and because the skeleton of the changed three-dimensional human model is recalculated, the original skeleton structure and skeletal skin information will be lost.
[0037] In view of this, the embodiment of the present application provides a three-dimensional human model and skeleton synchronous updating method and electronic equipment. A preset skeleton is bound for an initial three-dimensional human model, then the initial three-dimensional human model is driven to change by using a non-skeletal animation (such as vertex animation) mode, the positions of the nodes of the preset skeleton are calculated reversely, the pose information between the nodes is obtained based on the positions between the nodes, and the skeleton for skeletal animation after updating is obtained, so that the driving of the three-dimensional human model and the generation of the skeleton are organically combined, the adaptive synchronous updating process of the preset skeleton bound when the posture of the initial three-dimensional human model changes is realized, the error between the model and the skeleton is reduced, and the authenticity and flexibility of the skeletal animation are improved. Moreover, the embodiment of the present application is extended based on the vertex animation and the skeletal animation. Compared with the vertex animation, the storage space occupied is smaller when the skeletal driving is performed based on the skeleton with finer details, and the high workload and complex skeletal structure introduced by setting many nodes at the position with rich details are overcome. Meanwhile, in the embodiment of the present application, the pose between the nodes is calculated based on the structure of the preset skeleton after the model is driven, the original skeleton structure and the number of nodes, and the original skeletal skin data are maintained, compared with the method of directly extracting the skeleton from the model in real time, the consistency of the skeleton in the model animation process is ensured.
[0038] In the virtual human animation technology, the three-dimensional human model bound with the skeleton is often driven in the skeletal animation mode. After driving, the geometric data on the surface of the three-dimensional human model and the nodes inside the skeleton change synchronously, but the fine degree of details is low. After the three-dimensional human model is driven in the vertex animation mode, only the geometric data on the surface of the three-dimensional human model is changed, and the nodes inside the skeleton do not change synchronously.
[0039] For some scenes with higher requirements for the details of the three-dimensional human model, the vertex animation mode is often used to retain more detailed information of the three-dimensional human model. The embodiment of the present application aims to update the skeleton synchronously with the three-dimensional human model after the three-dimensional human model is driven in the non-skeletal animation mode, so as to subsequently drive in the skeletal animation mode, and realize the complementary advantages of the vertex animation and the skeletal animation.
[0040] Referring to Figure 1 The overall architecture diagram for updating the skeleton after the three-dimensional human model is driven in the non-skeletal animation mode provided by the embodiment of the present application mainly includes a data source preparation part and a logic calculation part.
[0041] Figure 1 The data source preparation part in the embodiment is used to reconstruct an initial three-dimensional human model and build a preset skeleton bound with the initial three-dimensional human model. The initial three-dimensional human model and the preset skeleton are in the same space coordinate system.
[0042] AsFigure 2A Fig. 1 is a schematic diagram of an initial three-dimensional human body model in a T pose provided by an embodiment of the present application, as shown by the local enlargement, the surface of the initial three-dimensional human body model is composed of a plurality of patches connected by geometric vertices.
[0043] As shown in Fig. 2, a T pose skeleton adapted to the initial three-dimensional human body model is provided by an embodiment of the present application. Figure 2B In the embodiment, the preset skeleton contains 24 mutually connected skeleton nodes, and a parent-child relationship exists between each skeleton node, which is indicated by an arrow. Figure 2B In the embodiment, a parent node can have one or more child nodes, and a child node (except the root node) has only one parent node, for example, the skeleton node numbered 0 is the root node, and is the parent node of the skeleton nodes numbered 1 and 2, and the skeleton node numbered 15 is the child node of the skeleton node numbered 12. Figure 2B
[0044] The adaptation relationship between the initial three-dimensional human body model in the embodiment and the preset skeleton in the embodiment is shown in Fig. 3, by changing the pose of each skeleton node in the preset skeleton, the pose of the initial three-dimensional human body model is changed. Figure 2A Figure 2B Figure 2C
[0045] In order to ensure the authenticity of the virtual human animation, in the data source preparation part, the reconstructed initial three-dimensional human body model and the built preset skeleton meet at least one of the following conditions:
[0046] 1) In the initial three-dimensional human body model, the density distribution of the geometric vertices in the adjacent regions is relatively uniform.
[0047] 2) In the initial three-dimensional human body model, the density of the geometric vertices is relatively low at the overall relatively smooth body parts such as the torso, so as to reduce the data calculation amount, reduce the burden of graphic rendering and the data transmission pressure in the virtual human interaction process; the density of the geometric vertices is relatively dense at the parts with rich features such as the face and the hand, so as to be able to present more detailed information of the human body (such as facial expressions and hand gestures);
[0048] 3) In the preset skeleton, the skeleton node hierarchical structure is complete, the hierarchical depth is greater than a preset depth threshold, and the global contains main joint information (such as the elbow, the wrist and the neck) capable of reflecting the human body motion pose, and the local contains detailed information capable of reflecting the knuckle, as shown in Fig. 4; Figure 2B
[0049] 4) In the preset skeleton, the setting of the geometric coordinates (i.e. three-dimensional coordinates) of each skeleton node is matched with the pose of the initial three-dimensional human body model, as shown in Fig. 5; Figure 2C
[0050] 5) there is a correlation between the skeleton nodes in the preset skeleton and the geometric vertices in the initial three-dimensional human body model.
[0051] Based on the partially reconstructed initial three-dimensional human body model and the built preset skeleton prepared according to the data source, in the logical calculation part, firstly, the initial three-dimensional human body model is driven in a non-skeletal animation manner, then the three-dimensional coordinates of the skeleton nodes of the bound skeleton are calculated according to the geometric vertices in the driven target three-dimensional human body model, and finally, the structure of the preset skeleton is updated according to the three-dimensional coordinates of the skeleton nodes, so that the skeleton synchronized with the target three-dimensional human body model is obtained.
[0052] The three-dimensional human body model and skeleton synchronization updating method provided by the embodiment of the application is described in detail below.
[0053] Referring to Figure 3 The three-dimensional human body model and skeleton synchronization updating method provided by the embodiment of the application is described in detail below.
[0054] S301: According to the parent-child relationship between the skeleton nodes in the preset skeleton bound to the initial three-dimensional human body model, the geometric vertices in the initial three-dimensional human body model and the skeleton nodes in the preset skeleton are initialized, and the initial parameters of the skeleton nodes are determined.
[0055] In skeletal animation, the positions of the geometric vertices in a model can be affected by multiple skeleton nodes, and a skeleton node can also affect multiple geometric vertices, that is, there is a many-to-many correlation between the skeleton nodes in the skeleton and the geometric vertices in the model. On the other hand, each skeleton node has different influences on the model, and the influence size can be determined by assigning an influence weight of each skeleton node to each geometric vertex in the model, and the influence weight of each skeleton node on a geometric vertex with which it has a correlation is 1. Therefore, through linear weighting, the position coordinates of the geometric vertices in the model after skeletal animation can be obtained.
[0056] It is known in reverse that when the human body geometric model changes first, the influence weight of each geometric vertex on the skeleton nodes with which it has a correlation can also be assigned by using the correlation between the skeleton nodes and the geometric vertices, and a linear weighting method similar to skeletal animation is adopted, so that the position coordinates of the skeleton nodes with which the geometric vertices in the changed human body geometric model have a correlation are calculated.
[0057] Therefore, in S301, the parent-child relationship between each bone node in the preset skeleton bound with the initial three-dimensional human body model is initialized to obtain each target geometric vertex in the initial three-dimensional human body model associated with each bone node in the preset skeleton, the influence weight of each target geometric vertex on the three-dimensional coordinates of the corresponding bone node, and the scaling ratio between the bone nodes with the parent-child relationship in the reverse reasoning process.
[0058] The specific initialization process is described in detail in Figure 4 For each bone node, the following operations are performed:
[0059] S3011: associating a plurality of target geometric vertices closest to the current bone node in the initial three-dimensional human body model with the bone node.
[0060] In the skeletal animation, when the parent bone node changes, the child bone node is also changed, which causes the M (M≥1) geometric vertices affected by the child bone node to also change. However, when the child bone node changes, the parent bone node does not change, and all the geometric vertices affected by the parent bone node do not change.
[0061] For example, taking the human body rotating the arm as an example, when the joint at the shoulder moves, the joint at the elbow is also moved, which causes the movement of the entire arm. However, the movement of the joint at the elbow is not necessarily caused by the movement of the joint at the shoulder, and only causes the change of the geometric vertices in the small arm region of the human body geometric model, without affecting the geometric vertices in the large arm region of the human body geometric model.
[0062] Based on the kinematics principle, in the embodiment of the present application, when calculating the influence weight of the geometric vertex on the three-dimensional coordinates of the bone node, all the geometric vertices affected by the current bone node are not used, but the geometric vertices around the bone node are used, which improves the calculation accuracy and reduces the calculation complexity.
[0063] In the virtual world, each bone can be understood as a coordinate space, and the bone node can be understood as the origin of the bone coordinate space. The position of the child bone node is described by its position in the coordinate space of the parent bone node, and the hierarchy of the bone is the nested coordinate space. Therefore, the position of the bone node is described by the local position of the coordinate space origin of the bone node in the coordinate space of the parent bone node, and the rotation around the bone node refers to the rotation of the coordinate space of the bone node (including the coordinate spaces of all child bone nodes) itself, that is, the pose of the bone node is an affine transformation (including translation transformation, rotation transformation and scaling transformation).
[0064] Suppose that the affine transformation of the bone node numbered j with respect to its parent node is represented as P jaffine transformation P j Given a 4×4 matrix, P j From the translation vector T j Rotation matrix R j and the diagonal scaling matrix S j Composition, i.e., P j =R j T j S j .
[0065] In virtual human animation technology, the skeletal structure represents the affine transformation relationship between child and parent bone nodes. During initialization, in order to calculate the current bone node with respect to the root node (such as...),... Figure 2B The global pose of the bone node (with the 0th bone node in the middle) in the coordinate space of the origin can be obtained by traversing the current bone node all the way to the root node. By multiplying the affine transformation matrix of each bone node relative to its parent node, the affine transformation matrix between the current bone node and the root node can be obtained.
[0066] Assuming the root node is at layer 0 of the skeleton structure, and the current skeleton node is at layer K of the skeleton structure, then the initial 3D coordinates of the current skeleton node in the coordinate space with the root node as the origin can be represented as:
[0067] P k =P1*P2*…*P k Formula 1
[0068] Therefore, in S3011, for each skeletal node, in the original state where the preset skeleton and the initial 3D human body model are in the same spatial coordinate system, each geometric vertex in the initial 3D human body model is traversed to obtain the initial 3D coordinates of each geometric vertex. At the same time, the initial 3D coordinates of the current skeletal node are obtained. The K-nearest neighbor algorithm is used to calculate the distance from each geometric vertex to the current skeletal node. Furthermore, based on the calculated distances, N (N < M) geometric vertices that are closest to the current skeletal node are selected, and the selected N geometric vertices are used as target geometric vertices associated with the current skeletal node. The global 3D coordinates of these N geometric vertices and their numbers in the initial 3D human body model are recorded.
[0069] It should be noted that the value of N can be adaptively adjusted according to the size of the bone connected to the skeletal node. For example, for larger bones such as the arm, the value of N can be relatively large, while for smaller bones such as finger bones, the value of N can be relatively small.
[0070] After obtaining the N target geometric nodes closest to the current skeletal node, the influence weights of these N geometric vertices on the three-dimensional coordinates of the current skeletal node are calculated, as detailed in S3012-S3016.
[0071] S3012: Determine whether the current skeleton node is a root node, if not, execute S3013, if yes, end.
[0072] Due to the change of the parent skeleton node, the child skeleton node will be changed. Therefore, when calculating the position of the skeleton node in reverse, the parent-child relationship between each skeleton node in the preset skeleton can be used to calculate step by step from top to bottom. However, considering that the root node (such as the human body geometric model shown in FIG. 1 located at the middle of the two feet numbered 0) has no parent node, it is necessary to determine whether the current skeleton node is a root node. Since the root node is only used as the origin of the skeleton coordinate system for positioning and does not participate in the driving of the skeleton animation, it is kept unchanged, therefore, when the current skeleton node is the root node, the three-dimensional coordinate calculation process is ended. Figure 2C
[0073] S3013: Establish a virtual plane passing through the current skeleton node with the current skeleton node and the parent node of the current skeleton node as the normal vector.
[0074] When the current skeleton node is a non-root node, that is, the current skeleton node is a child node, and it has a parent node, therefore, the point method can be used to establish a virtual plane passing through the current skeleton node with the current skeleton node and its parent node as the normal vector.
[0075] S3014: Determine whether the plurality of target geometric vertices closest to the skeleton node in the initial three-dimensional human body model are distributed on both sides of the virtual plane, if yes, execute S3015, otherwise, execute S3016.
[0076] Suppose the equation of the established virtual plane is Ax+By+Cz+D=0, by calculating the distance from the N target geometric vertices associated with the current skeleton node to the virtual plane, the distribution state of the N target geometric vertices closest to the skeleton node in the initial three-dimensional human body model and the virtual plane can be determined. Wherein, the distance d1 calculation formula is:
[0077]
[0078] Wherein, (x1, y1, z1) is the three-dimensional coordinates of one target geometric vertex.
[0079] Since the virtual plane is passed through the current skeleton node, in S3014, according to the positive and negative of the distance d1 of the N target geometric vertices in the initial three-dimensional human body model associated with the current skeleton node to the virtual display plane, the distribution state between the N target geometric vertices in the initial three-dimensional human body model and the virtual plane can be determined. Specifically, the number of d1 greater than 0 (denoted as n1) and the number of d1 less than 0 (denoted as n2) in the distance d1 of the N target geometric vertices in the initial three-dimensional human body model to the virtual display plane are counted, when n1 and n2 are both not 0, it indicates that the N target geometric vertices in the initial three-dimensional human body model are respectively distributed on both sides of the virtual plane, this case is generally for the skeleton nodes in the middle level of the skeleton structure, and the geometric vertices of the model are dispersedly distributed around the skeleton nodes; when n1 or n2 is 0, it indicates that the N target geometric vertices in the initial three-dimensional human body model are distributed on the same side of the virtual plane, this case is generally for the sub-skeleton nodes at the end of the skeleton structure, such as the skeleton nodes at the position of the finger head.
[0080] S3015: Determine the influence weight of each target geometric point in the initial three-dimensional human body model on the three-dimensional coordinates of the current skeleton node.
[0081] In S3015, when the multiple target geometric vertices in the initial three-dimensional human body model closest to the skeleton node are distributed on both sides of the virtual plane, the influence weight of each target geometric vertex on the three-dimensional coordinates of the current skeleton node is calculated respectively.
[0082] Considering that the density of the geometric vertices in different regions of the initial three-dimensional human body model may not be consistent, in S3015, the influence weight of each target geometric vertex on the three-dimensional coordinates of the current skeleton node can be determined according to the first geometric distance of each target geometric vertex to the current skeleton node.
[0083] The calculation process of the influence weight is described in detail in Figure 5 , which mainly includes the following steps:
[0084] S3015_1: Calculate the first geometric distance of each target geometric point in the initial three-dimensional human body model to the current skeleton node.
[0085] S3015_2: Take the reciprocal of each first geometric distance as the influence weight of the corresponding target geometric vertex on the three-dimensional coordinates of the skeleton node, and normalize each influence weight.
[0086] Taking one of the N target geometric vertices as an example, a first geometric distance d2 from the target geometric vertex to the current skeleton node is calculated according to the three-dimensional coordinates of the target geometric vertex and the three-dimensional coordinates of the current skeleton node, and an inverse 1 / d2 of the first geometric distance d2 is taken as an influence weight ω of the target geometric vertex on the three-dimensional coordinates of the current skeleton node. Wherein, the smaller the first geometric distance is, the closer the target geometric vertex is to the current skeleton node, and the greater the weight is.
[0087] After obtaining the influence weights of the N target geometric vertices on the three-dimensional coordinates of the current skeleton node respectively, the N influence weights are normalized, and the sum of the N influence weights is 1.
[0088] S3016: Determine a scaling ratio between the skeleton node and the parent node of the skeleton node according to the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model.
[0089] When the plurality of target geometric vertices closest to the skeleton node in the initial three-dimensional human body model are distributed on the same side of the virtual plane, if the adjacent point weighting method is used to calculate the skeleton node subsequently, the three-dimensional coordinates of the calculated skeleton node will be offset to one side (such as the palm center direction). In view of this situation, in S3016, the theoretical position of the current skeleton node is calculated by calculating the proportion of the centroid of the N target geometric nodes on the skeleton length.
[0090] Wherein, the proportion calculation process is described in detail in Figure 6 , which mainly includes the following steps:
[0091] S3061_1: Calculate the skeleton length between the current skeleton node and the parent node of the current skeleton node, and calculate the second geometric distance between the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model and the parent node of the current skeleton node.
[0092] In S3061_1, first, the centroid of the N target geometric vertices in the initial three-dimensional human body model is determined, then the second geometric distance d between the centroid and the parent node of the current skeleton node is calculated, and at the same time, the skeleton length L between the parent node and the child node is calculated according to the three-dimensional coordinates of the current skeleton node and the three-dimensional coordinates of the parent node of the current skeleton node.
[0093] S3061_2: Take the proportion of the second geometric distance on the skeleton length as the scaling ratio between the current skeleton node and the parent node of the current skeleton node.
[0094] In S3061_2, the proportion rate of the centroid on the skeleton length L is d / L, that is, the proportion rate of the second geometric distance on the skeleton length is rate=d / L, and rate is taken as the scaling ratio between the current skeleton node and the parent node of the current skeleton node.
[0095] In S301, after the initialization of the geometric vertices in the initial three-dimensional human body model and the skeleton nodes in the preset skeleton, the initial parameters of each skeleton node associated target geometric vertex in the initial three-dimensional human body model, the influence weight of each target geometric vertex on the three-dimensional coordinates of the corresponding skeleton node, and the scaling ratio between the skeleton nodes with parent-child relationship can be obtained. Based on the initial parameters, the synchronization update of the three-dimensional human body model and the skeleton after being driven in a non-skeletal animation manner is realized. For specific description, please refer to S302-S304.
[0096] S302: Obtain the vertex data corresponding to the initial three-dimensional human body model, and drive the initial three-dimensional human body model according to the vertex data to obtain a target three-dimensional human body model.
[0097] The vertex data can be measured or set by an animator, and the vertex data can be global data of the initial three-dimensional human body model or local data of a certain part of the initial three-dimensional human body model.
[0098] For example, the height parameter of the initial three-dimensional human body model is 1.5, and the actual height of the target object obtained by the collected point cloud data is 1.8. The actual height 1.8 is taken as the vertex data to drive the initial three-dimensional human body model to obtain a target three-dimensional human body model reflecting the actual height of the target object. However, the preset skeleton is adapted to the initial three-dimensional human body model with a height parameter of 1.5. By using the vertex animation method, the geometric vertices of the initial three-dimensional human body model change, but the internal skeleton does not change. Thus, the preset skeleton does not match the target three-dimensional human body with an actual height of 1.8, and therefore, the preset skeleton needs to be updated to reduce the deviation between the preset skeleton and the target three-dimensional human body model and realize the synchronization with the target three-dimensional human body model.
[0099] S303: Determine the three-dimensional coordinates of each skeleton node according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters.
[0100] In S303, the initial parameters of each skeleton node can be obtained through the initialization process, including at least the influence weight of each target geometric vertex associated with the skeleton node on the three-dimensional coordinates of the skeleton node, and the scaling ratio between the skeleton node and the parent node of the skeleton node.
[0101] According to the different levels of the skeleton nodes in the skeletal structure, the distribution states of the geometric vertices of the target three-dimensional human body model around the skeleton nodes are different after the vertex animation, and therefore, in S303, the calculation methods of the three-dimensional coordinates of the skeleton nodes are also different.
[0102] Taking a skeleton node as an example, the calculation process of the three-dimensional coordinates of the skeleton node after the vertex animation is described in detail as follows.Figure 7 It mainly includes the following steps:
[0103] S3031: Determine whether the current skeletal node is the root node. If yes, end; otherwise, execute S3032.
[0104] Since the root node is only used for positioning the origin of the skeletal coordinate system and does not participate in skeletal animation, it remains unchanged. Therefore, when the current skeletal node is the root node, the 3D coordinate calculation process ends. However, after vertex animation, the 3D coordinates of the geometric vertices in the initial 3D human model change, but the N target geometric vertices associated with the current skeletal node remain unchanged. Therefore, when the current skeletal node is not the root node, the 3D coordinates of the current skeletal node are calculated in reverse based on the 3D coordinates of the N target geometric vertices associated with the current skeletal node in the target 3D human model after vertex animation.
[0105] S3032: Determine whether the multiple target geometric vertices associated with the current skeletal node in the target 3D human body model are distributed on both sides of the virtual plane. If yes, execute S3033; otherwise, execute S3034.
[0106] The 3D coordinates of the bone nodes remain unchanged before the update, and the parent-child relationships in the bone structure also remain unchanged. Therefore, the virtual plane in S3032 is established during the initialization process using the current bone node and its parent node as normal vectors, passing through the current bone node. Based on the virtual plane, the distribution of multiple target geometric vertices associated with the current bone node in the target 3D human body model after vertex animation can be determined, thereby determining the method for calculating the 3D coordinates of the current bone node.
[0107] Specifically, the distances from the N target geometric vertices associated with the current skeletal node in the target 3D human body model to the virtual display plane are recalculated. The number of distances greater than 0 (n1') and the number of distances less than 0 (n2') are counted. When both n1' and n2' are not 0, it indicates that the N target geometric vertices in the driven target 3D human body model are distributed on both sides of the virtual plane, that is, the current skeletal node is located in the middle level of the skeleton structure, and the N target geometric vertices in the target 3D human body model are discretely distributed around the current skeletal node. When either n1' or n2' is 0, it indicates that the N target geometric vertices in the driven target 3D human body model are distributed on the same side of the virtual plane, that is, the current skeletal node is located at the very end of the skeleton structure.
[0108] S3033: Based on the influence weights of the multiple target geometric vertices associated with the current bone node on the 3D coordinates of the current bone node, the 3D coordinates of the multiple target geometric vertices in the target 3D human body model are weighted to determine the 3D coordinates of the current bone node.
[0109] In S3033, when the N target geometric vertices associated with the current bone node in the target 3D human body model are distributed on both sides of the virtual plane passing through the current bone node, the influence weights of the N target geometric vertices on the 3D coordinates of the current bone node have been obtained through the initialization process. In this way, after linearly weighting the 3D coordinates of multiple target geometric vertices in the target 3D human body model, the global 3D coordinates of the current bone node after model driving can be calculated in reverse.
[0110] Suppose that the influence weights of the N target geometric vertices associated with the current skeletal node on its 3D coordinates are ω1, ω2, ..., ω3, respectively. N The three-dimensional coordinates of the N geometric vertices in the target 3D human body model are V1, V2, ..., V3. N Then the current skeletal node V bone The formula for calculating the three-dimensional coordinates is:
[0111] V bone =(ω1V1+ω2V2+…+ω N V N ) / N Formula 3
[0112] It should be noted that the position of the skeletal node calculated based on Formula 3 may differ from the actual position. However, because the N geometric vertices associated with the current skeletal node on the target 3D human model are distributed in various directions of the current skeletal node and are relatively dispersed, the calculated position of the current skeletal node is slightly smaller. But experimental results show that the accuracy of the calculated position of the current skeletal node is within an acceptable range.
[0113] S3034: Redetermine the centroid of multiple target geometric vertices associated with the bone node in the target 3D human model, the second geometric distance between them and the parent node of the current bone node, and determine the 3D coordinates of the current bone node based on the second geometric distance and the scaling ratio between the current bone node and its parent node.
[0114] In S3034, when the N target geometric vertices associated with the current bone node in the target 3D human body model are distributed on the same side of the virtual plane passing through the current bone node, the scaling ratio between the current bone node and its parent node has been obtained through the initialization process. Based on this scaling ratio and the 3D coordinates of the N target geometric vertices in the target 3D human body model, the global 3D coordinates of the current bone node after model driving can be calculated in reverse.
[0115] Specifically, since the coordinates of the geometric vertices in the target three-dimensional human body model have changed, in S3034, the center of mass of the N geometric vertices associated with the current bone node in the target three-dimensional human body model needs to be recalculated, a vector line segment from the parent node of the current bone node to the new center of mass is drawn, the length of the vector line segment is determined according to the bone length between the current bone node and the parent node of the current bone node and the scaling ratio between the current bone node and the parent node of the current bone node obtained in the initialization, and the position of the end point of the vector line segment is the three-dimensional coordinates of the current bone node of the model after driving.
[0116] In the embodiments of the present application, the scaling of the bone length is mainly applicable to the scenario where the size of the human body geometric model itself changes, for example, when the height of the model changes, the size of the bone structure changes synchronously.
[0117] S304: updating the skeleton used for the bone animation of the target three-dimensional human body model according to the three-dimensional coordinates of each bone node and the parent-child relationship between the bone nodes.
[0118] After the global three-dimensional coordinates of all bone nodes of the model after driving are calculated, the bone animation driving algorithm can be performed according to actual requirements. Since the local transformation matrix of each bone node relative to the parent node is stored in the bone structure, after the three-dimensional coordinates of all bone nodes are obtained, in order to ensure that the bone structure is synchronized with the target three-dimensional human body model, the affine transformation matrix of each bone node relative to the parent node in the initial preset skeleton needs to be updated, that is, the bone structure in the initial preset skeleton needs to be updated.
[0119] Specifically, the updating process of the bone structure is described in detail in Figure 8 , which mainly includes the following steps:
[0120] S3041: determining the rotation matrix, the translation matrix and the scaling matrix of a bone node relative to the parent node of the bone node according to the three-dimensional coordinates of the bone node and the parent node of the bone node.
[0121] S3042: updating the skeleton used for the bone animation of the target three-dimensional human body model according to the rotation matrix, the translation matrix and the scaling matrix of each bone node relative to the corresponding parent node.
[0122] Since the translation vector, the rotation matrix and the scaling matrix of each bone node relative to the parent node are stored in the bone structure. In order to reduce the complexity of program calculation, in an optional implementation, the scaling matrix of the child bone node relative to the parent bone node is kept unchanged and is set as the unit matrix (that is, the child bone node and the parent bone node are in the same unit order), and the rotation matrix is set as the unit matrix, so that the translation vector between the child bone node and the parent bone node can be calculated according to the three-dimensional coordinates of the child bone node and the parent bone node.
[0123] Considering that the scale factor of the root node in the bone structure can not be 1, it is assumed that the scale factor of the root node is S, and the translation vector T of the child bone node relative to the parent bone node is expressed as:
[0124] T = (V bone_child -V bone_parent) / S Formula 4
[0125] wherein V bone_child represents the three-dimensional coordinates of the child bone node, and V bone_parent) represents the three-dimensional coordinates of the parent node.
[0126] After the vertex coordinate transformation of the human body geometric model, the coordinate information of the bone node can be updated synchronously in the embodiments of the present application, so that the skeleton architecture and the model change synchronously, and the complete flowchart of the synchronous update of the three-dimensional human body model and the skeleton is shown in Figure 9 , which mainly includes the following steps:
[0127] S901: reconstructing an initial three-dimensional human body model and generating a skeleton matching the initial three-dimensional human body model.
[0128] S902: for each bone node in the skeleton, determining N target geometric vertices in the initial three-dimensional human body model closest to the bone node and recording.
[0129] S903: establishing a virtual plane through the bone node with the bone node and the parent node of the bone node as normal vectors.
[0130] S904: determining whether the N target geometric vertices before model driving are distributed on both sides of the virtual plane, if yes, performing S905, and if not, performing S908.
[0131] S905: calculating the distances of the N target geometric vertices to the bone node, respectively.
[0132] S906: assigning the N distances as influence weights of the corresponding target geometric vertices on the three-dimensional coordinates of the bone node.
[0133] S907: normalizing the N influence weights.
[0134] S908: calculating the bone length between the bone node and the parent node of the bone node.
[0135] S909: calculating the centroid of the N target geometric vertices and the distance from the centroid to the parent node of the bone node.
[0136] S910: determining the proportion of the distance from the centroid to the parent node of the bone node to the bone length.
[0137] S911: Obtain the vertex data, drive the initial three-dimensional human body model, and obtain the target three-dimensional human body model.
[0138] S912: For each non-root node of the skeleton, determine whether the N target geometry vertices after driving are distributed on both sides of the skeleton node of the non-root node. If yes, perform S913; if no, perform S914.
[0139] S913: Determine the global three-dimensional coordinates of the skeleton node according to the three-dimensional coordinates of the N target geometry vertices after driving and the influence weight of each target geometry vertex on the three-dimensional coordinates of the skeleton node.
[0140] S914: Determine the center of mass of the N target geometry vertices after driving, and establish a vector from the parent node of the skeleton node to the new center of mass.
[0141] S915: Determine the end point of the vector according to the scaling ratio between the skeleton node and the parent node of the skeleton node and the bone length between the skeleton node and the parent node of the skeleton node.
[0142] S916: Take the three-dimensional coordinates of the end point of the vector as the global three-dimensional coordinates of the skeleton node.
[0143] S917: Calculate the local transformation matrix between the skeleton nodes.
[0144] S918: Synchronously update the skeleton used for skeletal animation of the target three-dimensional model after driving according to the local transformation matrix.
[0145] In the method for synchronously updating a three-dimensional human body model and a skeleton provided by the above embodiments, the initial three-dimensional human body model is bound to the preset skeleton, and through initialization, a plurality of target geometric vertices associated with each skeleton node, an influence weight corresponding to each target geometric vertex, and a scaling ratio between a child skeleton node and a parent skeleton node are determined. After the initialization is completed, the initial three-dimensional human body model is driven in a non-skeletal animation manner, the three-dimensional coordinates of each skeleton node are determined according to the three-dimensional coordinates of the geometric vertices in the driven target three-dimensional human body model and the initialization result, and the skeleton structure of the preset skeleton is updated according to the three-dimensional coordinates of each skeleton node to obtain a skeleton matching the target three-dimensional human body model, thereby realizing synchronous updating of the skeleton after the three-dimensional human body model is driven. Since the skeleton updating process is an updating process based on the preset skeleton, the updating process does not substantially move the skeleton position, the organization structure of the skeleton node does not change, the original structure and the number of skeleton nodes of the preset skeleton and the original skeletal skin data are maintained, and the consistency of the skeleton in the model animation process is ensured. In this way, when subsequent skeletal animation is performed based on the updated skeleton, since the skeleton is synchronized with the target three-dimensional human body model, the deviation between the two is small, thereby improving the authenticity and flexibility of the skeletal animation.
[0146] It should be noted that the method for synchronously updating a three-dimensional human body model and a skeleton provided by the embodiments of the present application is not only applicable to scenarios such as model fine changes and overall or local size adjustments caused by the BlendShape component, but also applicable to driving scenarios using motion capture data and the like, because motion capture is affected by various factors such as measurement noise and human walking errors, and after long-time driving, the position of the skeleton node may deviate, which can be optimized by the method of the embodiments of the present application.
[0147] Based on the same technical concept, the embodiments of the present application provide an electronic device, which can be a notebook computer, a desktop computer, a mobile phone, a tablet computer, a wearable device, and the like user terminal device, and can also be a cloud server, a server cluster, a distributed server, and the like server used in a virtual human interaction scenario. The electronic device can implement the method for synchronously updating a three-dimensional human body model and a skeleton provided by the above embodiments.
[0148] Referring to Figure 10 The electronic device includes a processor 1001 and a memory 1002, the processor 1001 and the memory 1002 are connected through a bus 1003, the memory 1002 stores computer program instructions, and the processor executes the following operations according to the computer program instructions:
[0149] According to the parent-child relationship between each bone node in the preset skeleton bound with the initial three-dimensional human body model, the geometric vertices in the initial three-dimensional human body model and the bone nodes in the preset skeleton are initialized to determine initial parameters of the bone nodes;
[0150] Obtain vertex data corresponding to the initial three-dimensional human body model, and drive the initial three-dimensional human body model according to the vertex data to obtain a target three-dimensional human body model;
[0151] According to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters, the three-dimensional coordinates of the bone nodes are determined.
[0152] According to the three-dimensional coordinates of the bone nodes and the parent-child relationship between the bone nodes, a skeleton for performing skeletal animation on the target three-dimensional human body model is updated.
[0153] Optionally, the processor 1001 initializes the geometric vertices in the initial three-dimensional human body model and the bone nodes in the preset skeleton bound with the initial three-dimensional human body model according to the parent-child relationship between each bone node in the preset skeleton to determine initial parameters of the bone nodes, and the specific operation is as follows:
[0154] For each bone node, the following operations are performed:
[0155] Associate a plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model with the bone node;
[0156] If the bone node is a non-root node, a virtual plane passing through the bone node is established with the bone node and the parent node of the bone node as normal vectors.
[0157] If the plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model are distributed on both sides of the virtual plane, the influence weight of the plurality of target geometric points in the initial three-dimensional human body model on the three-dimensional coordinates of the bone node is determined.
[0158] If the plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model are distributed on the same side of the virtual plane, the scaling ratio between the bone node and the parent node of the bone node is determined according to the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model.
[0159] Optionally, the processor 1001 determines the influence weight of the plurality of target geometric points in the initial three-dimensional human body model on the three-dimensional coordinates of the bone node, and the specific operation is as follows:
[0160] calculate first geometric distances from the plurality of target geometric points in the initial three-dimensional human body model to the bone node respectively;
[0161] use inverses of the first geometric distances as influence weights of the three-dimensional coordinates of the bone node by the plurality of target geometric points, and normalize the influence weights.
[0162] Optionally, the processor 1001 determines a scaling ratio between the bone node and a parent node of the bone node according to a centroid of the plurality of target geometric points in the initial three-dimensional human body model, and specifically performs the following operation:
[0163] calculates a bone length between the bone node and the parent node of the bone node, and calculates second geometric distances from the centroid of the plurality of target geometric points in the initial three-dimensional human body model to the parent node of the bone node;
[0164] uses a proportion of the second geometric distances to the bone length as the scaling ratio between the bone node and the parent node of the bone node.
[0165] Optionally, the initial parameters of the bone node at least include: influence weights of the three-dimensional coordinates of the bone node by the plurality of target geometric points associated with the bone node respectively, and the scaling ratio between the bone node and the parent node of the bone node;
[0166] The processor 1001 determines the three-dimensional coordinates of the bone nodes according to the three-dimensional coordinates of the geometric points in the target three-dimensional human body model and the initial parameters, and specifically performs the following operation:
[0167] For each bone node, the following operations are performed:
[0168] If the bone node is a non-root node, a distribution relationship between the plurality of target geometric points associated with the bone node in the target three-dimensional human body model and a virtual plane is determined, the virtual plane is established through the bone node with the bone node and the parent node of the bone node as normal vectors;
[0169] If the plurality of target geometric points in the target three-dimensional human body model are distributed on both sides of the virtual plane, the three-dimensional coordinates of the plurality of target geometric points in the target three-dimensional human body model are weighted according to the influence weights of the three-dimensional coordinates of the bone node by the plurality of target geometric points associated with the bone node, to determine the three-dimensional coordinates of the bone node.
[0170] If the target geometric vertices in the target three-dimensional human body model are distributed on the same side of the virtual plane, the center of mass of the target geometric vertices associated with the bone node in the target three-dimensional human body model is re-determined, and the three-dimensional coordinates of the bone node are determined according to the new center of mass and the scaling ratio between the bone node and the parent node of the bone node.
[0171] Optionally, the processor 1001 updates a skeleton used for performing skeletal animation on the target three-dimensional human body model according to the three-dimensional coordinates of the bone nodes and the parent-child relationship between the bone nodes, and the specific operation is as follows:
[0172] According to the three-dimensional coordinates of the bone node and the parent node of the bone node, the rotation matrix, the translation matrix and the scaling matrix of the bone node relative to the parent node of the bone node are determined.
[0173] According to the rotation matrix, the translation matrix and the scaling matrix of each bone node relative to the corresponding parent node, the skeleton used for performing skeletal animation on the target three-dimensional human body model is updated.
[0174] It should be noted that, Figure 10 This is only an example, and the hardware necessary for the electronic device to execute the steps of the method for synchronously updating a three-dimensional human body model and a skeleton provided by the embodiments of the present application is given. Not shown, when the electronic device is a user terminal device, it also includes a display screen, a keyboard, a power supply and other commonly used devices.
[0175] The processor involved in the embodiments of the present application Figure 10 may be a central processing unit (CPU), a general-purpose processor, a graphics processing unit (GPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof.
[0176] The embodiments of the present application also provide a computer-readable storage medium for storing some instructions, which can complete the method for synchronously updating a three-dimensional human body model and a skeleton in the foregoing embodiments when executed.
[0177] The embodiment of the present application further provides a computer program product for storing a computer program, which is used for executing the method for synchronously updating a three-dimensional human body model and a skeleton in the foregoing embodiment.
[0178] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system or a computer program product. Therefore, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. In addition, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage and the like) containing computer-usable program code.
[0179] The present application is described with reference to flowcharts and / or block diagrams of the method, device (system) and computer program product according to the present application. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and the combination of the flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus for performing the functions specified in one or more flows and / or blocks.
[0180] These computer program instructions can also be stored in a computer-readable memory capable of guiding a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including instruction apparatus, which implements the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus for performing the functions specified in one or more flows and / or blocks.
[0181] These computer program instructions can also be loaded into a computer or other programmable data processing device, so that a series of operation steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 one or more flows and / or blocks Figure 1 an apparatus for performing the functions specified in one or more flows and / or blocks.
[0182] Obviously, many modifications and variations of the present application are possible in light of the above teachings. It is, therefore, to be understood that within the scope of the appended claims and their equivalents, the application can be practiced otherwise than as specifically described.
Claims
1. A method for synchronously updating a three-dimensional human model and a skeleton, characterized in that, The method comprises the following steps: initializing the geometric vertices in the initial three-dimensional human body model and the skeleton nodes in the preset skeleton according to the parent-child relationship between the skeleton nodes in the preset skeleton bound to the initial three-dimensional human body model, and determining initial parameters of the skeleton nodes; the initial parameters at least include influence weights of a plurality of geometric vertices associated with each skeleton node on three-dimensional coordinates of the corresponding skeleton node, and a scaling ratio between the skeleton nodes with the parent-child relationship; obtaining vertex data corresponding to the initial three-dimensional human body model, and driving the initial three-dimensional human body model according to the vertex data in a non-skeletal animation manner to obtain a target three-dimensional human body model; determining three-dimensional coordinates of the skeleton nodes according to three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters; updating a skeleton used for skeletal animation of the target three-dimensional human body model according to the three-dimensional coordinates of the skeleton nodes and the parent-child relationship between the skeleton nodes; wherein the determination of the three-dimensional coordinates of the skeleton nodes according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters comprises: for each skeleton node, the following operations are performed: if the skeleton node is a non-root node, determining a distribution relationship of a plurality of target geometric vertices associated with the skeleton node in the target three-dimensional human body model and a virtual plane, the virtual plane being established through the skeleton node with the skeleton node and the parent node of the skeleton node as normal vectors; if the plurality of target geometric vertices in the target three-dimensional human body model are distributed on both sides of the virtual plane, weighting the three-dimensional coordinates of the plurality of target geometric vertices in the target three-dimensional human body model according to the influence weights of the plurality of target geometric vertices associated with the skeleton node on the three-dimensional coordinates of the skeleton node, and determining the three-dimensional coordinates of the skeleton node; if the plurality of target geometric vertices in the target three-dimensional human body model are distributed on the same side of the virtual plane, re-determining the centroid of the plurality of target geometric vertices associated with the skeleton node in the target three-dimensional human body model, and determining the three-dimensional coordinates of the skeleton node according to the new centroid and the scaling ratio between the skeleton node and the parent node of the skeleton node.
2. The method of claim 1, wherein, the initialization of the geometric vertices in the initial three-dimensional human body model and the skeleton nodes in the preset skeleton according to the parent-child relationship between the skeleton nodes in the preset skeleton bound to the initial three-dimensional human body model, and the determination of the initial parameters of the skeleton nodes comprise: for each skeleton node, the following operations are performed: associating a plurality of target geometric vertices closest to the skeleton node in the initial three-dimensional human body model with the skeleton node; if the skeleton node is a non-root node, establishing a virtual plane through the skeleton node with the skeleton node and the parent node of the skeleton node as normal vectors; If the plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model are distributed on both sides of the virtual plane, the influence weight of each of the plurality of target geometric points in the initial three-dimensional human body model on the three-dimensional coordinate of the bone node is determined; If the plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model are distributed on the same side of the virtual plane, the scaling ratio between the bone node and the parent node of the bone node is determined according to the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model.
3. The method of claim 2, wherein, The determination of the influence weight of each of the plurality of target geometric points in the initial three-dimensional human body model on the three-dimensional coordinate of the bone node comprises: The first geometric distance from each of the plurality of target geometric points in the initial three-dimensional human body model to the bone node is calculated; The reciprocal of each first geometric distance is taken as the influence weight of the corresponding target geometric vertex on the three-dimensional coordinate of the bone node, and each influence weight is normalized.
4. The method of claim 2, wherein, The determination of the scaling ratio between the bone node and the parent node of the bone node according to the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model comprises: The bone length between the bone node and the parent node of the bone node is calculated, and the second geometric distance from the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model to the parent node of the bone node is calculated; The proportion of the second geometric distance to the bone length is taken as the scaling ratio between the bone node and the parent node of the bone node.
5. The method of claim 1, wherein, The updating of the skeleton for the skeletal animation of the target three-dimensional human body model according to the three-dimensional coordinates of the bone nodes and the parent-child relationship between the bone nodes comprises: The rotation matrix, the translation matrix and the scaling matrix of the bone node relative to the parent node of the bone node are determined according to the three-dimensional coordinates of the bone node and the parent node of the bone node; The skeleton for the skeletal animation of the target three-dimensional human body model is updated according to the rotation matrix, the translation matrix and the scaling matrix of each bone node relative to the corresponding parent node.
6. An electronic device, comprising: The processor and the memory are connected through a bus, the memory stores a computer program, and the processor executes the following operations according to the computer program: The geometric vertices in the initial three-dimensional human body model and the bone nodes in the preset skeleton bound with the initial three-dimensional human body model are initialized according to the parent-child relationship between the bone nodes in the preset skeleton, and the initial parameters of the bone nodes are determined; The initial parameters at least include the influence weight of the plurality of geometric vertices associated with each bone node on the three-dimensional coordinate of the corresponding bone node, and the scaling ratio between the bone nodes with the parent-child relationship; The vertex data corresponding to the initial three-dimensional human body model is obtained, and the initial three-dimensional human body model is driven according to the vertex data in a non-skeletal animation manner to obtain a target three-dimensional human body model. determine the three-dimensional coordinates of the bone nodes according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters; update a skeleton used for performing skeletal animation on the target three-dimensional human body model according to the three-dimensional coordinates of the bone nodes and the parent-child relationship between the bone nodes; wherein the processor determines the three-dimensional coordinates of the bone nodes according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters, and specifically performs the following operations: for each bone node, the following operations are performed: if the bone node is a non-root node, determine the distribution relationship of a plurality of target geometric vertices associated with the bone node in the target three-dimensional human body model and a virtual plane, the virtual plane being established through the bone node with the bone node and the parent node of the bone node as normal vectors; if the plurality of target geometric vertices in the target three-dimensional human body model are distributed on both sides of the virtual plane, weight the three-dimensional coordinates of the plurality of target geometric vertices in the target three-dimensional human body model according to the influence weight of the plurality of target geometric vertices associated with the bone node on the three-dimensional coordinates of the bone node, and determine the three-dimensional coordinates of the bone node; if the plurality of target geometric vertices in the target three-dimensional human body model are distributed on the same side of the virtual plane, determine the centroid of the plurality of target geometric vertices associated with the bone node in the target three-dimensional human body model, and determine the three-dimensional coordinates of the bone node according to the new centroid and the scaling ratio between the bone node and the parent node of the bone node.
7. The electronic device of claim 6, wherein, the processor initializes the geometric vertices in the initial three-dimensional human body model and the bone nodes in the preset skeleton bound with the initial three-dimensional human body model according to the parent-child relationship between the bone nodes in the preset skeleton, determines the initial parameters of the bone nodes, and specifically performs the following operations: for each bone node, the following operations are performed: associate a plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model with the bone node; if the bone node is a non-root node, establish a virtual plane through the bone node with the bone node and the parent node of the bone node as normal vectors; if the plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model are distributed on both sides of the virtual plane, determine the influence weight of the plurality of target geometric points in the initial three-dimensional human body model on the three-dimensional coordinates of the bone node; if the plurality of target geometric vertices closest to the bone node in the initial three-dimensional human body model are distributed on the same side of the virtual plane, determine the scaling ratio between the bone node and the parent node of the bone node according to the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model.
8. The electronic device of claim 7, wherein, the processor determines the scaling ratio between the bone node and the parent node of the bone node according to the centroid of the plurality of target geometric vertices in the initial three-dimensional human body model, and specifically performs the following operations: calculating a bone length between the bone node and a parent node of the bone node, and calculating a second geometric distance between a centroid of the plurality of target geometric vertices in the initial three-dimensional human body model and the parent node of the bone node; taking a proportion of the second geometric distance to the bone length as a scaling proportion between the bone node and the parent node of the bone node.
9. The electronic device of claim 6, wherein, The initial parameters of the bone node at least include: influence weights of the plurality of target geometric vertices associated with the bone node on three-dimensional coordinates of the bone node, and the scaling proportion between the bone node and the parent node of the bone node; The processor determines the three-dimensional coordinates of the bone nodes according to the three-dimensional coordinates of the geometric vertices in the target three-dimensional human body model and the initial parameters, and specifically performs the following operations: For each bone node, the following operations are performed: If the bone node is a non-root node, a distribution relationship of the plurality of target geometric vertices associated with the bone node in the target three-dimensional human body model with respect to a virtual plane is determined, the virtual plane being established by the bone node and the parent node of the bone node as a normal vector; If the plurality of target geometric vertices in the target three-dimensional human body model are distributed on two sides of the virtual plane, the three-dimensional coordinates of the plurality of target geometric vertices in the target three-dimensional human body model are weighted according to the influence weights of the plurality of target geometric vertices associated with the bone node on the three-dimensional coordinates of the bone node, and the three-dimensional coordinates of the bone node are determined; If the plurality of target geometric vertices in the target three-dimensional human body model are distributed on the same side of the virtual plane, a centroid of the plurality of target geometric vertices associated with the bone node in the target three-dimensional human body model is determined again, and the three-dimensional coordinates of the bone node are determined according to the new centroid and the scaling proportion between the bone node and the parent node of the bone node.
Citation Information
Patent Citations
Skeleton driving method and device for three-dimensional model
CN113628307A
Skeletal data modeling method, computer equipment and storage medium
CN114359447A