Data correction method and device, electronic equipment and readable storage medium

文档序号:1923232 发布日期:2021-12-03 浏览:22次 中文

阅读说明:本技术 数据的修正方法及装置、电子设备、可读存储介质 (Data correction method and device, electronic equipment and readable storage medium ) 是由 刘思阳 于 2021-09-16 设计创作,主要内容包括:本申请提供的数据的修正方法及装置、电子设备,可读存储介质,利用运动部位在第一模型以及第二模型中的长度差异在第一方向的分量,修正末端节点的迁移后位置数据,消除了长度差异对于末端节点的位置坐标在第一方向的影响,利用归一化方法,屏蔽第一模型中的运动部位的长度的特异性,再利用反归一化加入第二模型中的运动部位的长度的特性,使用指向向量确定的末端节点的位置坐标在第二方向以及第三方向的分量,综上所述,得到第一模型的末端节点的位置坐标迁移到第二模型的末端节点后,与第二模型中运动部位的长度匹配,从而能够减小虚拟对象展示的动作与实体的动作之间的差异,进一步提高虚拟对象的动作的精准性。(The data correction method and apparatus, the electronic device, and the readable storage medium provided by the present application correct the post-migration position data of the end node by using the component of the length difference of the motion part in the first model and the second model in the first direction, eliminate the influence of the length difference on the position coordinate of the end node in the first direction, shield the specificity of the length of the motion part in the first model by using the normalization method, and determine the component of the position coordinate of the end node in the second direction and the third direction by using the characteristic of the length of the motion part added into the second model by inverse normalization and using the pointing vector, to sum up, after the position coordinate of the end node of the first model is migrated to the end node of the second model, the obtained position coordinate is matched with the length of the motion part in the second model, thereby reducing the difference between the motion exhibited by the virtual object and the motion of the entity, the accuracy of the motion of the virtual object is further improved.)

1. A method for modifying data is applied after data of a first model is migrated to a second model with the same topological relation, and is characterized by comprising the following steps:

acquiring a first parameter and a second parameter, wherein the first parameter represents the length of a movement part in the first model, and the second parameter represents the length of the movement part in the second model;

acquiring a difference value of position coordinates of a first starting node and a second starting node in a first direction as a position deviation value, wherein the first starting node is a starting node of the moving part in the first model, the second starting node is a starting node of the moving part in the second model, the starting node is a node which is close to a root node in an end part corresponding node of the moving part, the first direction is a direction in which the root node points to a tail end node, and the tail end node is a node which is far away from the root node in the end part corresponding node;

correcting the component of the post-migration position coordinate in the first direction according to the position deviation amount, wherein the post-migration position coordinate is as follows: migrating the position coordinates of the end node of the first model to the end node of the second model to obtain position coordinates;

normalizing a target vector according to the first parameter to obtain a normalized target vector, wherein the target vector is a vector of the first starting node in the first model pointing to the end node;

according to the second parameter, the normalized target vector is reversely normalized to the second model, and a pointing vector is obtained;

and determining a component of the position coordinate of the end node in the second model in a target direction according to the pointing vector and the position coordinate of the second starting node, wherein the target direction comprises a second direction and a third direction perpendicular to the first direction, and the first direction, the second direction and the third direction form a three-dimensional coordinate space.

2. The method of claim 1, wherein the obtaining the first parameter comprises:

acquiring initial position coordinates of corresponding nodes of each joint point of the moving part in the first model, wherein the initial position coordinates are position coordinates distributed to the first model when the first model is built;

and determining the length of the moving part in the first model as a first parameter according to the initial position coordinates of the corresponding nodes in the first model.

3. The method of claim 2, wherein the first model is a human model, and the motion part is a left leg and/or a right leg;

determining the length of the moving part in the first model according to the initial position coordinates of the corresponding node in the first model as the first parameter, including:

determining the length of the left leg in the first model according to the initial position coordinates of the corresponding node of the left leg joint point;

determining the length of the right leg in the first model according to the initial position coordinates of the corresponding node of the right leg joint point;

determining the length of the left leg and/or the right leg in the first model as the first parameter depending on the length of the left leg in the first model and the length of the right leg in the first model.

4. The method of claim 1, wherein the obtaining the second parameter comprises:

acquiring initial position coordinates of corresponding nodes of each joint point of a moving part in the second model, wherein the initial position coordinates are position coordinates distributed to the second model when the second model is constructed;

and determining the length of the moving part in the second model as the second parameter according to the initial position coordinates of the corresponding nodes in the second model.

5. The method according to any one of claims 1-4, wherein the obtaining a difference between the position coordinates of the first starting node and the second starting node in the first direction as the position deviation amount comprises:

determining a first difference value according to a difference between a component of a first start node in the first direction and a component of a position coordinate of the end node in the first model in the first direction;

determining a second difference value according to the difference between the component of the second starting node in the first direction and the component of the position coordinate of the tail node in the second model in the first direction;

determining the position deviation amount of the first starting node and the second starting node in the first direction according to the difference between the first difference and the second difference.

6. The method of claim 5, wherein the first model and the second model are both manikins, and the motion part is a left leg and/or a right leg;

the end nodes comprise corresponding nodes of a left ankle and corresponding nodes of a right ankle;

determining the first difference value according to a difference between a component of the first start node in the first direction and a component of the position coordinates of the end node in the first model in the first direction, including:

determining the first difference value according to the difference between the component of the first starting node in the first direction and the components of the end node of the left leg and the end node of the right leg of the first model in the first direction respectively;

