Data migration method and device, electronic device, and readable storage medium
In 3D virtual object production, the node data of the first model is migrated to a second model with the same topological relationship, and the normalization method is used to adjust the pointing vector, the problem of inaccurate actions of the virtual object is solved, and the matching of actions and entities is achieved closer.
Patent Information
- Application Number
- CN202110741541.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2041-06-30
AI Technical Summary
In the prior art, the movement of 3D virtual objects is inaccurate due to the difference in proportion to the model and the physical body, such as the phenomenon of "model penetration".
By migrating the node data in the first model to a second model with the same topological relationship, the normalization method is used to mask the difference in the node distance proportion, ensuring that the pointing vector has the path length characteristics of the second model, thereby improving the accuracy of the action.
It achieves a closer match between virtual object actions and physical actions, improves the accuracy of the actions, and reduces the phenomenon of "model penetration".
Smart Images

Figure CN113362431B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic information, and in particular to a data migration method and device, an electronic device, and a readable storage medium. Background Art
[0002] The production of 3D virtual objects (usually including people and animals) is widely used in scenes such as animation production and movie special effects. Taking 3D virtual characters as an example of 3D virtual objects, the general process of producing 3D virtual characters is: using motion capture technology to capture various actions of entities such as actors, generate data indicating these actions, and then assign the data to a specified 3D model.
[0003] In practice, the proportions of the various parts of the model used to carry data may be different from the proportions of the various parts of the actual motion capture entity. Taking 3D virtual characters as an example: the 3D model used to carry data is different from the body proportions of the actor, so the produced virtual object may have inaccurate movements, such as "piercing the model" due to the difference in body proportions between the 3D model and the actor. "Piercing the model" means that the 3D model makes some movements that do not conform to the principles of physics, such as limbs extending into the body, such as Figure 1 As shown in the circled area, the right arm of the two-dimensional virtual idol has penetrated into the body.
[0004] It can be seen that how to improve the accuracy of virtual object movements has become an urgent problem to be solved in the field of virtual object production. Summary of the invention
[0005] The present application provides a data migration method and device, an electronic device, and a readable storage medium, the purpose of which is to solve the problem of how to improve the accuracy of the actions of virtual objects.
[0006] In order to achieve the above objectives, this application provides the following technical solutions:
[0007] A data migration method for migrating data of a first model to a second model with the same topological relationship, comprising:
[0008] According to the position coordinates of the nodes in the first model, a vector pointing from the first node to the target node is obtained as a first vector; the target node is any node to be migrated in the first model, and the first node is any node in the first model except the target node;
[0009] The sum of the projection lengths of each vector of the first model on the first vector is used as the first parameter; each vector of the first model is a vector in the first node sequence, where the previous node of two adjacent nodes points to the next node; the first node sequence is a sequence of nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order in which they are passed;
[0010] The sum of the projection lengths of each vector of the second model on the first vector is used as the second parameter; each vector of the second model is a vector in which the previous node of two adjacent nodes points to the next node in the second node sequence, and the second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order of being passed; the corresponding first node is: a node representing the same topological relationship as the first node, and the corresponding target node is: a node representing the same topological relationship as the target node;
[0011] Using the first parameter, normalizing the first vector to obtain a normalized first vector;
[0012] Denormalizing the normalized first vector to the second model using the second parameter to obtain a pointing vector of the first node;
[0013] Based on the pointing displacement coordinates of at least the first node, the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node are determined. The pointing displacement coordinates of the first node are the coordinates obtained after moving the first node along the direction of the pointing vector by the length of the pointing vector.
[0014] Optionally, obtaining a vector from the first node to the target node as a first vector according to the position coordinates of the node in the first model includes:
[0015] Determine the initial displacement coordinates of the first node according to the position coordinates of the target node, where the initial displacement coordinates of the first node are coordinates obtained by moving the first node along the direction of the first vector by the length of the first vector;
[0016] The first vector is obtained according to the initial displacement coordinates of the first node and the position coordinates of the first node.
[0017] Optionally, using the first parameter to normalize the first vector to obtain a normalized first vector includes:
[0018] Obtaining a normalized first vector of the first node according to a ratio of the first vector to the first parameter;
[0019] The step of using the second parameter to denormalize the normalized first vector to the second model to obtain the pointing vector of the first node includes:
[0020] The pointing vector of the first node is obtained according to the product of the normalized first vector and the second parameter.
[0021] Optionally, determining, based on at least the pointing displacement coordinates of the first node, the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node includes:
[0022] According to the pointing displacement coordinates of other nodes except the target node, the migration position coordinates obtained after the position coordinates of the target node are migrated to the corresponding target node are determined.
[0023] Optionally, also include:
[0024] The migration rotation data of the corresponding target node is determined based on the migration position coordinates of the corresponding target node and the initial position coordinates of the node in the second model, wherein the initial position coordinates are the preset position coordinates of the node in the second model before the position coordinates of the target node are migrated to the migration position data of the corresponding target node in the second model.
[0025] Optionally, the first model and the second model are human body models;
[0026] The target node is any node in the first model to be migrated, including:
[0027] The target node is any node to be migrated except the trunk node in the first model.
[0028] A data migration device, used for migrating data of a first model to a second model with the same topological relationship, comprising:
[0029] an acquisition module, configured to acquire, according to the position coordinates of the nodes in the first model, a vector pointing from the first node to the target node as a first vector; the target node is any node to be migrated in the first model, and the first node is any node in the first model except the target node;
[0030] a first processing module, configured to use the sum of the projection lengths of each vector of the first model on the first vector as a first parameter; each vector of the first model is a vector in which the previous node of two adjacent nodes points to the next node in the first node sequence, and the first node sequence is a sequence of nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order in which they are passed;
[0031] A second processing module is used to use the sum of the projection lengths of each vector of the second model on the first vector as a second parameter; each vector of the second model is a vector in which the previous node of two adjacent nodes points to the next node in the second node sequence, and the second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order of being passed; the corresponding first node is: a node representing the same topological relationship as the first node, and the corresponding target node is: a node representing the same topological relationship as the target node;
[0032] a normalization module, configured to use the first parameter to perform normalization processing on the first vector to obtain a normalized first vector;
[0033] a denormalization module, configured to denormalize the normalized first vector to the second model using the second parameter to obtain a pointing vector of the first node;
[0034] A migration module is used to determine the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node based on the pointing displacement coordinates of at least the first node, and the pointing displacement coordinates of the first node are the coordinates obtained after moving the first node along the direction of the pointing vector by the length of the pointing vector.
[0035] Optionally, the migration module is further used to:
[0036] The migration rotation data of the target node is determined based on the migration position coordinates of the corresponding target node and the initial position coordinates of the node in the second model, wherein the initial position coordinates are the preset position coordinates of the node in the second model before the position coordinates of the target node are migrated to the migration position data of the corresponding target node in the second model.
[0037] An electronic device, comprising:
[0038] Processor and memory;
[0039] The memory is used to store programs, and the processor is used to run the programs to implement the above-mentioned data migration method.
[0040] A computer-readable storage medium stores a program, and when an electronic device runs the program, the above-mentioned data migration method is implemented.
[0041] The technical solution described in the present application is to obtain the vector of the first node pointing to the target node according to the position coordinates of the nodes in the first model, as the first vector, take the sum of the projection lengths of the vectors of the first model on the first vector as the first parameter, take the sum of the projection lengths of the vectors of the second model on the first vector as the second parameter, use the first parameter to normalize the first vector to obtain the normalized first vector, use the second parameter to denormalize the normalized first vector to the second model, obtain the pointing vector of the first node, and determine the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node according to at least the pointing displacement coordinates of the first node. It can be seen that the specificity of the length of the path composed of the first node sequence of the first model is shielded by the normalization method, and then the normalized first vector is denormalized to the second model, so that the pointing vector obtains the length characteristics of the path composed of the second node sequence. Therefore, the position coordinates of the target node determined by the pointing vector are matched with the second model, so that the action presented by the virtual object driven by the second model according to the migration position coordinates can be close to the action of the entity, that is, it has a higher accuracy. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0043] Figure 1 An example diagram of a virtual animated character "wearing a model" as an example of a virtual object;
[0044] Figure 2 An example diagram of a 3D human body model corresponding to a part of the joint points of the human body;
[0045] Figure 3 A flowchart of a data migration method disclosed in an embodiment of the present application;
[0046] Figure 4 A flowchart of another data migration method disclosed in an embodiment of the present application;
[0047] Figure 5 A schematic diagram of the structure of a data migration device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0049] During the research process, the applicant discovered that because the actions performed by the entity need to be displayed, the driving skeleton nodes (hereinafter referred to as nodes) in the specified 3D model usually have the same topological relationship with the joint points in the entity, that is, the driving skeleton nodes in the specified 3D model correspond one-to-one to all or part of the joint points in the entity.
[0050] However, the ratio of node distances in a specified 3D model is not necessarily the same as the ratio of the lengths of the corresponding joint points in the entity. Therefore, the actions displayed by the specified 3D model may deviate greatly from the actions performed by the entity.
[0051] Therefore, the applicant proposes that:
[0052] In order to improve the accuracy of the virtual object's movements, a 3D model that matches the entity can be constructed first, hereinafter referred to as the first model. The captured data is assigned to the first model to obtain the data of the nodes in the first model (position coordinates and rotation data), and then the data of the nodes in the first model are migrated to the specified 3D model, hereinafter referred to as the second model, and the virtual object is driven by the second model.
[0053] In the following embodiments, a technical solution is proposed for migrating data of nodes in a first model to nodes in a second model, with the aim of shielding the difference in the distance ratio between nodes in the first model and the second model, so that the actions displayed by the second model according to the migrated data are closer to the actions of the entity, that is, the actions of the virtual objects are more accurate.
[0054] Here are some definitions and explanations:
[0055] Topological relationships refer to the types of nodes and the connections between them. The type of node is the type of joint point in the corresponding entity, for example Figure 2 It is understood that Figure 2 Shown are nodes corresponding to joints of a portion of the human body.
[0056] The first model and the second model are both 3D models, wherein the node data included therein include position coordinates and rotation data. The definition of rotation data can refer to the prior art.
[0057] The ratio of node distances refers to 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, that is, S1 / S2. The distance can be calculated from the position coordinates of the nodes. Figure 2 For example, using the position coordinates of Hips and LeftHips Hips, we get the distance S1 between Hips and LeftHips. Using the position coordinates of Hips and RightHips, we get the distance S2 between Hips and RightHips. Dividing S1 by S2, we get the ratio of the node distances.
[0058] The ratio of the joint lengths in an entity refers to the ratio of the bone lengths between the joints. For example, the bone length between joint 1 and joint 2 is S3, and the bone length between joint 3 and joint 4 is S4. S3 / S4 is a joint length ratio.
[0059] The first model and the entity are adapted to each other by: the nodes in the first model correspond one-to-one with the joint points in the entity, and the ratio of the node distances in the first model is the same as the ratio of the lengths of the corresponding joint points in the entity, for example, Figure 2 The ratio of the distance between Hips and LeftHips divided by the distance between Hips and RightHips is equal to the ratio of the bone length between Hips and LeftHips in the human body divided by the bone length between Hips and RightHips in the human body.
[0060] The correspondence between the nodes in the model and the joint points in the entity means that if the data assigned to a node in the model is the data collected from the displacement or rotation of a joint point in the entity, then the node corresponds to the joint point.
[0061] Based on the above content, it can be known that the first model and the second model have the same topological relationship, and the nodes in the first model correspond one-to-one with the nodes in the second model, that is, the nodes in the first model have unique corresponding nodes in the second model.
[0062] Figure 2The present invention is an example of a human 3D model used in an embodiment of the present application, Hips represents the hip node, Spine1 represents the first (closed) node of the spine, Spine2 represents the second (closed) node of the spine, Neck represents the neck (closed) node, Head represents the head (closed) node, LeftShoulder represents the left shoulder (closed) node, RightShoulder represents the right shoulder (closed) node, LeftElbow represents the left elbow (closed) node, RightElbow represents the right elbow (closed) node, LeftWrist represents the left wrist (closed) node, RightWrist represents the right wrist (closed) node, LeftHips represents the left hip (closed) node, RightHips represents the right hip (closed) node, LeftKnee represents the left knee (closed) node, RightKnee represents the right-left knee (closed) node, LeftAnkle represents the left ankle (closed) node, and RightAnkle represents the right ankle (closed) node.
[0063] In the following embodiments, any node to be migrated in the first model is referred to as a target node, and the corresponding node of the target node in the second model is referred to as a corresponding target node. The topological relationship represented by any node (such as the target node) in the first model is the same as the topological relationship represented by the corresponding node (such as the corresponding target node) in the second model, that is, the corresponding node of any node is a node representing the same relationship in the topological relationship.
[0064] For example, Figure 2 As shown, the target node is LeftWrist in the first model, and LeftWrist in the second model is the corresponding target node. The topological relationship of LeftWrist in the first model is connected to LeftElbow, and the topological relationship of LeftWrist in the second model is also connected to LeftElbow.
[0065] The data migration process proposed in the embodiment of the present application will be described in detail below.
[0066] Figure 3 The process of a data migration method disclosed in an embodiment of the present application includes the following steps:
[0067] S31. According to the position coordinates of the nodes in the first model, obtain a vector from the first node to the target node as a first vector.
[0068] The target node is any node in the first model to which data is to be migrated, and the first node is any node in the first model except the target node.
[0069] One implementation of S31 is to determine the first vector by taking the direction from the first node to the target node as the direction of the first vector and taking the distance between the first node and the target node as the length of the first vector. The distance between the first node and the target node is determined by the position coordinates of the first node and the target node.
[0070] In addition to the above implementation, the embodiment of the present application also proposes another implementation with higher accuracy, which will be described in detail in the following embodiments.
[0071] S32. Taking the sum of the projection lengths of the vectors of the first model on the first vector as the first parameter.
[0072] Each first model vector is a vector in the first node sequence, where the previous node of two adjacent nodes points to the next node. The first node sequence is a sequence of nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order in which they are passed.
[0073] The length of the vector from the previous node to the next node is obtained by the difference between the position coordinates of the previous node and the next node, and the direction is the direction from the previous node to the next node.
[0074] It can be seen that the first parameter represents the length component of the path formed by the nodes in the first node sequence in the direction of the first vector.
[0075] S33. Taking the sum of the projection lengths of each vector of the second model on the first vector as the second parameter.
[0076] Each vector of the second model is a vector from the previous node of two adjacent nodes to the next node in the second node sequence. The second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order in which they are passed.
[0077] S34. Normalize the first vector according to the first parameter to obtain a normalized first vector.
[0078] Because the first parameter represents the length component of the path formed by the nodes in the first node sequence in the direction of the first vector, the normalized first vector obtained by using the first parameter can be regarded as a vector that eliminates the specificity of the length. That is, in the path formed by the first node sequence in the first model, the influence of the distance between the nodes on the normalized first vector has been eliminated.
[0079] S35. Denormalize the normalized first vector to the second model using the second parameter to obtain the pointing vector of the first node.
[0080] The second parameter represents the length component of the path formed by the nodes in the second node sequence in the direction of the first vector, so the normalized first vector multiplied by the second parameter can be regarded as mapping the normalized first vector to the second model. That is, the pointing vector has the distance characteristics between the nodes in the path formed by the second node sequence.
[0081] S36. Determine, based on the pointing displacement coordinates of at least the first node, the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node.
[0082] It can be seen from the above process that in this embodiment, a normalization method is used to mask the specificity of the length of the path composed of the first node sequence of the first model, and then the normalized first vector is mapped to the second model, so that the pointing vector obtains the length characteristics of the path composed of the second node sequence. Therefore, the position coordinates of the target node determined by the pointing vector are matched with the second model, so that the action presented by the virtual object driven by the second model according to the position coordinates can be close to the action of the entity, that is, it has higher accuracy.
[0083] The following is an example of applying the above embodiment to Figure 2 The process of the human body 3D model shown includes the following steps:
[0084] 1. According to the position coordinates of the nodes in the first model, obtain the vector from the first node to the target node as the first vector.
[0085] As mentioned above, the target node is any node in the first model to be migrated. In this step and the following embodiments, the example of the target node is LeftWrist. The first node is any node other than the target node. In this step and the following embodiments, the example of the first node is Hips.
[0086] 2. The sum of the projection lengths of the vectors of the first model on the first vector is taken as the first parameter.
[0087] Each vector of the first model is a vector from the previous node of two adjacent nodes to the next node in the first node sequence. The first node sequence is a sequence of nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order in which they are passed.
[0088] The length of the vector from the previous node to the next node is obtained by the difference between the position coordinates of the previous node and the next node, and the direction is the direction from the previous node to the next node.
[0089] by Figure 2For example, in the process of moving from Hips in the first model to LeftWrist, the nodes passed in sequence are: Hips->Spine1->Spine2->LeftShoulder->LeftElbow->LeftWrist. Therefore, the first node sequence is (Hips, Spine1, Spine2, LeftShoulder, LeftElbow, LeftWrist).
[0090] The first model vectors are:
[0091]
[0092]
[0093]
[0094]
[0095]
[0096] In the above formulas, P represents the position coordinates, and src represents the first model.
[0097] Any first model vector The length of the projection onto the first vector is expressed as:
[0098] In formula (1) represents the unit vector of the first vector, express is the unit vector, so Indicates v i and The cosine value of the angle between express In v i The projection length on .
[0099] The first parameter of the i-th node is Taking the first node sequence mentioned above as an example, m=5.
[0100] It can be seen from the calculation formula of the first parameter that the first parameter represents the length component of the path formed by the nodes in the first node sequence in the first vector direction.
[0101] 3. The sum of the projection lengths of each vector of the second model on the first vector is taken as the second parameter.
[0102] Each vector of the second model is a vector from the previous node of two adjacent nodes to the next node in the second node sequence. The second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order in which they are passed.
[0103] According to the above definition of corresponding nodes, an example of a second node sequence corresponding to an example of a first node sequence in the first model is the following sequence of nodes in the second model:
[0104] (Hips,Spine1,Spine2,LeftShoulder,LeftElbow,LeftWrist).
[0105] The second model vectors are:
[0106]
[0107]
[0108]
[0109]
[0110]
[0111] In the above formulas, P represents the position coordinates, and tar represents the second model.
[0112] The second parameter is It can be seen from the calculation formula of the second parameter that the second parameter represents the length component of the path formed by the nodes in the second node sequence in the direction of the first vector.
[0113] 4. Use the first parameter to normalize the first vector to obtain a normalized first vector.
[0114] 5. Use the second parameter to denormalize the normalized first vector to the second model to obtain the pointing vector of the first node.
[0115] In this step, an example of mapping operation is multiplication, that is, the pointing vector of the first node is:
[0116] The second parameter represents the length component of the path formed by the nodes in the second node sequence in the direction of the first vector, so the normalized first vector multiplied by the second parameter can be regarded as mapping the normalized first vector to the second model. That is, the pointing vector has the distance characteristics between the nodes in the path formed by the second node sequence.
[0117] 6. Determine, at least based on the pointing displacement coordinates of the first node, the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node.
[0118] The pointing displacement coordinates of the first node are the coordinates obtained by moving the first node along the direction of the pointing vector by the length of the pointing vector, that is,
[0119] It can be seen from the above process that in this embodiment, the data in the first model is normalized to remove the influence of human body proportions, and then the data is allocated to the second model, and the body proportions of the second model are taken into consideration when allocating the data to the second model. Therefore, the movements of the virtual character driven by the second model can be closer to the movements of the entity, thereby having higher accuracy.
[0120] Figure 4 The present invention discloses a method for migrating motion data. Figure 3 The main difference compared to the process shown is that the steps that can further improve the accuracy and save resources are limited or added.
[0121] Figure 4 The following steps are included:
[0122] S41, collecting data of nodes of the first model.
[0123] As mentioned above, the motion capture technology can be used to collect data of each joint point of the entity during the movement, and the collected data can be assigned to the nodes in the first model. The data of any node in the first model includes the position coordinates and rotation data of the node.
[0124] It can be understood that if the motion data is collected continuously, multiple frames of data can be formed. In this embodiment, any frame of motion data of the first model is recorded as:
[0125] Rotate data:
[0126]
[0127] Among them, src represents the first model, Hips represents the hip node, Spine1 represents the first node of the spine, Spine2 represents the second node of the spine, Neck represents the neck (off) node, Head represents the head (off) node, LeftShoulder represents the left shoulder (off) node, RightShoulder represents the right shoulder (off) node, LeftElbow represents the left elbow (off) node, RightElbow represents the right elbow (off) node, LeftWrist represents the left wrist (off) node, RightWrist represents the right wrist (off) node, LeftHips represents the left hip (off) node, RightHips represents the right hip (off) node, LeftKnee represents the left knee (off) node, RightKnee represents the right left knee (off) node, LeftAnkle represents the left ankle (off) node, and RightAnkle represents the right ankle (off) node.
[0128] Location coordinates:
[0129]
[0130] S42. Using the position coordinates of the trunk node in the first model as the migration position coordinates of the corresponding node in the second model.
[0131] The trunk node refers to a node located in the trunk part. That is, for the nodes on the trunk in the human body 3D model, the position coordinates assigned to the nodes in the first model by motion capture technology can be directly used as the position coordinates of the corresponding nodes in the second model without the need to migrate through the steps described in the above embodiment.
[0132] Because the trunk nodes of the human body do not participate in the movement or their contribution to the movement is limited, the position coordinates of the trunk nodes have little effect on the accuracy of the movement. Therefore, directly using the position coordinates of the trunk nodes of the first model as the migration position coordinates of the corresponding nodes in the second model can save computing power and reduce latency without significantly reducing the accuracy of the virtual object's movement.
[0133] S43. Determine the directional vectors of all nodes in the first model except the trunk node and the target node.
[0134] In this step, the target node is defined as any node except the trunk node, that is, the directional vectors of all nodes except the trunk node and the target node are obtained. In this embodiment, the target node is also taken as LeftWrist as an example.
[0135] Taking any node called the first node among other nodes except the trunk node and the target node as an example, the difference between this embodiment and the above embodiment in obtaining the pointing vector is: the way of obtaining the first vector.
[0136] In this step, the first vector is obtained using the following method:
[0137] A first vector is obtained according to the position coordinates of the target node, the position coordinates of other nodes in the first model except the trunk node and the target node, and the conversion relationship.
[0138] The conversion relationship includes: the position coordinates of the target node are determined according to the initial displacement coordinates of other nodes, and the initial displacement coordinates of the first node are the coordinates obtained by moving the first node along the direction of the first vector by the length of the first vector.
[0139] Specifically, the conversion relationship can be expressed as:
[0140] Among them, P i src It is the position coordinate of any node except the trunk node and LeftWrist node. i is the vector pointing to LeftWrist from any node except the trunk node and LeftWrist node. It can be understood that v i That is, the first vector from the first node to the target node.
[0141] λ i is a preset weight parameter, which can be set in advance. It can be understood that λ i It is an optional parameter and can be left unset to directly calculate the mean.
[0142] v i +P i src The meaning is: the position coordinate P i src Along vector v i In order to distinguish the displacement coordinates from the displacement coordinates in the above embodiment, the position coordinates obtained after the displacement are referred to as initial displacement coordinates.
[0143] Therefore, it can be understood that the meaning of formula (2) is: the position coordinate of LeftWrist is the weighted sum of the initial displacement coordinates of each node except the trunk node and the LeftWrist node.
[0144] because P i src and λ i So substituting into formula (2) we can get vi .
[0145] That is to say, the above process can also be expressed as: according to the position coordinates of the target node, the initial displacement coordinates of the first node are determined, and the initial displacement coordinates of the first node are the coordinates obtained by moving the first node along the direction of the first vector by the length of the first vector. According to the initial displacement coordinates of the first node and the position coordinates of the first node, the first vector is obtained.
[0146] In getting v i Afterwards, the method for obtaining the first parameter, the second parameter and the pointing vector of other nodes except the trunk node and the target node can refer to the method for obtaining the pointing vector of the first node mentioned above, which will not be repeated here.
[0147] The method of obtaining the first vector described in this step determines the first vector by using multiple nodes, and therefore has higher accuracy than the method of determining the first vector using the position coordinates of the target node and the first node.
[0148] S44. Determine the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node based on the directional displacement coordinates of other nodes except the trunk node and the target node.
[0149] Specifically, the migration position coordinates of the LeftWrist node in the second model are: in, is the directional displacement coordinate of the first node. i is the weighting coefficient, which is an optional parameter.
[0150] Compared with the above embodiment in which only the first node is used to determine the migration position coordinates of the target node, the method of using multiple nodes to determine the migration position of the target node can obtain more accurate results.
[0151] Because the target node is any node except the trunk node, the above processing is performed on the nodes except the trunk node in sequence to obtain the migration position coordinates of all other nodes except the trunk node.
[0152] S45 , determining the migration rotation data of the nodes in the second model according to the migration position coordinates of the corresponding target node and the initial position coordinates of the nodes in the second model.
[0153] The initial position coordinates can be set when constructing the second model and are known data for this step.
[0154] Specifically, the IK algorithm may be used to determine the migration rotation data based on the migration position coordinates and the initial position coordinates. The specific implementation of the IK algorithm may refer to the prior art and will not be described in detail here.
[0155] It can be understood that the method of determining the migration rotation data using the post-migration position coordinates and the initial position coordinates is easier to implement than the method of determining the migration position coordinates, so it can also save computing power and time resources.
[0156] Figure 4 The process shown has the following beneficial effects:
[0157] 1. Use the relationship between the vector and position data between each node in the human 3D skeleton model to determine the vector between each node, which can be closer to the actual topological relationship between the nodes.
[0158] 2. Length is the reason for the "penetration" of the isomorphic model. In this embodiment, the first parameter and the second parameter are determined based on the length vector, respectively. Therefore, the inaccurate movement of the virtual object driven by the second model, such as the "penetration" problem, can be fundamentally solved.
[0159] 3. Determine the migration rotation data based on the migration position coordinates, and use the pre-migration position coordinates of the trunk node directly as the migration position coordinates, which can save resources while obtaining migration data that meets accuracy requirements.
[0160] Figure 5 A data migration device disclosed in an embodiment of the present application includes: an acquisition module, a first processing module, a second processing module, a normalization module, a denormalization module and a migration module.
[0161] The acquisition module is used to obtain a vector pointing from the first node to the target node as a first vector based on the position coordinates of the nodes in the first model; the target node is any node in the first model to which data is to be migrated, and the first node is any node in the first model except the target node.
[0162] The first processing module is used to use the sum of the projection lengths of each vector of the first model on the first vector as the first parameter; each vector of the first model is a vector in the first node sequence, in which the previous node of two adjacent nodes points to the next node, and the first node sequence is a sequence composed of the nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order passed.
[0163] The second processing module is used to take the sum of the projection lengths of each vector of the second model on the first vector as the second parameter; each vector of the second model is a vector in which the previous node of two adjacent nodes points to the next node in the second node sequence, and the second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order passed; the corresponding first node is: a node representing the same topological relationship as the first node, and the corresponding target node is: a node representing the same topological relationship as the target node. The normalization module is used to use the first parameter to normalize the first vector to obtain a normalized first vector. The denormalization module is used to use the second parameter to denormalize the normalized first vector to the second model to obtain the pointing vector of the first node.
[0164] The migration module is used to determine the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node based on the pointing displacement coordinates of at least the first node. The pointing displacement coordinates of the first node are the coordinates obtained after moving the first node along the direction of the pointing vector by the length of the pointing vector.
[0165] Optionally, the migration module is also used to determine the migration rotation data of the target node based on the migration position coordinates of the corresponding target node and the initial position coordinates of the node in the second model, wherein the initial position coordinates are the preset position coordinates of the node in the second model before the position coordinates of the target node are migrated to the migration position data of the corresponding target node in the second model.
[0166] Optionally, the acquisition module is used to acquire, according to the position coordinates of the nodes in the first model, a vector from the first node to the target node as the first vector, including:
[0167] The acquisition module is specifically used to determine the initial displacement coordinates of the first node based on the position coordinates of the target node, where the initial displacement coordinates of the first node are the coordinates obtained by moving the first node along the direction of the first vector by the length of the first vector; and to acquire the first vector based on the initial displacement coordinates of the first node and the position coordinates of the first node.
[0168] Optionally, the normalization module is used to use the first parameter to normalize the first vector to obtain a normalized first vector, including: the normalization module is specifically used to obtain a normalized first vector of the first node based on a ratio of the first vector to the first parameter.
[0169] Optionally, the denormalization module is used to use the second parameter to denormalize the normalized first vector to the second model to obtain the pointing vector of the first node, including: the denormalization module is specifically used to obtain the pointing vector of the first node based on the product of the normalized first vector and the second parameter.
[0170] Optionally, the migration module is used to determine the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node according to the pointing displacement coordinates of at least the first node, including:
[0171] The migration module is specifically used to determine the migration position coordinates obtained after the position coordinates of the target node are migrated to the corresponding target node according to the pointing displacement coordinates of other nodes except the target node.
[0172] Optionally, the first model and the second model are human models. The target node is any node in the first model to be migrated, including: the target node is any node in the first model to be migrated except the torso node.
[0173] The device described in this embodiment is used to migrate data of a first model to a second model with the same topological relationship, so that the movement accuracy of a virtual object driven by the second model that obtains the migrated data is higher.
[0174] An embodiment of the present application further discloses an electronic device, including: a processor and a memory, wherein the memory is used to store a program, and the processor is used to run the program to implement the data migration method described in the above embodiment.
[0175] The embodiment of the present application further discloses a computer-readable storage medium on which a program is stored, characterized in that when the electronic device runs the program, the data migration method described in the above embodiment is implemented.
[0176] If the functions described in the method of the embodiment of the present application are implemented in the form of software functional units and sold or used as independent products, they can be stored in a storage medium readable by a computing device. Based on this understanding, the part of the embodiment of the present application that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions to enable a computing device (which can be a personal computer, server, mobile computing device or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0177] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0178] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data migration method for migrating data from a first model to a second model with the same topological relationship, characterized in that: include: According to the position coordinates of the nodes in the first model, obtaining a vector from the first node to the target node as a first vector; The target node is any node in the first model to which data is to be migrated, and the first node is any node in the first model except the target node; The sum of the projection lengths of each vector of the first model on the first vector is used as the first parameter; each vector of the first model is a vector in the first node sequence, where the previous node of two adjacent nodes points to the next node; the first node sequence is a sequence of nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order in which they are passed; The sum of the projection lengths of each vector of the second model on the first vector is used as the second parameter; each vector of the second model is a vector in which the previous node of two adjacent nodes points to the next node in the second node sequence, and the second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order of being passed; the corresponding first node is: a node representing the same topological relationship as the first node, and the corresponding target node is: a node representing the same topological relationship as the target node; Using the first parameter, normalizing the first vector to obtain a normalized first vector; Denormalizing the normalized first vector to the second model using the second parameter to obtain a pointing vector of the first node; Based on the pointing displacement coordinates of at least the first node, the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node are determined. The pointing displacement coordinates of the first node are the coordinates obtained after moving the first node along the direction of the pointing vector by the length of the pointing vector.
2. The method according to claim 1, characterized in that According to the position coordinates of the nodes in the first model, obtaining a vector from the first node to the target node as a first vector includes: Determine the initial displacement coordinates of the first node according to the position coordinates of the target node, where the initial displacement coordinates of the first node are coordinates obtained by moving the first node along the direction of the first vector by the length of the first vector; The first vector is obtained according to the initial displacement coordinates of the first node and the position coordinates of the first node.
3. The method according to claim 1, characterized in that: The using the first parameter to normalize the first vector to obtain a normalized first vector includes: Obtaining a normalized first vector of the first node according to a ratio of the first vector to the first parameter; The step of using the second parameter to denormalize the normalized first vector to the second model to obtain the pointing vector of the first node includes: The pointing vector of the first node is obtained according to the product of the normalized first vector and the second parameter.
4. The method according to claim 1, characterized in that: The determining, based on at least the pointing displacement coordinates of the first node, the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node includes: According to the pointing displacement coordinates of other nodes except the target node, the migration position coordinates obtained after the position coordinates of the target node are migrated to the corresponding target node are determined.
5. The method according to any one of claims 1 to 4, characterized in that: Also includes: The migration rotation data of the corresponding target node is determined based on the migration position coordinates of the corresponding target node and the initial position coordinates of the node in the second model, wherein the initial position coordinates are the preset position coordinates of the node in the second model before the position coordinates of the target node are migrated to the migration position data of the corresponding target node in the second model.
6. The method according to any one of claims 1 to 4, characterized in that: The first model and the second model are human models; The target node is any node in the first model to be migrated, including: The target node is any node to be migrated except the trunk node in the first model.
7. A data migration device, used to migrate data of a first model to a second model with the same topological relationship, characterized in that: include: An acquisition module, used for acquiring a vector from the first node to the target node according to the position coordinates of the nodes in the first model as a first vector; The target node is any node in the first model to which data is to be migrated, and the first node is any node in the first model except the target node; a first processing module, configured to use the sum of the projection lengths of each vector of the first model on the first vector as a first parameter; each vector of the first model is a vector in which the previous node of two adjacent nodes points to the next node in the first node sequence, and the first node sequence is a sequence of nodes passed in sequence in the process of moving from the first node to the target node on the first model in the order in which they are passed; A second processing module is used to use the sum of the projection lengths of each vector of the second model on the first vector as a second parameter; each vector of the second model is a vector in which the previous node of two adjacent nodes points to the next node in the second node sequence, and the second node sequence is a sequence of nodes passed in sequence in the process of moving from the corresponding first node to the corresponding target node on the second model in the order of being passed; the corresponding first node is: a node representing the same topological relationship as the first node, and the corresponding target node is: a node representing the same topological relationship as the target node; a normalization module, configured to use the first parameter to perform normalization processing on the first vector to obtain a normalized first vector; a denormalization module, configured to denormalize the normalized first vector to the second model using the second parameter to obtain a pointing vector of the first node; A migration module is used to determine the migration position coordinates obtained after migrating the position coordinates of the target node to the corresponding target node based on the pointing displacement coordinates of at least the first node, and the pointing displacement coordinates of the first node are the coordinates obtained after moving the first node along the direction of the pointing vector by the length of the pointing vector.
8. The device according to claim 7, characterized in that The migration module is also used to: The migration rotation data of the target node is determined based on the migration position coordinates of the corresponding target node and the initial position coordinates of the node in the second model, wherein the initial position coordinates are the preset position coordinates of the node in the second model before the position coordinates of the target node are migrated to the migration position data of the corresponding target node in the second model.
9. An electronic device, characterized in that: include: Processor and memory; The memory is used to store a program, and the processor is used to run the program to implement the data migration method described in any one of claims 1 to 6.
10. A computer-readable storage medium having a program stored thereon, characterized in that: When the electronic device runs the program, the data migration method described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Generation method of human body action editing model, storage medium and electronic device
CN110533752A
Model migration method and electronic equipment
CN110852449A