Method and device for automatically matching standard bone animation data to different character models
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHIYOU (BEIJING) TECH CO LTD
- Filing Date
- 2023-03-30
- Publication Date
- 2026-08-07
AI Technical Summary
[0008]本发明实施例提供了一种标准骨骼动画数据自动匹配不同角色模型的方法及装置,以至少解决由于标准骨骼动画数据匹配不同角色模型时匹配不准确导致的角色动作不自然的技术问题
[0054] 1) Automatic matching of skeletal animation data for different character models. Since the skeletal structure and number of bones may differ between character models, it is necessary to map and rename the skeleton in order to apply standard skeletal animation data to different character models. This embodiment can automatically perform skeleton mapping and coordinate system transformation, thereby achieving automatic matching of skeletal animation data for different character models.
Smart Images

Figure CN116342768B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and more specifically, to a method and apparatus for automatically matching standard skeletal animation data with different character models. Background Technology
[0002] There are various existing technologies for applying the skeletal animation data of one character to different character models, including statistical methods and shape matching methods.
[0003] Statistical animation matching techniques typically require a large amount of animation sample data. This involves statistically analyzing the skeletal rotation of each keyframe to obtain a statistical model that can adapt to different character models. When applying the animation to a new character model, the statistical model can be used for animation matching to automatically adjust the skeletal rotation angles.
[0004] However, statistical methods typically require a large amount of animation sample data to statistically analyze the skeletal rotation of each animation keyframe, which demands significant time and resources. Furthermore, when applied to new character models, because statistical models are based on existing data, they may lack sufficient adaptability, leading to unsatisfactory matching results.
[0005] Shape-matching-based animation matching technology analyzes the skeletal structure and shape features of a character model to calculate the shape changes of each bone at different angles. When an animation needs to be applied to a new character model, shape-matching algorithms can be used to automatically adjust the bone rotation angles.
[0006] However, shape matching methods require analysis and calculation of the skeletal structure and shape features of the character model, which necessitates certain computational resources. Furthermore, when applied to new character models, differences in skeletal connection methods, bone sizes, and other factors may lead to inaccurate matching.
[0007] There is currently no effective solution to the aforementioned technical problem of inaccurate matching. Summary of the Invention
[0008] This invention provides a method and apparatus for automatically matching standard skeletal animation data with different character models, in order to at least solve the technical problem of unnatural character movements caused by inaccurate matching of standard skeletal animation data with different character models.
[0009] According to one aspect of the present invention, a method for automatically matching standard skeletal animation data with different character models is provided, comprising: establishing the skeleton of the character model and mapping the skeleton of the character model onto the skeletal structure of the standard skeletal animation data; adding a controller to the skeleton of the character model and using the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model; and driving the character model based on the pose or joint angle of the character model to generate redirected animation data.
[0010] According to another aspect of the present invention, an apparatus for automatically matching standard skeletal animation data with different character models is also provided, comprising: a mapping module configured to establish the skeleton of the character model and map the skeleton of the character model onto the skeletal structure of the standard skeletal animation data; a calculation module configured to add a controller to the skeleton of the character model and use the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model; and a matching module configured to drive the character model based on the pose or joint angle of the character model to generate redirected animation data.
[0011] In this embodiment of the invention, the controller is used to automatically perform inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model; the character model is driven based on the pose or joint angle of the character model to generate redirected animation data, which solves the technical problem of unnatural character movements caused by inaccurate matching of standard skeletal animation data with different character models, and has the beneficial effect of generating realistic animation movements. Attached Figure Description
[0012] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:
[0013] Figure 1 This is a flowchart of a method for automatically matching standard skeletal animation data with different character models, as disclosed in an embodiment of this application.
[0014] Figure 2 This is a flowchart of another method for automatically matching standard skeletal animation data with different character models disclosed in the embodiments of this application;
[0015] Figure 3 This is a flowchart of another method for automatically matching standard skeletal animation data with different character models disclosed in the embodiments of this application;
[0016] Figure 4 This is a flowchart of a method for mapping the skeleton of a character model onto the skeletal structure of standard skeletal animation data, as disclosed in an embodiment of this application.
[0017] Figure 5 This is a flowchart of a method for adding a controller to the skeleton of a character model, as disclosed in an embodiment of this application.
[0018] Figure 6 This is a flowchart of a method for automatically inverse kinematics calculation of standard pose data of standard skeletal animation data using the controller, as disclosed in an embodiment of this application.
[0019] Figure 7 This is a flowchart of the method for calculating errors disclosed in the embodiments of this application;
[0020] Figure 8 This is a schematic diagram of the structure of a device for automatically matching standard skeletal animation data with different character models, as disclosed in an embodiment of this application;
[0021] Figure 9 This is a schematic diagram of the structure of an electronic device disclosed in an embodiment of this application. Detailed Implementation
[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0023] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0024] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values of the components and steps described in these embodiments do not limit the scope of this application. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following drawings denote similar items; therefore, once an item is defined in one drawing, it need not be further discussed in subsequent drawings.
[0025] Example 1
[0026] This application provides a method for automatically matching standard skeletal animation data with different character models, such as... Figure 1 As shown, the method includes:
[0027] Step S102: Establish the skeleton of the character model and map the skeleton of the character model onto the bone structure of the standard skeletal animation data.
[0028] First, based on the shape and movement characteristics of the character model, the hierarchical structure, number, and position of the bones in the character model's skeleton are determined to establish the character model's skeleton. Next, based on coordinate system transformation, the character model's skeleton is mapped onto the skeletal structure of standard skeletal animation data. This step achieves matching between the character model and the standard skeletal animation data, ensuring that subsequent steps are performed based on the same skeletal structure.
[0029] Step S104: Add a controller to the skeleton of the character model, and use the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model.
[0030] A controller is added to the skeleton of the character model. The controller is a set of control points or key points used to control the posture or joint angle of the character model. Based on the position of the end effector, the controller performs automatic inverse kinematics calculation on the standard posture data of the standard skeletal animation data to calculate the joint angle or posture of each joint of the character model so that the end effector of the character model can reach the specified position.
[0031] For example, based on the skeleton of the character model, the position and pose of the end effector of the skeleton of the character model are calculated; the position and pose of the end effector of the skeleton of the character model are compared with the position and pose of the end effector of the standard skeletal animation data, and the angle or pose of each joint of the skeleton of the character model is calculated by least squares method.
[0032] Specifically, firstly, the position and pose of the end effector of the standard skeletal animation data are transformed into the coordinate system of the character model.
[0033] Then, the error between the position and pose of the end effectors of the character model's skeleton and the position and pose of the end effectors in the converted standard skeletal animation data is calculated. For example, for each joint of the character model's skeleton, a weighted average of the corresponding joint pose or angle in the standard skeletal animation data is calculated, wherein the weighted average is assigned according to its position in the skeleton hierarchy, with joints closer to the root having a larger weight; for each joint of the character model's skeleton, the position and pose of the end effectors of the character model's skeleton are calculated based on the corresponding weighted average; for each joint of the character model's skeleton, the error between the position and pose of the end effectors of the character model's skeleton and the position and pose of the end effectors in the converted standard skeletal animation data is calculated using Euclidean distance or angle difference.
[0034] Finally, using the least squares method, the angle or pose of each joint of the character model that minimizes the error is calculated to match the end effector position and pose of the standard skeletal animation data.
[0035] This application uses inverse kinematics (IK) technology to control the pose or joint angles of a character model. By adding controllers to the skeleton of the character model, a more intuitive way to control the character's movements can be provided without manually adjusting the angle of each joint.
[0036] Furthermore, by using automatic inverse kinematics calculation, the joint angles or poses of each joint can be automatically calculated based on the controller's position, ensuring that the end effector of the character model reaches the designated position. This makes the character model's movements more natural and reduces the time and workload of animation production.
[0037] Furthermore, by using controllers to control the pose or joint angles of character models, their movements can be made more interactive. For example, in games, players can use controllers to control the movements of character models, making the game more interactive and fun.
[0038] In summary, using controllers and automatic inverse kinematics calculations can improve the efficiency and interactivity of character model animation, making character movements more natural and fluid.
[0039] Step S106: Drive the character model based on its pose or joint angle to generate redirected animation data.
[0040] First, using the character model's pose or joint angles as input, smooth animation data is generated through interpolation. For example, for each joint of the character model's skeleton, the transition value of the character model's pose or joint angle between adjacent frames is calculated using linear interpolation; a smoothing function is then applied between these transition values to generate smooth animation data. Finally, the generated animation data is applied to the character model to generate redirected animation data.
[0041] The embodiments of this application solve the technical problem of unnatural character movements caused by inaccurate matching of standard skeletal animation data with different character models, and have the beneficial effect of generating more realistic animations.
[0042] Example 2
[0043] This application provides another method for automatically matching standard skeletal animation data to different character models, such as... Figure 2 As shown, the method includes:
[0044] Step S202: Perform skeleton mapping.
[0045] First, the skeleton of the character model needs to be created. The skeleton is a hierarchical structure composed of a series of skeletal nodes, each containing information about its position, rotation, and scaling. When creating the skeleton, the hierarchical structure, number of bones, and their positions must be designed based on the character model's shape and movement characteristics. Typically, the positions of the skeletal nodes should correspond to the joint positions of the character model.
[0046] Next, the character model's skeleton needs to be mapped onto the skeletal structure of the standard skeletal animation data. Standard skeletal animation data is a generic skeleton structure typically used to share animation data between different character models. To map the character model's skeleton onto the standard skeletal animation data's skeletal structure, certain coordinate system transformations and renaming of bone nodes are required. This ensures the character model's skeleton matches the standard skeletal animation data's skeletal structure, preparing for subsequent animation data redirection.
[0047] Step S204: Perform automatic inverse kinematics calculation based on the standard pose data of standard skeletal animation data to obtain the pose or joint angle of the character model.
[0048] First, controllers need to be added to the character model's skeleton. Controllers can be a set of control points or keypoints used to control the character model's pose or joint angles. The number and position of these controllers should be sufficient to capture the key poses and movements of standard skeletal animation data.
[0049] Next, through automatic inverse kinematics calculation, using standard pose data from the controller and standard skeletal animation data, the pose or joint angles of the character model are obtained. Inverse kinematics calculation calculates the angle of each joint based on the position of the end effectors (such as hands or feet) so that they can reach the specified position.
[0050] In this embodiment, after the skeleton mapping is completed, a controller is added to the skeleton of the character model to automatically perform inverse kinematics calculation on the standard pose data of the standard skeletal animation data, thereby obtaining the pose or joint angles of the character model. This allows the character model's pose or joint angles to be obtained.
[0051] Step S206: Drive the character model based on the pose or joint angle of the character model.
[0052] A controller is added to the skeleton of the character model, and the controller is used to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model.
[0053] The embodiments of this application have the following beneficial effects:
[0054] 1) Automatic matching of skeletal animation data for different character models. Since the skeletal structure and number of bones may differ between character models, it is necessary to map and rename the skeleton in order to apply standard skeletal animation data to different character models. This embodiment can automatically perform skeleton mapping and coordinate system transformation, thereby achieving automatic matching of skeletal animation data for different character models.
[0055] 2) Improve the efficiency of character model animation production. By adding controllers and automatic inverse kinematics calculation, the pose or joint angles of character models can be obtained quickly, thus avoiding the time and effort costs of manually creating animations. This can help animators produce high-quality animations faster and improve animation production efficiency.
[0056] 3) Improve animation quality and smoothness. Because automatic inverse kinematics calculation can accurately calculate the angle of each joint, enabling it to reach the specified position, more accurate and smoother animation effects can be obtained.
[0057] 4) Supports animation reuse and sharing. Standard skeletal animation data can be shared among different character models, thereby enabling animation reuse and sharing. Through the embodiments of this application, different character models can be mapped onto the skeletal structure of standard skeletal animation data, and animation reuse and sharing can be achieved using controllers and inverse kinematics calculations.
[0058] Example 3
[0059] This application provides yet another method for automatically matching standard skeletal animation data to different character models, such as... Figure 3 As shown, the method includes:
[0060] Step S302: Map the skeleton of the character model onto the skeletal structure of the standard skeletal animation data.
[0061] Methods for mapping the skeleton of a character model to the skeletal structure of standard skeletal animation data, such as Figure 4 As shown, it may include the following steps:
[0062] Step S3022: Determine the standard skeletal structure.
[0063] The skeletal structure for standard skeletal animation data is usually defined according to a preset standard, such as the Humanoid skeletal structure in the Unity engine.
[0064] Step S3024: Determine the skeleton of the character model.
[0065] Create the skeletal structure of the character model in modeling software. If the character model already has its own animation data, this data can be used to determine the skeletal structure.
[0066] Step S3026: Match the skeleton of the character model with the standard skeletal structure.
[0067] Match the character model's skeleton to a standard skeletal structure. Match each bone in the character model's skeleton to the closest bone in the standard skeletal structure. Skeletal matching tools in modeling software can be used to assist in the matching process.
[0068] Step S3028: Create and adjust the mapping relationship.
[0069] Establish a mapping relationship between the matched bones. Map each character model's bones to the closest bone in the standard skeletal structure. The bone rigging tools in modeling software can be used to assist in creating these mapping relationships.
[0070] After creating the mapping relationship, it is necessary to adjust it to ensure that the skeleton of the character model is as consistent as possible with the bone position and orientation of the standard skeletal structure. The skeletal adjustment tools in modeling software can be used to assist in adjusting the mapping relationship.
[0071] Step S304: Add a controller to the skeleton of the character model.
[0072] The skeleton of a character model consists of a series of connected bones, each representing a part of the character model. Controllers need to be added to the skeleton to control the model's posture and movements.
[0073] like Figure 5 As shown, adding controllers to the character model skeleton includes the following steps:
[0074] Step S3042: Determine the location and purpose for which the controller needs to be added.
[0075] For example, if you want the model to be able to walk, you need to add controllers to its feet.
[0076] Step S3044: Create a controller in 3D modeling software.
[0077] Typically, a controller can be a virtual object, such as a ball or a cuboid, or it can be a plane, such as a plane controller used for translation.
[0078] Step S3046: Bind the controller to the skeleton.
[0079] This is achieved by constraining the controller to the skeleton. For example, in Maya, tools such as PointConstraint, Orient Constraint, and Parent Constraint can be used to constrain the controller to the skeleton.
[0080] Step S3048: Configure the controller.
[0081] The pose and motion of the model can be changed by adjusting the controller parameters, such as rotation, translation, and scaling, in the attribute editor.
[0082] Step S306: Use the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model.
[0083] Standard skeletal animation data includes the character model's skeletal structure, joint rotation constraints, and skeletal pose data for each keyframe. Standard skeletal animation data can come from motion capture equipment or manually drawn animation data.
[0084] Automatic inverse kinematics can be performed using standard pose data from controllers and standard skeletal animation data. Inverse kinematics calculates the angles of each joint based on the position of the end effectors (such as hands or feet) to enable them to reach a specified position. Inverse kinematics can be performed using mathematical libraries or specialized animation engines.
[0085] like Figure 6 As shown, the specific automatic inverse kinematics solution method includes the following steps:
[0086] Step S3062: Calculate the position and pose of the end effectors of the character model's skeleton based on the skeleton of the character model.
[0087] Calculating the position and pose of the end effectors of the character model's skeleton requires forward kinematics calculations. Forward kinematics calculates the position and pose of the end effectors based on the angles of the joints.
[0088] The specific steps are as follows: 1) Starting from the root, traverse all bones in the order of the bone hierarchy. 2) For each bone, calculate its transformation matrix relative to its parent bone. The transformation matrix includes translation, rotation, and scaling. 3) Multiply the transformation matrix by the transformation matrix of its parent bone to obtain the world transformation matrix of the current bone. 4) Multiply the local transformation matrix (bone pose) of the current bone by the world transformation matrix to obtain the final transformation matrix of the current bone. 5) Apply the final transformation matrix of the current bone to all its child bones and mesh vertices to obtain their new positions and poses. 6) If the current bone is an end bone, return its position and pose as the position and pose of the end effector. If the current bone is not an end bone, continue traversing its child bones, repeating steps 2) to 6) until the end bone is reached. The final position and pose of the end effector are the desired result.
[0089] During the calculation, attention must be paid to the rotational constraints of the skeleton to ensure that the angles are within an acceptable range. Furthermore, matrix libraries or quaternion libraries can be used to perform matrix and rotation calculations.
[0090] Using the method described above, the position and pose of the end effectors of the character model's skeleton are calculated. This allows for further calculation of the angles of each joint to ensure it reaches the designated position. Calculating the position and pose of the end effectors improves the accuracy and efficiency of inverse kinematics calculations and ensures the continuity and naturalness of the animation.
[0091] Step S3064: Transform the position and pose of the end effector of the standard skeletal animation data into the coordinate system of the character model.
[0092] First, for each bone in the character model, a transformation matrix is constructed. The transformation matrix contains the translation, rotation, and scaling information for that bone.
[0093] Secondly, for each bone, the transformation matrix of that bone is calculated using the transformation matrix of its parent bone. For example, the translation, rotation, and scaling information of the bone can be converted into a transformation matrix T. Then, the transformation matrix T is multiplied by the transformation matrix P of the parent bone to obtain the transformation matrix M of the bone.
[0094] Next, for each bone in the standard skeletal animation data, its position and pose in the character model coordinate system are calculated using the bone's transformation matrix. For example, the position and pose of the bone in the standard skeletal animation data are converted into a transformation matrix S; the transformation matrix M of the bone is multiplied by the transformation matrix S to obtain the position and pose of the bone in the character model coordinate system.
[0095] Finally, the positions and poses of all bones in the standard skeletal animation data are converted to their positions and poses in the character model's coordinate system. This completes the process of converting the positions and poses of the end effectors in the standard skeletal animation data to the character model's coordinate system.
[0096] The method described in this embodiment is computationally efficient because it caches the transformation matrix of each bone for use during computation. Furthermore, it can accurately calculate the position and pose of the end effectors of bones and handle complex skeletal hierarchies and animation effects. In addition, this method is applicable to various types of character models and skeletal animation data and can be easily integrated into existing animation and game engines.
[0097] Step S3066: Calculate the error between the position and pose of the end effector of the skeleton of the character model and the position and pose of the end effector of the converted standard skeletal animation data.
[0098] like Figure 7 As shown, the method for calculating the error includes the following steps:
[0099] Step S30662: Calculate the weighted average.
[0100] For each joint of the character model's skeleton, a weighted average of the corresponding joint pose or angle in the standard skeletal animation data is calculated. This weighted average is assigned based on the joint's position within the skeletal hierarchy, with joints closer to the root having a higher weight. The formula for calculating the weighted average is as follows:
[0101]
[0102] Where xi represents the pose or angle of the i-th joint, wi represents the weight of the i-th joint, ri represents the range of motion of the i-th joint, and r max This represents the maximum range of motion of all joints, where n represents the number of joints.
[0103] The method described above for calculating the weighted average takes into account the range of motion of the joints, relating the weights to that range. For example, if a joint has a small range of motion, its weight can be adjusted to a smaller value, thus reducing its impact on the result when calculating the weighted average. This allows for a more accurate reflection of joint movement.
[0104] In some other embodiments, a Gaussian Mixture Model (GMM) can also be used to calculate the weighted average. GMM is a commonly used probability density estimation method that models a complex probability density function as a weighted sum of multiple Gaussian distributions, where each Gaussian distribution represents a "component" and the weighting coefficients represent the proportion of each component in the population.
[0105] When calculating the weighted average using a Gaussian Mixture Model (GMM), the position or rotation of each joint can be represented as a multivariate Gaussian distribution, where each component corresponds to a pose in standard animation data. The EM algorithm is then used to fit the GMM, treating the weight of each component as the weight of that joint. The final weighted average can be represented as the mean vector or rotation matrix of the GMM.
[0106] For example, given N data points {x1, x2, ..., xN}, the goal of a Gaussian Model (GMM) is to model the data using K Gaussian distributions. Let the weights of the k-th Gaussian distribution be wk, the weights of the j-th Gaussian distribution be wj, the mean be μ, and the covariance matrix be Σ. Then, for a data point xi, its contribution to Gaussian distribution k can be expressed as:
[0107]
[0108] in, This represents the probability density function value of xi in a Gaussian distribution k. Similarly, Let xi represent the probability density function value of Gaussian distribution j. In this way, each data point xi is assigned to all K Gaussian distributions, and its contribution to each Gaussian distribution is calculated.
[0109] Flattening the covariance matrix into a vector, the vector for each Gaussian distribution k can be represented as:
[0110]
[0111] in, Let θ represent a D-dimensional eigenvector. k It is the parameter vector corresponding to each Gaussian distribution k, θ j It is the parameter vector corresponding to each Gaussian distribution j.
[0112] Finally, the weighted average can be obtained by calculating the weighted average of the vector corresponding to each Gaussian distribution k and the contribution of Gaussian distribution k:
[0113]
[0114] Using GMM for weighted average calculation can better handle nonlinear and multimodal distributions, and eliminates the need to manually specify the weight allocation. Furthermore, GMM can be applied to other related problems, such as motion segmentation and model fitting.
[0115] In this way, when calculating the angle of each joint later, joint limitations (such as rotation range) and a weighted average can be used. The weighted average calculated using the above method can better control the range of motion of each joint, making the joint movement more natural and smooth.
[0116] Step S30664: Calculate position and pose.
[0117] For each joint of the skeleton of the character model, the position and pose of the end effector of the skeleton of the character model are calculated based on the corresponding weighted average.
[0118] The range of motion of each joint can be defined by specifying its minimum angle, maximum angle, and default angle. The minimum and maximum angles define the range of rotation of the joint, while the default angle defines the position of the joint in its initial state.
[0119] During movement, a weighted average can be used to control the range of motion of a joint. For example, if the weighted average is 0.5, the range of rotation of the joint will be limited to 50% of the default angle. If the weighted average is 1, the joint will be able to rotate completely freely.
[0120] In this embodiment, cubic interpolation is used to calculate the actual angle of the joint. Specifically, three keyframes can be defined using a default angle, a minimum angle, and a maximum angle, and then a weighted average is used to calculate the median angle. This ensures that the angle changes of the joint during movement are smooth.
[0121] Alternatively, other methods can be used to control the range of motion of a joint, such as using angle clamping or trigonometric functions to define the range of motion of the joint, i.e., position (angle) and posture.
[0122] Step S30666: Calculate the error.
[0123] For each joint of the skeleton of the character model, the error between the position and pose of the end effector of the skeleton of the character model and the position and pose of the end effector of the converted standard skeletal animation data is calculated using Euclidean distance or angle difference.
[0124] Specifically, for each joint, the position and pose of the end effectors of the character model's skeleton are calculated using inverse kinematics techniques. The position and pose of the end effectors in the converted standard skeletal animation data are then calculated using inverse kinematics. The Euclidean distance or angular difference between the positions of two end effectors is calculated. Euclidean distance is the straight-line distance between two points, while angular difference is the angular difference between two directions. For each joint, the Euclidean distances or angular differences calculated in the previous step are summed to obtain the total error for all joints. Preferably, the total error can also be standardized to convert the error values into more readable percentages or fractions.
[0125] Step S3068: Using the least squares method, calculate the angle or pose of each joint of the character model that minimizes the error, in order to match the end effector position and pose of the standard skeletal animation data.
[0126] For each joint, a function is fitted using the least squares method, mapping the angle or pose to an error value. This function can be a linear, polynomial, trigonometric, or similar function. For each joint, the fitted function is used to calculate the angle or pose that minimizes the error. Optimization algorithms such as gradient descent can be used to find the minimum value of the function. For all joints, the calculated angle or pose is applied to the skeleton of the character model to obtain a character model that matches the end effector positions and poses of standard skeletal animation data.
[0127] Step S308: Drive the character model based on the pose or joint angle of the character model.
[0128] Finally, the character model's pose or joint angles can be controlled using controllers. By adjusting the position and angle of the controllers, the desired pose or movement effect can be achieved. These controllers can be operated programmatically or manually.
[0129] Example 4
[0130] This embodiment provides a device for automatically matching standard skeletal animation data with different character models, such as... Figure 8 As shown, it includes: mapping module 82, solving module 84 and matching module 86.
[0131] The mapping module 82 is configured to create the skeleton of the character model and map the skeleton of the character model onto the skeletal structure of standard skeletal animation data.
[0132] The calculation module 84 is configured to add a controller to the skeleton of the character model and use the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model.
[0133] The matching module 86 is configured to drive the character model based on the pose or joint angle of the character model to generate redirected animation data.
[0134] This embodiment can realize the method of automatically matching standard skeletal animation data with different character models in the above embodiments, therefore, it will not be described again here.
[0135] Example 5
[0136] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 9 As shown, the electronic device includes:
[0137] The electronic device includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods of the above embodiments.
[0138] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0139] The memory 292, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, thereby implementing the methods in the above-described method embodiments.
[0140] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.
[0141] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in any of the embodiments.
[0142] This application also provides a computer program product, including a computer program that, when executed by a processor, is used to implement the methods described in any of the embodiments.
[0143] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention.
[0144] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0145] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, indirect coupling or communication connection between units or modules, and may be electrical or other forms.
[0146] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0147] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0148] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for automatically matching standard skeletal animation data with different character models, characterized in that, include: Establish the skeleton of the character model and map the skeleton of the character model onto the bone structure of standard skeletal animation data; A controller is added to the skeleton of the character model, and the controller is used to automatically perform inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model. Drive the character model based on its pose or joint angles to generate redirected animation data; The process involves adding a controller to the skeleton of the character model and using the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angles of the character model. This includes: adding a controller to the skeleton of the character model; the controller being a set of control points or keypoints used to control the pose or joint angles of the character model; and the controller performing automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data based on the position of the end effector to calculate the joint angle or pose of each joint of the character model, so that the end effector of the character model can reach a specified position. The process involves automatically performing inverse kinematics calculations on the standard pose data of the standard skeletal animation data to calculate the joint angles or poses of each joint of the character model. This includes: calculating the position and pose of the end effectors of the character model's skeleton based on the skeleton of the character model; comparing the position and pose of the end effectors of the character model's skeleton with the position and pose of the end effectors of the standard skeletal animation data; and calculating the angles or poses of each joint of the character model's skeleton using the least squares method. The process involves comparing the position and pose of the end effectors of the character model's skeleton with the position and pose of the end effectors in the standard skeletal animation data, and calculating the angle or pose of each joint of the character model's skeleton using the least squares method. This includes: transforming the position and pose of the end effectors in the standard skeletal animation data to the coordinate system of the character model; calculating the error between the position and pose of the end effectors of the character model's skeleton and the transformed position and pose of the end effectors in the standard skeletal animation data; and using the least squares method to calculate the angle or pose of each joint of the character model that minimizes the error, in order to match the position and pose of the end effectors in the standard skeletal animation data. The calculation of the error between the position and pose of the end effector of the character model's skeleton and the position and pose of the end effector in the converted standard skeletal animation data includes: for each joint of the character model's skeleton, calculating a weighted average of the corresponding joint pose or angle in the standard skeletal animation data, wherein the weighted average is assigned according to its position in the skeleton hierarchy, with joints closer to the root having a larger weight; for each joint of the character model's skeleton, calculating the position and pose of the end effector of the character model's skeleton based on the corresponding weighted average; and for each joint of the character model's skeleton, calculating the error between the position and pose of the end effector of the character model's skeleton and the position and pose of the end effector in the converted standard skeletal animation data using Euclidean distance or angle difference.
2. The method according to claim 1, characterized in that, Establish the skeleton of the character model, and map the skeleton of the character model onto the skeletal structure of standard skeletal animation data, including: The hierarchical structure, number, and position of the skeleton of the character model are determined based on the shape and movement characteristics of the character model in order to establish the skeleton of the character model. Based on coordinate system transformation, the skeleton of the character model is mapped onto the skeletal structure of standard skeletal animation data.
3. The method according to claim 1, characterized in that, Based on the pose or joint angles of the character model, the character model is driven to generate redirected animation data, including: Using the pose or joint angles of the character model as input, smooth animation data is generated through interpolation methods; The generated animation data is applied to the character model to generate redirected animation data.
4. The method according to claim 3, characterized in that, Generating smooth animation data through interpolation methods, including: For each joint of the skeleton of the character model, the transition value of the character model's pose or joint angle between adjacent frames is calculated by linear interpolation; Apply a smoothing function between transition values to generate smooth animation data.
5. A device for automatically matching standard skeletal animation data to different character models, characterized in that, include: The mapping module is configured to create the skeleton of the character model and map the skeleton of the character model onto the skeletal structure of standard skeletal animation data. The calculation module is configured to add a controller to the skeleton of the character model and use the controller to perform automatic inverse kinematics calculation on the standard pose data of the standard skeletal animation data to obtain the pose or joint angle of the character model. The matching module is configured to drive the character model based on its pose or joint angles to generate redirected animation data; The calculation module is further configured to: add a controller to the skeleton of the character model, wherein the controller is a set of control points or key points for controlling the posture or joint angle of the character model; the controller performs automatic inverse kinematics calculation on the standard posture data of the standard skeletal animation data based on the position of the end effector, and calculates the joint angle or posture of each joint of the character model so that the end of the character model can reach the specified position. The calculation module is further configured to: calculate the position and pose of the end effector of the skeleton of the character model based on the skeleton of the character model; compare the position and pose of the end effector of the skeleton of the character model with the position and pose of the end effector of the standard skeletal animation data, and calculate the angle or pose of each joint of the skeleton of the character model using the least squares method. The solution module is further configured to: convert the position and pose of the end effector of the standard skeletal animation data to the coordinate system of the character model; calculate the error between the position and pose of the end effector of the skeleton of the character model and the position and pose of the end effector of the converted standard skeletal animation data; and use the least squares method to calculate the angle or pose of each joint of the character model that minimizes the error, so as to match the position and pose of the end effector of the standard skeletal animation data. The calculation module is further configured to: for each joint of the skeleton of the character model, calculate the weighted average of the corresponding joint pose or angle in the standard skeletal animation data, wherein the weighted average is assigned according to its position in the skeleton hierarchy, with joints closer to the root having a greater weight; for each joint of the skeleton of the character model, calculate the position and pose of the end effector of the skeleton of the character model based on the corresponding weighted average; and for each joint of the skeleton of the character model, calculate the error between the position and pose of the end effector of the skeleton of the character model and the position and pose of the end effector of the converted standard skeletal animation data using Euclidean distance or angle difference.
6. A computer-readable storage medium having a program stored thereon, characterized in that, When the program is executed, the computer performs the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Animation redirection method and device, computer equipment and storage medium
CN114742926A