determining the second difference value according to a difference between a component of a second starting node in the first direction and a component of the position coordinate of the end node in the second model in the first direction, including:

and determining the second difference value according to the difference between the component of the second starting node in the first direction and the components of the end node of the left leg and the end node of the right leg of the second model in the first direction respectively.

7. The method of claim 1, further comprising:

and determining post-migration position coordinates of the moving part in the corresponding nodes of the second model except the end node according to the components of the post-migration position coordinates in the first direction and the target direction, the components of the position coordinates of the end node in the second model in the first direction, and the initial position coordinates of the nodes of the second model.

8. An apparatus for modifying data, applied after migrating data of a first model to a second model with the same topological relation, is characterized by comprising:

a first obtaining module, configured to obtain a first parameter and a second parameter, where the first parameter represents a length of a moving part in the first model, and the second parameter represents a length of the moving part in the second model;

a second obtaining module, configured to obtain a difference between position coordinates of a first start node and a second start node in a first direction as a position deviation amount, where the first start node is a start node of the moving part in the first model, the second start node is a start node of the moving part in the second model, the start node is a node closer to a root node among nodes corresponding to end portions of the moving part, the first direction is a direction in which the root node points to an end node, and the end node is a node farther from the root node among the nodes corresponding to the end portions;

a correction module, configured to correct, according to the position deviation amount, a component of the post-migration position coordinate in the first direction, where the post-migration position coordinate is: migrating the position coordinates of the end node of the first model to the end node of the second model to obtain position coordinates;

a first processing module, configured to perform normalization processing on a target vector according to the first parameter to obtain a normalized target vector, where the target vector is a vector pointing to the end node from the first start node in the first model;

the second processing module is used for performing reverse normalization on the normalized target vector to the second model according to the second parameter to obtain a pointing vector;

a determining module, configured to determine, according to the pointing vector and the position coordinate of the second start node, a component of a position coordinate of the end node in the second model in a target direction, where the target direction includes a second direction and a third direction perpendicular to the first direction, and the first direction, the second direction, and the third direction form a three-dimensional coordinate space.

9. An electronic device, comprising:

a processor and a memory;

the memory is used for storing a program, and the processor is used for operating the program to realize the data correction method of any one of claims 1 to 7.

10. A computer-readable storage medium on which a program is stored, characterized in that, when the program is executed by an electronic device, the method of correcting data according to any one of claims 1 to 7 is implemented.

Technical Field

The present application relates to the field of data processing, and in particular, to a method and an apparatus for correcting data, an electronic device, and a readable storage medium.

Background

The production of 3D virtual objects (including characters and animals in general) is widely used in scenes such as animation production and movie special effects. Taking a 3D avatar as an example of a 3D virtual object, a general process for creating the 3D avatar is as follows: various motions of an entity, such as an actor, are captured through motion capture techniques, data indicative of the motions is generated, and the data is distributed onto a specified 3D model.

In practice, the behavior exhibited by the created virtual object may be different from the behavior exhibited by the entity. For example: the human body as an entity shows a step and the virtual object shows a split. For another example, a human body as an entity shows a ground-engaging step, while a virtual object shows a ground-engaging or ground-engaging step.

Therefore, how to reduce the difference between the actions of the virtual object and the physical actions to improve the precision of the actions of the virtual object becomes a problem to be solved in the field of virtual object manufacturing at present.

Disclosure of Invention

The application provides a data correction method and device, an electronic device and a readable storage medium, and aims to solve the problem of reducing the difference between the action of a virtual object and the action of an entity so as to improve the precision of the action of the virtual object.

In order to achieve the above object, the present application provides the following technical solutions:

a data correction method is applied to a second model with the same topological relation after data of a first model is migrated to the second model, and comprises the following steps:

acquiring a first parameter and a second parameter, wherein the first parameter represents the length of a movement part in the first model, and the second parameter represents the length of the movement part in the second model;

acquiring a difference value of position coordinates of a first starting node and a second starting node in a first direction as a position deviation value, wherein the first starting node is a starting node of the moving part in the first model, the second starting node is a starting node of the moving part in the second model, the starting node is a node which is close to a root node in an end part corresponding node of the moving part, the first direction is a direction in which the root node points to a tail end node, and the tail end node is a node which is far away from the root node in the end part corresponding node;

correcting the component of the post-migration position coordinate in the first direction according to the position deviation amount, wherein the post-migration position coordinate is as follows: migrating the position coordinates of the end node of the first model to the end node of the second model to obtain position coordinates;

normalizing a target vector according to the first parameter to obtain a normalized target vector, wherein the target vector is a vector of the first starting node in the first model pointing to the end node;

according to the second parameter, the normalized target vector is reversely normalized to the second model, and a pointing vector is obtained;

and determining a component of the position coordinate of the end node in the second model in a target direction according to the pointing vector and the position coordinate of the second starting node, wherein the target direction comprises a second direction and a third direction perpendicular to the first direction, and the first direction, the second direction and the third direction form a three-dimensional coordinate space.

Optionally, the acquiring the first parameter includes:

acquiring initial position coordinates of corresponding nodes of each joint point of the moving part in the first model, wherein the initial position coordinates are position coordinates distributed to the first model when the first model is built;

and determining the length of the moving part in the first model as a first parameter according to the initial position coordinates of the corresponding nodes in the first model.

Optionally, the first model is a human body model, and the motion part is a left leg and/or a right leg;

determining the length of the moving part in the first model according to the initial position coordinates of the corresponding node in the first model as the first parameter, including:

determining the length of the left leg in the first model according to the initial position coordinates of the corresponding node of the left leg joint point;

determining the length of the right leg in the first model according to the initial position coordinates of the corresponding node of the right leg joint point;

determining the length of the left leg and/or the right leg in the first model as the first parameter depending on the length of the left leg in the first model and the length of the right leg in the first model.

Optionally, the obtaining the second parameter includes:

acquiring initial position coordinates of corresponding nodes of each joint point of a moving part in the second model, wherein the initial position coordinates are position coordinates distributed to the second model when the second model is constructed;

and determining the length of the moving part in the second model as the second parameter according to the initial position coordinates of the corresponding nodes in the second model.

Optionally, the obtaining a difference between the position coordinates of the first start node and the second start node in the first direction as the position deviation amount includes:

determining a first difference value according to a difference between a component of a first start node in the first direction and a component of a position coordinate of the end node in the first model in the first direction;

determining a second difference value according to the difference between the component of the second starting node in the first direction and the component of the position coordinate of the tail node in the second model in the first direction;

determining the position deviation amount of the first starting node and the second starting node in the first direction according to the difference between the first difference and the second difference.

Optionally, the first model and the second model are both human body models, and the motion part is a left leg and/or a right leg;

the end nodes comprise corresponding nodes of a left ankle and corresponding nodes of a right ankle;

determining the first difference value according to a difference between a component of the first start node in the first direction and a component of the position coordinates of the end node in the first model in the first direction, including:

determining the first difference value according to the difference between the component of the first starting node in the first direction and the components of the end node of the left leg and the end node of the right leg of the first model in the first direction respectively;

determining the second difference value according to a difference between a component of a second starting node in the first direction and a component of the position coordinate of the end node in the second model in the first direction, including:

and determining the second difference value according to the difference between the component of the second starting node in the first direction and the components of the end node of the left leg and the end node of the right leg of the second model in the first direction respectively.

Optionally, the method further includes:

and determining post-migration position coordinates of the moving part in the corresponding nodes of the second model except the end node according to the components of the post-migration position coordinates in the first direction and the target direction, the components of the position coordinates of the end node in the second model in the first direction, and the initial position coordinates of the nodes of the second model.

A data modification device applied to a second model with the same topological relation as the data of a first model comprises the following steps:

a first obtaining module, configured to obtain a first parameter and a second parameter, where the first parameter represents a length of a moving part in the first model, and the second parameter represents a length of the moving part in the second model;

a second obtaining module, configured to obtain a difference between position coordinates of a first start node and a second start node in a first direction as a position deviation amount, where the first start node is a start node of the moving part in the first model, the second start node is a start node of the moving part in the second model, the start node is a node closer to a root node among nodes corresponding to end portions of the moving part, the first direction is a direction in which the root node points to an end node, and the end node is a node farther from the root node among the nodes corresponding to the end portions;

a correction module, configured to correct, according to the position deviation amount, a component of the post-migration position coordinate in the first direction, where the post-migration position coordinate is: migrating the position coordinates of the end node of the first model to the end node of the second model to obtain position coordinates;

a first processing module, configured to perform normalization processing on a target vector according to the first parameter to obtain a normalized target vector, where the target vector is a vector pointing to the end node from the first start node in the first model;

the second processing module is used for performing reverse normalization on the normalized target vector to the second model according to the second parameter to obtain a pointing vector;

a determining module, configured to determine, according to the pointing vector and the position coordinate of the second start node, a component of a position coordinate of the end node in the second model in a target direction, where the target direction includes a second direction and a third direction perpendicular to the first direction, and the first direction, the second direction, and the third direction form a three-dimensional coordinate space.

An electronic device, comprising:

a processor and a memory;

the memory is used for storing programs, and the processor is used for operating the programs so as to realize the data correction method.

A computer-readable storage medium having a program stored thereon, the program, when executed by an electronic device, implementing the above-described data correction method.

The technical solution disclosed in the embodiment of the present application corrects the post-migration position data of the end node by using the component of the length difference of the moving part in the first direction in the first model and the second model, thereby eliminating the influence of the length difference on the position coordinate of the end node in the first direction, and uses the normalization method to shield the specificity of the length of the moving part in the first model, and uses the characteristic of the length of the moving part added in the second model by inverse normalization, so that the components of the position coordinate of the end node in the second direction and the third direction determined by using the pointing vector are obtained, and after the position coordinate of the end node in the first model is migrated to the end node in the second model, the components are matched with the length of the moving part in the second model, thereby reducing the difference between the motion exhibited by the virtual object and the motion of the entity, the accuracy of the motion of the virtual object is further improved.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.

FIG. 1 is an exemplary diagram of a 3D model of a human body corresponding to a portion of a joint point of the human body;

FIG. 2 is an exemplary diagram of legs in a 3D model of a human body;

fig. 3 is a flowchart of a data modification method disclosed in an embodiment of the present application;

fig. 4 is a flowchart of a data modification method disclosed in an embodiment of the present application;

FIG. 5 is a flow chart of another method for modifying data disclosed in the embodiments of the present application;

fig. 6 is a schematic structural diagram of a data correction apparatus according to an embodiment of the present application.

Detailed Description

The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

In the research process, the applicant finds that driving bone nodes (hereinafter referred to as nodes) in the specified 3D model and joint points in the entity generally have the same topological relation because the actions made by the entity are to be shown, that is, the driving bone nodes in the specified 3D model correspond to all or part of the joint points in the entity in a one-to-one manner.

However, the ratio of the node distance in the specified 3D model is not necessarily the same as the ratio of the corresponding joint length in the entity, so the motion exhibited by the specified 3D model may have a large deviation from the motion made by the entity.

Therefore, the applicant proposed:

in order to improve the accuracy of the motion of the virtual object, a 3D model adapted to the entity, hereinafter referred to as a first model, may be constructed first. The captured data is assigned to the first model to obtain data (position coordinates and rotation data) of nodes in the first model, and then the data of the nodes in the first model is migrated to a specified 3D model, hereinafter referred to as a second model, and the virtual object is driven using the second model.

However, the applicant has found that: even if the above manner is used, since the length of the motion portion in the first model may be different from the length of the motion portion in the second model, after the data of the node of the first model is migrated to the second model, the motion represented by the motion portion of the virtual object driven by the second model may be greatly different from the motion of the entity.

The difference is mainly reflected in the following two aspects:

on the one hand, the relative position relationship between the moving part and a certain object in space (referred to as a space object for short) is different, and the human body model are taken as examples: the relative position relationship between the two legs of the entity and the ground as the space object is grounding, and the virtual object is shown as entering the ground or leaving the ground due to the difference of the lengths of the motion parts in the first model and the second model.

On the other hand, the motion types shown in the motion parts are different, and the human body model are taken as examples: the human body as an entity shows a step and the virtual object shows a split.

Data migration does not fully address the issue of motion accuracy.

In the following embodiments, a technical solution for correcting migrated data is provided, which is to migrate data of a node in a first model to a node in a second model, and after the migrated data is obtained, correct the migrated data to reduce a difference between an action exhibited by a virtual object and an action exhibited by an entity driven by the second model, thereby further improving accuracy of the action of the virtual object.

Some definitions are explained and illustrated below:

the topological relation refers to the type of the nodes and the connection relation among the nodes. The type of a node is the type of the node in the corresponding entity, such as the various nodes shown in FIG. 1. It is to be understood that fig. 1 shows a node corresponding to a part of a joint point of a human body.

The first model and the second model are both 3D models, wherein the data of the included nodes comprise position coordinates and rotation data. The definition of rotation data can be found in the prior art.

The proportion of the node distances is as follows: the ratio of the distance S1 between the first node A and the second node B to the distance S2 between the other two nodes C and D, S1/S2. Wherein, the distance can be calculated by the position coordinates of the nodes. Taking fig. 1 as an example, the position coordinates of Hips and lefthippships are used to obtain the distance S1 between Hips and lefthipps, the position coordinates of Hips and righthipps are used to obtain the distance S2 between Hips and righthipps, and S1 is divided by S2 to obtain the ratio of the node distance.

The ratio of the lengths of the joint points in the entity refers to the ratio of the lengths of bones between the joint points, for example, the length of a bone between the joint point 1 and the joint point 2 is S3, the length of a bone between the joint point 3 and the joint point 4 is S4, and S3/S4 is a joint point length ratio.

The first model is adapted to the entity: the nodes in the first model are in one-to-one correspondence with the joints in the entity, and the ratio of the distances between the nodes in the first model is the same as the ratio of the lengths of the corresponding joints in the entity, for example, the ratio of the distance between Hips and LeftHips divided by the distance between Hips and RightHips in fig. 1 is equal to the ratio of the length of bone between Hips and LeftHips divided by the length of bone between Hips and RightHips in the human body.

The nodes in the model correspond to the joint points in the entity, and the method comprises the following steps: the data distributed to a certain node in the model is data acquired by displacement or rotation of a certain joint point in the entity, and the node corresponds to the joint point.

Based on the above, the first model and the second model have the same topological relationship, and the nodes in the first model correspond to the nodes in the second model one to one, that is, the nodes in the first model all have unique corresponding nodes in the second model.

The motion part and other parts can be divided into a solid body and a model. In the physical body, the movement portion is a portion in which the joint points for displaying the movement are connected, and the other portions are portions in which the joint points not for displaying the movement are connected. In the model, the motion part is a part formed by nodes corresponding to joint points constituting the motion part in the entity.

The corresponding node of the end of the motion part in the model is called an end corresponding node. Based on the above definition of the movement portion, the movement portion generally has two ends, and the following embodiments have both ends as an example, but the same applies to the case of a plurality of ends.

The length of the moving part in the model is the distance that the moving part moves from one end corresponding node to another end corresponding node after passing through other corresponding nodes in sequence. The other corresponding nodes are nodes other than the end corresponding nodes among the corresponding nodes of the joint points of the moving part in the entity.

Of the two end nodes, the node closest to the root node of the model is called the start node, and the node farthest from the root node is called the end node.

Fig. 1 is an example of a human body 3D model used in an embodiment of the present application, Hips represents a hip node, Spine1 represents a first (off) node of a Spine, Spine2 represents a second (off) node of the Spine, Neck (off) node, Head represents a Head (off) node, LeftShoulder represents a left shoulder (off) node, RightShoulder represents a right shoulder (off) node, LeftElbow represents a left elbow (off) node, RightElbow represents a right elbow (off) node, leftwright represents a left wrist (off) node, rightwright represents a right wrist (off) node, LeftHips represents a left hip (off) node, RightHips represents a right hip (off) node, LeftKnee represents a left knee (off) node, RightKnee represents a right left knee (off) node, leftanklebetle represents a left ankle (off) node, and rightankles represents a right ankle (off) node.

The moving parts in fig. 1 include legs, arms, and head, and the torso is the other part. In the following embodiments of the present application, the exercise portion is exemplified by the left leg and/or the right leg.

In the model shown in fig. 1, the left leg is a part of the motion part, and the nodes of the left leg are Hips, LeftHips, LeftKnee, and LeftAnkle. The end nodes of the left leg are Hips and LeftAnkle. The length of the left leg is the sum of the distance traveled from Hips to LeftAnkle, i.e., the distance between Hips and LeftHips, the distance between LeftHips and LeftKnee, and the distance between LeftKnee and LeftAnkle, among Hips, LeftHips, LeftKnee, and LeftAnkle.

No matter the first model or the second model, a root node is set. The root node of the model is a reference node designated in advance among the nodes of the model, and the position coordinates of the reference node are references to the position coordinates of other nodes. In this embodiment, the root node takes Hips shown in fig. 1 as an example.

In the end nodes Hips and LeftAnkle, Hips is a start node (the start node is the same as the root node), and LeftAnkle is an end node.

Whether the first model or the second model, when the model is built, a certain posture is taken as an initial posture, so that the model presents position data of the initial posture, and the position data is called as initial position data. Also taking a human body model as an example, the initial posture is T-Pose, namely the posture of the shape of the T.

The flow of data modification proposed in the embodiments of the present application will be described in detail below.

Fig. 3 is a flow of a data modification method disclosed in the embodiment of the present application, and after the data of the first model is migrated to the second model with the same topological relation, it can be understood that, in the embodiment of the present application, a specific manner for migrating the data of the first model to the second model is not limited.

Fig. 3 includes the following steps:

and S31, acquiring the first parameter and the second parameter.

The first parameter represents a length of the motion portion in the first model, and the second parameter represents a length of the motion portion in the second model.

It is to be understood that, based on the above definition, the length of the motion part may be determined using the position coordinates of the corresponding node of the joint point of the motion part in the model. Specific implementations can be seen in the following examples.

And S32, acquiring the position deviation amount of the first starting node and the second starting node in the first direction.

The first starting node is a starting node of the motion part in the first model, and the second starting node is a starting node of the motion part in the second model. The first direction is a direction in which the root node points to the end node of the moving part. Wherein the definition of the starting node and the end node is as described above.

The position deviation amount of the first starting node and the second starting node in the first direction can reflect the length difference of the moving part in the first model and the second model.

It is understood that the execution order of S31 and S32 is not limited.

S33, the component of the post-transition position coordinates in the first direction is corrected using the position deviation amount.

And correcting the position coordinates after the migration into the position coordinates of the end node of the first model, and transferring the position coordinates to the end node of the second model to obtain the position coordinates. As described above, the manner of transferring the position coordinates is not limited here.

It can be understood that, since the position deviation amount can reflect the difference between the lengths of the moving part in the first model and the second model, the corrected post-migration position coordinates can eliminate the influence of the difference between the lengths of the moving part in the first model and the second model, so that the problem of showing the relative position relationship between the entity moving part and the space object incorrectly can be solved.

And S34, normalizing the target vector by using the first parameter to obtain a normalized target vector.

The target vector is the vector of the first start node in the first model pointing to the end node.

Since the first parameter indicates the length of the moving part in the first model, the normalized target vector obtained by the normalization process using the first parameter can be regarded as a vector in which the specificity of the length of the moving part in the first model is eliminated.

And S35, using the second parameter to reversely normalize the normalized target vector to the second model to obtain the pointing vector.

Since the second parameter represents the length of the moving part in the second model, the pointing vector obtained by inverse normalization using the second parameter can be regarded as having the length characteristic of the moving part in the second model.

And S36, determining the component of the position coordinate of the end node in the second model in the target direction according to the pointing vector and the position coordinate of the second starting node.

The target direction comprises a second direction and a third direction which are perpendicular to the first direction, and the first direction, the second direction and the third direction form a three-dimensional coordinate space.

It can be appreciated that because the pointing vector eliminates the length characteristic of the moving part in the first model and has the length characteristic of the moving part in the second model, the component of the position coordinates determined using the pointing vector also eliminates the effect of the difference in length of the moving parts of the first model and the second model.

Further, the pointing vector indicates the distance between the second start node and the end node in the second model, and therefore, the position coordinates of the end node in the second model can be determined from the pointing vector and the position coordinates of the second start node. Further, when the vector and the position coordinates are known, the component of the vector in the target direction and the component of the position coordinates in the target direction can be acquired, and therefore the component of the position coordinates of the end node in the target direction can be specified.

It will be appreciated that the component in the target direction is not a correction to the post-migration position coordinates, but rather a re-determination of the position coordinates of the end node of the moving part in the second model, as compared to the correction of the component of the post-migration position coordinates of the end node in the first direction.

The purpose of S34-S36 is to eliminate the influence of the length difference of the moving part between the first model and the second model on the position coordinates of the end node, thereby solving the problem that the motion type of the virtual object is inconsistent with the motion type of the entity.

To sum up, in the present embodiment, the post-migration position data of the end node is corrected by using the component of the length difference of the moving part in the first direction in the first model and the second model, so as to eliminate the influence of the length difference on the position coordinate of the end node in the first direction, and the specificity of the length of the moving part in the first model is masked by using the normalization method, and the characteristic of the length of the moving part in the second model is added by using the inverse normalization method, so that the components of the position coordinate of the end node in the second direction and the third direction determined by using the pointing vector are obtained, and after the position coordinate of the end node in the first model is migrated to the end node in the second model, the position coordinate is matched with the length of the moving part in the second model, so as to reduce the difference between the motion exhibited by the virtual object and the motion of the entity, the accuracy of the motion of the virtual object is further improved.

The above-described embodiment is applied to the flow of the human body 3D model shown in fig. 1, in which, as shown in fig. 2, the moving parts are the left leg and the right leg shown in fig. 1.

As shown in fig. 4, the present embodiment includes the following steps:

and S41, acquiring initial position coordinates of the corresponding nodes of the joint points of the moving part in the first model.

In fig. 2, the corresponding nodes of the respective joint points of the moving part in the first model are: hips, LeftHips, RightHips, LeftKnee, RightKnee, LeftAnkle, and RightAnkle.

As described above, the initial position coordinates are position coordinates assigned to the first model when the first model is constructed. For the human 3D model, the initial position coordinates are those in the T-Pose state.

The position data of each node of the moving part of the first model in the T-pos state (i.e., the initial position data of each node of the moving part in the first model) is expressed as:

wherein A represents a first model in the T-Pose state.

And S42, determining the length of the moving part in the first model as a first parameter according to the initial position coordinates of the corresponding node in the first model.

Specifically, since the two legs in fig. 2 include the left leg and the right leg, in order to make the first parameter more accurate, the implementation manner of S42 is:

and determining the length of the left leg according to the initial position coordinates of the corresponding nodes of the joint points of the left leg. That is, as shown in fig. 2, the two legs both use the root node as the starting node, from the starting node to the end node, the vectors between the nodes on the left leg are VL1 A、VL2 AAnd VL3 AThen the length of the left leg is VL1 A、VL2 AAnd VL3 AThe sum of the lengths of (a) and (b).

And determining the length of the right leg according to the initial position coordinates of the corresponding node of the joint point of the right leg. Similarly, the length of the right leg shown in FIG. 2 is vector VR1 A、VR2 AAnd VR3 AThe sum of the lengths.

The leg length of the first model is determined as a first parameter based on the length of the left leg and the length of the right leg. One implementation may be: the average of the sum of the length of the left leg and the length of the right leg is taken as a first parameter.

And S43, acquiring initial position coordinates of the corresponding nodes of the joint points of the moving part in the second model.

And S44, determining the length of the moving part in the second model as a second parameter according to the initial position coordinates of the corresponding node in the second model.

In a manner similar to the determination of the first parameter, the average of the sum of the length of the left leg and the length of the right leg in the second parameter is taken as the second parameter.

S45, determining a first difference value according to a difference between the component of the first start node in the first direction and the component of the position coordinates of the end node in the first model in the first direction.

Taking fig. 2 as an example, the first direction is a vertical direction, and the component of the first start node in the first direction is recorded asThe end node of the left leg is LeftAnkle, and the component in the first direction is recorded asThe end node of the right leg is Right Ankle, and the component in the first direction is recorded as

Optionally, in this step, the first difference between the first start node and the end node isIt can be seen that the first difference represents the distance in the vertical direction of the first start node from the end node in the first model.

The difference is determined by using the left leg end node and the right leg end node, and the accuracy is higher.

S46, determining a second difference value according to a difference between the component of the second start node in the first direction and the component of the position coordinate of the end node in the second model in the first direction.

Similarly, the second difference isWherein B represents the second model. It can be seen that the second difference represents the distance in the vertical direction of the second starting node from the end node in the second model.

And S47, determining the position deviation amount of the first starting node and the second starting node in the first direction according to the difference between the first difference and the second difference.

I.e. the amount of positional deviation

It is understood that the positional deviation amount represents the difference in leg length.

And S48, correcting the component of the position coordinate of the terminal node in the first direction after the position coordinate of the first model is transferred to the position coordinate of the second model by using the position deviation amount.

In particular, the method comprises the following steps of,wherein the content of the first and second substances,for the purpose of the corrected post-migration position coordinates,is the component of the post-migration position coordinates in the first direction.

And S49, normalizing the target vector by using the first parameter to obtain a normalized target vector.

The target vector is the vector of the first start node in the first model pointing to the end node. Taking FIG. 2 as an example, the target vector is vL. Is normalized by

And S410, using the second parameter to perform inverse normalization on the normalized target vector to a second model to obtain a pointing vector.

Denormalization to the second model is:

s411, determining the component of the position coordinate of the end node in the second model in the target direction according to the pointing vector and the position coordinate of the second start node.

In this embodiment, the first direction is a vertical direction and is represented by a y-axis, the second direction may be an x-axis direction, and the third direction may be a z-axis direction. Wherein the x-axis, the y-axis and the z-axis are perpendicular to each other.

The component of the position coordinate of the left leg end node in the second model in the second direction is:

the component of the position coordinate of the left leg end node in the second model in the third direction is:

the component of the position coordinate of the end node of the right leg in the target direction is determined in a similar manner to the component of the position coordinate of the end node of the left leg in the target direction, and is not described herein again.

In the method of this embodiment, based on the lengths of the two legs in the first model and the second model, the first parameter and the second parameter are respectively obtained, the first parameter is then used to remove the influence of the length of the two legs in the first model on the position coordinate of the end node, the second parameter is used to enable the position coordinate of the end node in the second model to adapt to the length of the moving part in the second model, and the deviation of the start node is used to correct the component of the post-migration position coordinate of the end node in the vertical direction, so that the difference between the action exhibited by the virtual object driven by the second model and the action exhibited by the entity is reduced.

In addition, in the human body 3D model, when the moving part is both legs, the first parameter, the second parameter, and the deviation amount are determined by using data of the end nodes of both legs, and therefore, the accuracy of optimization can be further improved.

Fig. 5 is a flowchart of a data modification method disclosed in an embodiment of the present application, where compared with the foregoing embodiment, steps for further enhancing accuracy of a virtual object and saving computing resources are newly added, and the flowchart shown in fig. 5 includes the following steps:

s51, position data (i.e., initial position data) of the nodes in the initial state of the first model and the second model is acquired.

In this embodiment, the initial state of the model is the T-Pose state of the model. The position data of the node in the T-Pose state is as follows:

the position data of each node of the first model in the T-pos state (i.e., the initial position data of each node in the first model) is recorded as:wherein A represents a first model in the T-Pose state.

The position data of each node of the second model in the T-pos state (i.e. the initial position data of each node in the second model) is:b represents a second model in the T-Pose state.

Wherein Hips represents a hip (off) node, Spine1 represents a first (off) node of the Spine, Spine2 represents a second (off) node of the Spine, tack represents a Neck (off) node, Head represents a Head (off) node, leftShoulder represents a left shoulder (off) node, rightShoulder represents a right shoulder (off) node, leftElbow represents a left elbow (off) node, rightElbow represents a right elbow (off) node, leftWrist represents a left wrist (off) node, rightWrist represents a right wrist (off) node, LeftHips represents a left hip (off) node, rightHips represents a right hip (off) node, LeftKnee represents a left knee (off) node, rightKnee represents a right left knee (off) node, leftAnkle represents a left ankle (off) node, and rightAnkle represents a right ankle (off) node.

And S52, acquiring the position deviation amount of the first starting node and the second starting node in the first direction.

And S53, acquiring the first parameter and the second parameter.

In this embodiment, the specific implementation manners of S52 and S53 may refer to the above embodiments, and are not described again.

And S54, collecting data of the nodes of the first model.

Wherein the data of the nodes of the first model comprises position coordinates and rotation data of the nodes in the first model.

In general, motion capture techniques may be used to capture data from various joint points of an entity during motion and assign the captured data to nodes in the first model. The data of any one node in the first model includes position coordinates of the node and rotation data.

It can be understood that if motion data is continuously collected, multi-frame motion data may be formed, and in this embodiment, any one frame of motion data of the first model is recorded as:

rotation data:

wherein A-src represents the first model in motion.

Position coordinates:

and S55, migrating the position coordinates of the nodes of the first model to the corresponding nodes of the second model to obtain the migrated position coordinates of the nodes of the second model.

Specifically, the migration method of the data is not limited.

For example, the rotation data of each node of the second model is the rotation data of each corresponding node of the first model, that is, the rotation data of the node of the first model is directly used as the rotation data of the corresponding node of the second model.

The position coordinates of each node of the second model can be calculated by using the FK algorithm according to the rotation data of each node of the second model and the topology structure of the second model. The specific calculation process can be referred to in the prior art, and is not described in detail here.

In this embodiment, the position coordinates of the moving part in the second model obtained in this step are expressed as:

note that, in the nodes of the second model, the data obtained in this step may be used as post-migration data, except for the nodes corresponding to the joint points of the moving part. In order to avoid the problem of inconsistent motion, the corresponding nodes of the joint points of the moving part need to be optimized by the following steps.

And S56, correcting the component of the position coordinate of the terminal node in the first direction after the position coordinate of the first model is transferred to the position coordinate of the second model by using the position deviation amount.

And S57, determining the component of the terminal node in the target direction.

Specific implementation manners of S56 and S57 can be found in the above embodiments, and are not described herein again.

And S58, determining the post-migration position coordinates of the nodes except the end node in the corresponding nodes of the movement part according to the components of the post-migration position coordinates of the end node in the second model in the first direction and the target direction and the initial position coordinates of the nodes of the second model.

As shown in FIG. 2, other nodes include LeftHips, RightHips, LeftKnee, and RightKnee. Under the condition that the post-migration position coordinates of LeftAnkle and RightAnkle are known, the post-migration position coordinates of legs LeftHips, RightHips, LeftKnee and RightKnee can be obtained by using an IK algorithm in combination with the skeleton topology of the second model and the position coordinates of leg end nodes in the second model obtained in the above steps.

The method described in this embodiment does not perform post-data-migration correction for nodes of non-moving parts, but performs post-migration correction only for nodes of moving parts, and therefore can save computational resources. Furthermore, the position coordinates of other nodes of the moving part are corrected in addition to the end node, and the accuracy of the movement of the virtual object can be further improved. And the position coordinates of other nodes of the moving part except the end node are determined by using the post-migration position coordinates of the end node of the moving part, and are not determined in the same way of the end node, so that the calculation force resource can be further saved.

The steps in the above flow will be described in more detail by way of example, and it should be noted that, in the following examples, a root node and a two-leg node will be taken as examples:

1. the position coordinates of the node of the first model under the T-Pose are as follows:

the position coordinates of the nodes of the second model under the T-Pose are as follows:

2. in the case where the coordinate axis in the vertical direction is assumed as the y-axis,

3. based on the position coordinates in 1 and 2, the process of determining the normalization parameters is:

the x-axis component of the normalized parameter is:

the z-axis component of the normalized parameter is:

4. based on the position coordinates in 1 and 2, the process of determining the denormalization parameters is:

the x-axis component of the denormalized parameter is:

the z-axis component of the denormalized parameter is:

5. assuming that the position coordinates of the root node of the first frame of the first model and the end node of the motion part are:

the position coordinates of the nodes of the first frame of the second model determined from the position data of the nodes of the first frame of the first model are:

the vector of the root node pointing to the end node of the motion part in the second model is:

6. the optimized position data of the two-leg end node in the first frame of the second model are as follows:

fig. 6 is a data modification apparatus according to an embodiment of the present application, which is applied after migrating data of a first model to a second model with the same topological relation, and includes:

a first obtaining module, configured to obtain a first parameter and a second parameter, where the first parameter represents a length of a moving part in the first model, and the second parameter represents a length of the moving part in the second model.

A second obtaining module, configured to obtain a difference between position coordinates of a first start node and a second start node in a first direction, where the difference is used as a position deviation amount, the first start node is a start node of the moving part in the first model, the second start node is a start node of the moving part in the second model, the start node is a node closer to a root node among nodes corresponding to end portions of the moving part, the first direction is a direction in which the root node points to an end node, and the end node is a node farther from the root node among the nodes corresponding to end portions.

A correction module, configured to correct, according to the position deviation amount, a component of the post-migration position coordinate in the first direction, where the post-migration position coordinate is: and transferring the position coordinates of the end node of the first model to the end node of the second model to obtain position coordinates.

And the first processing module is used for carrying out normalization processing on a target vector according to the first parameter to obtain a normalized target vector, wherein the target vector is a vector of the first starting node in the first model pointing to the tail end node.

And the second processing module is used for performing reverse normalization on the normalized target vector to the second model according to the second parameter to obtain a pointing vector.

A determining module, configured to determine, according to the pointing vector and the position coordinate of the second start node, a component of a position coordinate of the end node in the second model in a target direction, where the target direction includes a second direction and a third direction perpendicular to the first direction, and the first direction, the second direction, and the third direction form a three-dimensional coordinate space.

Optionally, a specific implementation manner of the first obtaining module for obtaining the first parameter includes: the first obtaining module is specifically configured to obtain initial position coordinates of corresponding nodes of each joint point of the moving part in the first model, where the initial position coordinates are position coordinates allocated to the first model when the first model is constructed; and determining the length of the moving part in the first model as a first parameter according to the initial position coordinates of the corresponding nodes in the first model.

Optionally, the first model is a human body model, and the motion part is a left leg and/or a right leg. The first obtaining module is configured to determine, according to the initial position coordinates of the corresponding node in the first model, a length of the moving part in the first model, and a specific implementation manner of the first obtaining module as a first parameter includes: the first obtaining module is specifically configured to determine, according to the initial position coordinates of the node corresponding to the left leg joint point, the length of the left leg in the first model; determining the length of the right leg in the first model according to the initial position coordinates of the corresponding node of the right leg joint point; determining the length of the left leg and/or the right leg in the first model as the first parameter depending on the length of the left leg in the first model and the length of the right leg in the first model.

Optionally, a specific implementation manner of the first obtaining module for obtaining the second parameter includes: the first obtaining module is specifically configured to obtain initial position coordinates of corresponding nodes of each joint point of a moving part in the second model, where the initial position coordinates are position coordinates allocated to the second model when the second model is constructed; and determining the length of the moving part in the second model as the second parameter according to the initial position coordinates of the corresponding nodes in the second model.

Optionally, the second obtaining module is configured to obtain a difference between position coordinates of the first start node and the second start node in the first direction, and the obtaining, as the position deviation amount, includes: the second obtaining module is specifically configured to determine a first difference value according to a difference between a component of a first start node in the first direction and a component of a position coordinate of the end node in the first model in the first direction; determining a second difference value according to the difference between the component of the second starting node in the first direction and the component of the position coordinate of the tail node in the second model in the first direction; determining the position deviation amount of the first starting node and the second starting node in the first direction according to the difference between the first difference and the second difference.

Optionally, the first model and the second model are both human body models, and the motion part is a left leg and/or a right leg; the end nodes include a corresponding node for a left ankle and a corresponding node for a right ankle. The second obtaining module is configured to determine, according to a difference between a component of a first start node in the first direction and a component of a position coordinate of the end node in the first model in the first direction, a specific implementation manner of the first difference value includes: the second obtaining module is specifically configured to determine the first difference value according to a difference between the component of the first start node in the first direction and components of the end node of the left leg and the end node of the right leg of the first model in the first direction, respectively.

The second obtaining module is configured to determine, according to a difference between a component of a second start node in the first direction and a component of a position coordinate of the end node in the second model in the first direction, a specific implementation manner of the second difference value includes: the second obtaining module is configured to determine the second difference according to a difference between the component of the second start node in the first direction and the components of the end node of the left leg and the end node of the right leg of the second model in the first direction, respectively.

Optionally, the determining module is further configured to: and determining post-migration position coordinates of the moving part in the corresponding nodes of the second model except the end node according to the components of the post-migration position coordinates in the first direction and the target direction, the components of the position coordinates of the end node in the second model in the first direction, and the initial position coordinates of the nodes of the second model.

The data correction device described in this embodiment can reduce the difference between the action displayed by the virtual object driven by the second model and the action displayed by the entity, thereby improving the accuracy of the action of the virtual object.

The functions described in the method of the embodiment of the present application, if implemented in the form of software functional units and sold or used as independent products, may be stored in a storage medium readable by a computing device. Based on such understanding, part of the contribution to the prior art of the embodiments of the present application or part of the technical solution may be embodied in the form of a software product stored in a storage medium and including several instructions for causing a computing device (which may be a personal computer, a server, a mobile computing device or a network device) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other.

The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

25页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种动画处理系统、方法、装置、设备及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!