Bone data processing method and device, computer program product and electronic equipment
By obtaining the global transformation matrix and model restriction parameters of the skeleton, correcting and adjusting the vertex positions in the skinned mesh, and combining projection dynamics, the problem of collapse of the skinning method and substandard real-time effects when the skeleton is moving is solved, achieving high-quality Quality skin movement effects.
Patent Information
- Application Number
- CN202411337230.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-14
AI Technical Summary
In the prior art, when bones are moved, the skinning method has problems of collapse or expansion, and the physical-based skinning method does not meet the real-time effect.
By obtaining the global transformation matrix of the skeleton, the vertex position in the skin mesh is determined, the model restriction parameters are obtained for correction, the projection vector is determined for adjustment, and the skin movement results are obtained by combining projection dynamics.
It avoids skin collapse or penetration when bones deform, improving the real-time and realistic skinning effect.
Smart Images

Figure CN119313790A_ABST
Abstract
Description
Background Art
[0002] The movement of human bones will lead to the spatial movement and surface changes of muscles and human skin. Similarly, for skeletal animation, after the skeletal model is skinned in the engine, the movement of the bones will cause the skin to deform.
[0003] In the related technologies, geometric skinning methods or physics-based skinning methods are usually used to skin bones. Geometric skinning methods, such as linear blend skinning (LBS) and dual quaternion skinning (DQS), have the defects of collapse or expansion in the joint area; physics-based skinning methods can provide realistic dynamic tissue deformation and collision detection, but the computing performance is not enough to meet the needs of interactive applications, and the real-time effect is not up to standard.
[0004] Therefore, it is necessary to provide a new skeleton data processing method.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the invention
[0006] The present disclosure provides a bone data processing method, a bone data processing device, a computer program product and an electronic device, thereby overcoming at least to a certain extent the problems of not meeting real-time requirements and collapse or expansion when the bone is deformed due to the limitations and defects of the relevant technology.
[0007] According to one aspect of the present disclosure, a skeleton data processing method is provided, comprising:
[0008] Obtaining a transformation matrix of a bone in a current frame, determining a global transformation matrix of the bone according to the transformation matrix, and determining a first position of a vertex in a skin mesh in a next frame according to the global transformation matrix;
[0009] Acquire a model restriction parameter, and modify the first position according to the model restriction parameter to obtain a second position;
[0010] Determine a projection vector according to the initial position of the vertex and the second position, and adjust the second position according to the projection vector to obtain a projection correction position of the vertex;
[0011] Combined with the projection dynamics, the position is corrected according to the projection to obtain the skin movement result associated with the skeleton.
[0012] In an exemplary embodiment of the present disclosure, acquiring the transformation matrix of the skeleton of the current frame and determining the global transformation matrix of the skeleton according to the transformation matrix includes:
[0013] Obtain the transformation matrix and the bone hierarchy of the bone, and determine the parent bone of the bone according to the bone hierarchy;
[0014] The global transformation matrix of the bone is obtained through the transformation matrix of the parent bone and the transformation matrix of the bone.
[0015] In an exemplary embodiment of the present disclosure, determining the first position of the vertex in the skin mesh in the next frame according to the global transformation matrix includes:
[0016] Obtaining vertex weights of vertices in the skinned mesh;
[0017] Based on dynamics, the first position of the vertex in the next frame of the current frame is determined through the global transformation matrix of the skeleton and the vertex weight.
[0018] In an exemplary embodiment of the present disclosure, the acquiring of the model restriction parameter and the correction of the first position according to the model restriction parameter to obtain the second position include:
[0019] Acquire physical constraints of the vertices, and determine model restriction parameters according to the physical constraints;
[0020] Determine a first movement vector according to the initial position and the first position, and obtain a second movement vector through the model restriction parameter and the first movement vector;
[0021] The position of the end point of the second motion vector is determined as the second position.
[0022] In an exemplary embodiment of the present disclosure, determining the projection vector according to the initial position of the vertex and the second position includes:
[0023] Based on the initial position and the second position, obtain a third movement vector;
[0024] The projection vector is obtained by the dot product result of the third movement vector and the vertex normal vector.
[0025] In an exemplary embodiment of the present disclosure, after obtaining the first position, the method further includes:
[0026] An initial skin surface mesh is obtained according to the first position of the vertices in the skin mesh.
[0027] In an exemplary embodiment of the present disclosure, adjusting the second position according to the projection vector to obtain the projection correction position of the vertex includes:
[0028] When the second position exceeds the initial skin surface grid, adjusting the second position along the negative direction of the projection vector to obtain the projection correction position;
[0029] When the second position intersects with the initial skin surface grid, the second position is adjusted along the direction of the projection vector to obtain the projection correction position.
[0030] In an exemplary embodiment of the present disclosure, when adjusting the second position, the method further includes:
[0031] Obtaining first normal information of a first vertex in a line area connecting the vertices;
[0032] An intermediate value of a first normal direction is determined according to the first normal information, and a direction of the normal vector of the vertex is adjusted according to the intermediate value.
[0033] In an exemplary embodiment of the present disclosure, combining projection dynamics and obtaining skin movement results associated with the skeleton according to the projection correction position includes:
[0034] Iteratively correcting the vertex position using the model restriction parameters, determining the projection vector, and projecting the vertex position according to the projection vector, and obtaining a target skin surface mesh when a change in the vertex position in the skin mesh is less than a preset change value;
[0035] The skin motion result is obtained by combining the projection dynamics with the target skin surface mesh.
[0036] According to one aspect of the present disclosure, there is provided a skeleton data processing device, comprising:
[0037] A position prediction module, used to obtain a transformation matrix of a bone in a current frame, determine a global transformation matrix of the bone according to the transformation matrix, and determine a first position of a vertex in a skin mesh in a next frame according to the global transformation matrix;
[0038] A first position correction module, used for obtaining a model restriction parameter, and correcting the first position according to the model restriction parameter to obtain a second position;
[0039] A second position correction module, used to determine a projection vector according to the initial position of the vertex and the second position, and adjust the second position according to the projection vector to obtain a projection correction position of the vertex;
[0040] The movement result acquisition module is used to obtain the skin movement result associated with the skeleton according to the projection correction position in combination with the projection dynamics.
[0041] According to one aspect of the present disclosure, there is provided an electronic device, including:
[0042] Processor; and
[0043] A memory, configured to store executable instructions of the processor;
[0044] Wherein, the processor is configured to perform the bone data processing method described in any of the above exemplary embodiments by executing the executable instructions.
[0045] According to one aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method for processing bone data described in any of the above exemplary embodiments is implemented.
[0046] The present disclosure provides a method for processing bone data, which includes obtaining a transformation matrix of a bone in a current frame, determining a global transformation matrix of the bone according to the transformation matrix, and determining a first position of a vertex in a skin mesh in a next frame according to the global transformation matrix; obtaining a model restriction parameter, and correcting the first position according to the model restriction parameter to obtain a second position; determining a projection vector according to the initial position and the second position of the vertex, and adjusting the second position according to the projection vector to obtain a projection correction position of the vertex; and combining projection dynamics, and obtaining a skin movement result associated with the bone according to the projection correction position. On the one hand, after obtaining the global transformation matrix of the bone, the first position of the vertex in the skin mesh in a next frame of the current frame is obtained according to the global transformation matrix, and after obtaining the first position, the first position is corrected according to the model restriction parameter to obtain a second position, and after obtaining the second position, the projection vector is determined according to the second position, and the second position is adjusted according to the projection vector to obtain a projection correction position of the vertex. By continuously correcting the vertex position, it is ensured that the problem of skin collapse or penetration is avoided while the bone is deformed. On the other hand, after obtaining the projection correction position of the skin mesh vertices, combined with the projection dynamics, the skin movement results associated with the bones are obtained according to the projection correction position, realizing the real-time display of the skin motion structure and solving the problem that the real-time effect of the physics-based skinning method in related technologies does not meet the standards.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present invention, and together with the specification are used to explain the principles of the present invention. Obviously, the accompanying drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0049] Figure 1 The following schematically shows a flowchart of a skeleton data processing method according to an exemplary embodiment of the present disclosure.
[0050] Figure 2 A flowchart of a method for obtaining a transformation matrix of a bone in a current frame and determining a global transformation matrix of the bone based on the transformation matrix according to an exemplary embodiment of the present disclosure is schematically shown.
[0051] Figure 3 A flowchart of a method for determining first positions of vertices in a skinned mesh in a next frame according to a global transformation matrix according to an exemplary embodiment of the present disclosure is schematically shown.
[0052] Figure 4 A flowchart of a method for obtaining a model restriction parameter, correcting a first position according to the model restriction parameter, and obtaining a second position according to an exemplary embodiment of the present disclosure is schematically shown.
[0053] Figure 5 A flowchart of a method for determining a projection vector according to an initial position of the vertex and the second position according to an exemplary embodiment of the present disclosure is schematically shown.
[0054] Figure 6 A flowchart of a method for adjusting a second position according to a projection vector to obtain a projection correction position of a vertex according to an exemplary embodiment of the present disclosure is schematically shown.
[0055] Figure 7 A flowchart of a method for processing skeleton data when adjusting a second position according to an exemplary embodiment of the present disclosure is schematically shown.
[0056] Figure 8 A flowchart of a method for combining projection dynamics with a position correction of the projection to obtain a skin movement result associated with the skeleton according to an exemplary embodiment of the present disclosure is schematically shown.
[0057] Fig. 9 A block diagram schematically shows a skeleton data processing device according to an exemplary embodiment of the present disclosure.
[0058] Fig.10 An electronic device for implementing a skeleton data processing method according to an exemplary embodiment of the present invention is schematically shown. DETAILED DESCRIPTION
[0059] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present invention will be more comprehensive and complete, and the concept of the example embodiments will be fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solutions of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present invention.
[0060] In addition, the accompanying drawings are only schematic illustrations of the present invention and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0061] In traditional skinning, linear blending is usually used, and the position of the vertex is directly determined by the transformation of the bone and the vertex weight, usually without considering the actual geometry of the skin. When dealing with complex deformations, such as severe stretching or compression, unnatural results such as vertex folding or goofs may occur. However, its implementation is relatively simple, most graphics engines and animation software provide built-in support, and due to its simplicity, it is usually more advantageous in performance and suitable for real-time applications. In some cases, additional work may be required to optimize the visual effects, such as manually adjusting weights or adding additional bones to solve deformation problems.
[0062] Based on one or more of the above problems, this example implementation first provides a skeleton data processing method, referring to Figure 1 As shown, the skeleton data processing method may include the following steps:
[0063] Step S110. Obtain the transformation matrix of the skeleton of the current frame, determine the global transformation matrix of the skeleton according to the transformation matrix, and determine the first position of the vertex in the skin mesh in the next frame according to the global transformation matrix;
[0064] Step S120: Obtain model restriction parameters, and modify the first position according to the model restriction parameters to obtain a second position;
[0065] Step S130. Determine a projection vector according to the initial position of the vertex and the second position, and adjust the second position according to the projection vector to obtain a projection correction position of the vertex;
[0066] Step S140. Combined with the projection dynamics, according to the projection correction position, obtain the skin movement result associated with the skeleton.
[0067] The above-mentioned bone data processing method obtains the transformation matrix of the bone in the current frame, determines the global transformation matrix of the bone according to the transformation matrix, and determines the first position of the vertex in the skin mesh in the next frame according to the global transformation matrix; obtains the model restriction parameter, corrects the first position according to the model restriction parameter to obtain the second position; determines the projection vector according to the initial position and the second position of the vertex, adjusts the second position according to the projection vector, and obtains the projection correction position of the vertex; combines the projection dynamics, and obtains the skin movement result associated with the bone according to the projection correction position. On the one hand, after obtaining the global transformation matrix of the bone, the first position of the vertex in the skin mesh in the next frame of the current frame is obtained according to the global transformation matrix, after obtaining the first position, the first position is corrected according to the model restriction parameter to obtain the second position, after obtaining the second position, the projection vector is determined according to the second position, and the second position is adjusted according to the projection vector to obtain the projection correction position of the vertex. By continuously correcting the vertex position, it is ensured that the problem of skin collapse or penetration is avoided while the bone is deformed. On the other hand, after obtaining the projection correction position of the skin mesh vertices, combined with the projection dynamics, the skin movement results associated with the bones are obtained according to the projection correction position, realizing the real-time display of the skin motion structure and solving the problem that the real-time effect of the physics-based skinning method in related technologies does not meet the standards.
[0068] In this article, the terms involved are explained as follows:
[0069] Projected dynamics: A physics simulation method that uses projection techniques to solve constraints in dynamic systems. This method can be used to simulate a variety of physical phenomena, including but not limited to soft body dynamics. It can be applied to physical simulation, computer graphics, animation, and any field that needs to deal with dynamic constraints. Projections are often used to satisfy constraints in physics simulations. It can handle a wider range of physics problems, such as collisions, contact forces, elasticity, etc.
[0070] Projection Skinning: A character animation technique used in computer graphics, particularly for simulating the deformation of skin and other soft tissues. It works by projecting skin vertices into a space defined by the motion of bones. It is primarily used in the animation and visual effects industries to achieve realistic character animation. Using projection to bind skin vertices to bones can handle complex skin deformations such as stretching, compression, and shearing.
[0071] GPU parallel computing: a high-performance computing technology that uses graphics processing units (GPUs).
[0072] In the following, each step involved in the skeleton data processing method according to the exemplary embodiment of the present disclosure is explained and illustrated in detail.
[0073] In step S110, the transformation matrix of the skeleton of the current frame is obtained, the global transformation matrix of the skeleton is determined according to the transformation matrix, and the first position of the vertices in the skin mesh in the next frame is determined according to the global transformation matrix.
[0074] Among them, the transformation matrix of the bone is the local transformation matrix of the bone, which describes the rotation, translation and scaling of the bone relative to its parent bone. The local transformation is usually defined in the local coordinate system of the bone. After obtaining the transformation matrix of the bone, the local transformation matrix (such as rotation, translation, scaling) of the bone can be combined with its position in the bone hierarchy, and the global transformation matrix of the bone can be obtained by multiplying the transformation matrix of the parent bone. The global transformation matrix can convert the vertex coordinates from model space to world space.
[0075] In skinned animation, the full transformation matrix is used to calculate the new position of the vertex during the animation process, that is, to predict the position of the vertices in the skinned mesh in the next frame after the current frame. The position of each vertex is updated according to the full transformation matrix of its associated bone to achieve bone-driven animation effects.
[0076] In this example embodiment, reference Figure 2 As shown, the step of obtaining the transformation matrix of the skeleton of the current frame and determining the global transformation matrix of the skeleton according to the transformation matrix includes:
[0077] Step S210. Obtain the transformation matrix and the bone hierarchy of the bone, and determine the parent bone of the bone according to the bone hierarchy;
[0078] Step S220: Obtain the global transformation matrix of the bone through the transformation matrix of the parent bone and the transformation matrix of the bone.
[0079] In the following, step S210 and step S220 are further explained and illustrated. Specifically, the transformation matrix and the bone hierarchy of the bone are obtained, wherein the bone hierarchy is used to derive the parent-child relationship of the bone. After the bone hierarchy is obtained, the parent bone of the bone can be determined according to the bone hierarchy. After the parent bone is obtained, the transformation matrix of the bone is multiplied by the transformation matrix of the parent bone to obtain the global transformation matrix of the bone.
[0080] After obtaining the global transformation matrix, the position of the bone in the next frame of the current frame can be determined based on the global transformation matrix of the bone. Figure 3 As shown, determining the first position of the vertex in the skin mesh in the next frame according to the global transformation matrix includes:
[0081] Step S310. Obtaining vertex weights of vertices in the skinned mesh;
[0082] Step S320: Based on dynamics, determine the first position of the vertex in the next frame of the current frame through the global transformation matrix of the skeleton and the vertex weight.
[0083] In the following, step S310 and step S320 will be further explained and illustrated. Specifically, the weights of the vertices in the skinned mesh are obtained, wherein each vertex in the mesh will be affected by multiple bones, and the weights of the vertices are initialized when the skinned skeleton is created, and the sum of the weights of each vertex affected by multiple bones is 1. After the weight of each vertex is obtained, the first position of the vertex in the skinned mesh in the next frame of the current frame is obtained based on the dynamics through the global transformation matrix of the skeleton and the weight of the vertices in the skinned mesh. Among them, the dynamics can be forward dynamics or inverse dynamics, which is not specifically limited in this example embodiment.
[0084] In this exemplary embodiment, after the first position is obtained, an initial skin surface mesh may be obtained according to the first position corresponding to each vertex in the skin mesh, and the initial skin surface mesh is used to generate a target skin surface mesh.
[0085] In step S120, a model restriction parameter is obtained, and the first position is corrected according to the model restriction parameter to obtain a second position.
[0086] Among them, physical constraints usually refer to the restrictions on the movement of vertices. These constraints ensure that the animation looks natural and conforms to the laws of motion in the real world. Physical constraints can be parameters from the model itself, which can be used to control the elasticity of the skin, generally limiting its upper and lower limits.
[0087] refer to Figure 4As shown, the acquiring of the model restriction parameter and the correction of the first position according to the model restriction parameter to obtain the second position include:
[0088] Step S410. Obtain the physical constraints of the vertices, and determine model restriction parameters according to the physical constraints;
[0089] Step S420. Determine a first movement vector according to the initial position and the first position, and obtain a second movement vector through the model restriction parameter and the first movement vector;
[0090] Step S430: Determine the position of the end point of the second motion vector as the second position.
[0091] In the following, step S410 to step S430 will be further explained and illustrated. Specifically, first, the physical constraints of the vertex are obtained and converted into model constraint parameters. In this exemplary embodiment, the physical constraints are not specifically limited. Then, the first movement vector is determined according to the initial position of the vertex and the first position, and the model constraint parameter is multiplied with the first movement vector to obtain a new second movement vector, and the position of the end point of the second movement vector is determined as the second position.
[0092] In step S130, a projection vector is determined according to the initial position of the vertex and the second position, and the second position is adjusted according to the projection vector to obtain a projection correction position of the vertex.
[0093] After obtaining the second position of the vertex, since the second position does not take into account the direct transformation result of the skin surface constraint, the second position needs to be adjusted again. When adjusting the second position, it can be determined by projecting the skin whether to adjust the second position.
[0094] refer to Figure 5 As shown, determining the projection vector according to the initial position of the vertex and the second position includes:
[0095] Step S510. Based on the initial position and the second position, obtain a third movement vector;
[0096] Step S520: Obtain the projection vector through the dot product result of the third movement vector and the vertex normal vector.
[0097] In the following, step S510 and step S520 will be further explained and illustrated. Specifically, first, based on the initial position of the vertex in the skin mesh and the second position of the vertex, a third movement vector is obtained, and the third movement vector represents the direction and distance of movement of the vertex due to the movement of the skeleton. Secondly, the normal vector of each vertex in the skin mesh is calculated, wherein the normal vector is a vector perpendicular to the skin surface before animation, and is used to determine the direction of the skin surface. Thirdly, the third movement vector is projected to the normal vector of the vertex, and a projection vector is obtained by calculating the dot product result of the third movement vector and the normal vector. The length of the projection vector is the same as the length of the third movement vector, and the direction is the same as the direction of the normal vector.
[0098] The second position of the vertex is traversed to determine whether the position of the second vertex intersects with or exceeds the initial skin surface mesh, and the position of the second vertex is adjusted using the projection vector.
[0099] refer to Figure 6 As shown, the adjusting the second position according to the projection vector to obtain the projection correction position of the vertex includes:
[0100] Step S610. When the second position exceeds the initial skin surface grid, the second position is adjusted along the negative direction of the projection vector to obtain the projection correction position;
[0101] Step S620: When the second position intersects with the initial skin surface grid, the second position is adjusted along the direction of the projection vector to obtain the projection correction position.
[0102] In the following, step S610 and step S620 will be further explained and illustrated. Specifically, when the second position of the vertex exceeds the initial skin surface mesh, the vertex needs to be pulled back into the skin surface. When pulling the vertex back to the skin surface, a certain scaling value can be set, and the pulling distance is determined according to the scaling value. In this example embodiment, the scaling value is not specifically limited. When pulling the vertex back into the surface, the vertex at the second position is pulled back along the negative direction of the projection vector. When the position of the second vertex intersects with the initial skin surface mesh, the vertex is moved along the direction of the projection vector to ensure that the vertex is on the initial skin surface mesh. After adjusting the second position, the projection correction position of the vertex is obtained.
[0103] In this exemplary embodiment, when adjusting the second position of the vertex, it is necessary to ensure the coherence and smoothness of the entire initial skin surface mesh, that is, the movement of adjacent vertices should be coordinated and consistent. Figure 7 As shown, when the second position is adjusted, the method further includes:
[0104] Step S710. Obtain the first normal information of the first vertex in the line area of the vertices;
[0105] Step S720: Determine an intermediate value of the first normal direction according to the first normal information, and adjust the direction of the normal vector of the vertex according to the intermediate value.
[0106] In the following, step S710 and step S720 are further explained and illustrated. Specifically, the first normal information of the first vertex in the line area of the vertices is obtained, and the intermediate value of the first normal direction is determined according to the first normal information while ensuring that the position of the vertex remains unchanged. The direction of the normal vector of the vertex is adjusted according to the intermediate value to make the initial skin surface mesh coherent. The process is actually an interpolation method for smooth transition from a rough simulation mesh to a high-resolution visualization mesh.
[0107] In step S140, the skin movement result associated with the skeleton is obtained according to the projection correction position in combination with the projection dynamics.
[0108] After the second position is adjusted to obtain the projection correction position, the skin motion structure can be obtained by directly combining the skin surface mesh formed by the vertices of the projection correction position with the projection dynamics.
[0109] However, it is possible to iterate the above process to obtain fairly accurate values, see Figure 8 As shown, the combined projection dynamics, based on the projection correction position, obtains the skin movement result associated with the skeleton, including:
[0110] Step S810. Correcting the vertex position using the model restriction parameters, determining the projection vector, and iterating the projection of the vertex position according to the projection vector, and obtaining the target skin surface mesh when the change of the vertex position in the skin mesh is less than a preset change value;
[0111] Step S820: combining projection dynamics and obtaining the skin movement result through the target skin surface mesh.
[0112] In the following, step S810 and step S820 will be further explained and illustrated. Specifically, after the initial skin surface mesh is generated according to the first position, since the initial skin surface mesh is an approximation, multiple iterations are required. In each iteration, the position of the vertex is updated. After the position of the vertex is updated, the skin surface mesh is determined according to the updated position of the vertex, and the physical constraints and penetration problems of the vertex are calculated again. The iteration will be performed multiple times until the change in the position of the vertex in the skin mesh is less than the preset value or reaches the preset number of iterations. When the position change of the vertex in the skin mesh is less than the preset value or reaches the preset number of iterations, it can be considered that the position of the vertex has converged and reached a stable state. After the vertex reaches a stable state, the target skin surface mesh is obtained according to the position of the vertex, and the parallel and efficient characteristics of the GPU are used in combination with projection dynamics to obtain the skin motion result.
[0113] In the above process, the new position of the vertex and the skin surface are interdependent during the calculation process. Through iteration, a vertex position and skin surface that meets all constraints can be determined, ensuring the realism and quality of the animation.
[0114] The skeleton data processing method provided by the example embodiment of the present disclosure has at least the following advantages: on the one hand, after the global transformation matrix of the skeleton is obtained, the first position of the vertex in the skin mesh in the next frame of the current frame is obtained according to the global transformation matrix. After the first position is obtained, the first position is corrected according to the model restriction parameter to obtain the second position. After the second position is obtained, the projection vector is determined according to the second position, and the second position is adjusted according to the projection vector to obtain the projection correction position of the vertex. By continuously correcting the vertex position, it is ensured that the problem of skin collapse or penetration is avoided while the skeleton is deformed; on the other hand, after the projection correction position of the vertex of the skin mesh is obtained, combined with the projection dynamics, the skin movement result associated with the skeleton is obtained according to the projection correction position, thereby realizing the real-time display of the skin movement structure and solving the problem that the real-time effect of the physics-based skinning method in the related technology does not meet the standard; on the other hand, by iteratively calculating the first position of the vertex, the realism and quality of the skeleton animation are ensured.
[0115] The exemplary embodiment of the present disclosure also provides a skeleton data processing device, referring to Fig. 9 As shown, it may include: a position prediction module 910, a first position correction module 920, a second position correction module 930 and a motion result acquisition module 940. Among them:
[0116] A position prediction module 910 is used to obtain a transformation matrix of a bone in a current frame, determine a global transformation matrix of the bone according to the transformation matrix, and determine a first position of a vertex in a skin mesh in a next frame according to the global transformation matrix;
[0117] A first position correction module 920, used to obtain a model restriction parameter, and correct the first position according to the model restriction parameter to obtain a second position;
[0118] A second position correction module 930, configured to determine a projection vector according to the initial position of the vertex and the second position, and adjust the second position according to the projection vector to obtain a projection correction position of the vertex;
[0119] The movement result acquisition module 940 is used to obtain the skin movement result associated with the skeleton according to the projection correction position in combination with the projection dynamics.
[0120] The specific details of each module in the above-mentioned skeleton data processing device have been described in detail in the corresponding skeleton data processing method, so they will not be repeated here.
[0121] In an exemplary embodiment of the present disclosure, acquiring the transformation matrix of the skeleton of the current frame and determining the global transformation matrix of the skeleton according to the transformation matrix includes:
[0122] Obtain the transformation matrix and the bone hierarchy of the bone, and determine the parent bone of the bone according to the bone hierarchy;
[0123] The global transformation matrix of the bone is obtained through the transformation matrix of the parent bone and the transformation matrix of the bone.
[0124] In an exemplary embodiment of the present disclosure, determining the first position of the vertex in the skin mesh in the next frame according to the global transformation matrix includes:
[0125] Obtaining vertex weights of vertices in the skinned mesh;
[0126] Based on dynamics, the first position of the vertex in the next frame of the current frame is determined through the global transformation matrix of the skeleton and the vertex weight.
[0127] In an exemplary embodiment of the present disclosure, the acquiring of the model restriction parameter and the correction of the first position according to the model restriction parameter to obtain the second position include:
[0128] Acquire physical constraints of the vertices, and determine model restriction parameters according to the physical constraints;
[0129] Determine a first movement vector according to the initial position and the first position, and obtain a second movement vector through the model restriction parameter and the first movement vector;
[0130] The position of the end point of the second motion vector is determined as the second position.
[0131] In an exemplary embodiment of the present disclosure, determining the projection vector according to the initial position of the vertex and the second position includes:
[0132] Based on the initial position and the second position, obtain a third movement vector;
[0133] The projection vector is obtained by the dot product result of the third movement vector and the vertex normal vector.
[0134] In an exemplary embodiment of the present disclosure, after obtaining the first position, the method further includes:
[0135] An initial skin surface mesh is obtained according to the first position of the vertices in the skin mesh.
[0136] In an exemplary embodiment of the present disclosure, adjusting the second position according to the projection vector to obtain the projection correction position of the vertex includes:
[0137] When the second position exceeds the initial skin surface grid, adjusting the second position along the negative direction of the projection vector to obtain the projection correction position;
[0138] When the second position intersects with the initial skin surface grid, the second position is adjusted along the direction of the projection vector to obtain the projection correction position.
[0139] In an exemplary embodiment of the present disclosure, when adjusting the second position, the method further includes:
[0140] Obtaining first normal information of a first vertex in a line area connecting the vertices;
[0141] An intermediate value of a first normal direction is determined according to the first normal information, and a direction of the normal vector of the vertex is adjusted according to the intermediate value.
[0142] In an exemplary embodiment of the present disclosure, combining projection dynamics and obtaining skin movement results associated with the skeleton according to the projection correction position includes:
[0143] Iteratively correcting the vertex position using the model restriction parameters, determining the projection vector, and projecting the vertex position according to the projection vector, and obtaining a target skin surface mesh when a change in the vertex position in the skin mesh is less than a preset change value;
[0144] The skin motion result is obtained by combining the projection dynamics with the target skin surface mesh.
[0145] It should be noted that, although several modules or units of the equipment for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into being embodied by multiple modules or units.
[0146] In addition, although the steps of the method of the present invention are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.
[0147] In an exemplary embodiment of the present invention, an electronic device capable of implementing the above method is also provided.
[0148] It will be appreciated by those skilled in the art that various aspects of the present invention may be implemented as a system, method or program product. Therefore, various aspects of the present invention may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to herein as a "circuit", "module" or "system".
[0149] Refer to the following Fig.10 The electronic device 1000 according to this embodiment of the present invention will be described. Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0150] like Fig.10 As shown, the electronic device 1000 is in the form of a general computing device. The components of the electronic device 1000 may include but are not limited to: the at least one processing unit 1010, the at least one storage unit 1020, a bus 1030 connecting different system components (including the storage unit 1020 and the processing unit 1010), and a display unit 1040.
[0151] The storage unit stores program codes, which can be executed by the processing unit 1010, so that the processing unit 1010 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 1010 can perform the following steps: Figure 1Step S110 shown in: obtain the transformation matrix of the skeleton of the current frame, determine the global transformation matrix of the skeleton according to the transformation matrix, and determine the first position of the vertex in the skin mesh in the next frame according to the global transformation matrix; S120: obtain the model restriction parameter, correct the first position according to the model restriction parameter to obtain the second position; S130: determine the projection vector according to the initial position and the second position of the vertex, adjust the second position according to the projection vector, and obtain the projection corrected position of the vertex; S140: combine the projection dynamics, and obtain the skin movement result associated with the skeleton according to the projection corrected position.
[0152] The storage unit 1020 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 10201 and / or a cache storage unit 10202 , and may further include a read-only storage unit (ROM) 10203 .
[0153] The storage unit 1020 may also include a program / utility 10204 having a set (at least one) of program modules 10205, such program modules 10205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0154] Bus 1030 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0155] The electronic device 1000 may also communicate with one or more external devices 1100 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 1000 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1050. In addition, the electronic device 1000 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1060. As shown, the network adapter 1060 communicates with other modules of the electronic device 1000 via a bus 1030. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1000, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID (Redundant Arrays of Independent Disks, independent redundant disk array) systems, tape drives, and data backup storage systems.
[0156] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present invention can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present invention.
[0157] In an exemplary embodiment of the present invention, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of this specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to perform the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0158] The program product for implementing the above method according to an embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.
[0159] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0160] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0161] The program code contained on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
[0162] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0163] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0164] Other embodiments of the invention will readily occur to those skilled in the art after considering the specification and practicing the invention invented herein. This application is intended to cover any variations, uses or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art that are not invented by the present invention. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the claims.
Claims
1. A method for processing skeleton data, characterized in that: include: Obtaining a transformation matrix of a bone in a current frame, determining a global transformation matrix of the bone according to the transformation matrix, and determining a first position of a vertex in a skin mesh in a next frame according to the global transformation matrix; Acquire a model restriction parameter, and modify the first position according to the model restriction parameter to obtain a second position; Determine a projection vector according to the initial position of the vertex and the second position, and adjust the second position according to the projection vector to obtain a projection correction position of the vertex; Combined with the projection dynamics, the position is corrected according to the projection to obtain the skin movement result associated with the skeleton.
2. The method according to claim 1, characterized in that The step of obtaining a transformation matrix of a bone of a current frame and determining a global transformation matrix of the bone according to the transformation matrix comprises: Obtain the transformation matrix and the bone hierarchy of the bone, and determine the parent bone of the bone according to the bone hierarchy; The global transformation matrix of the bone is obtained through the transformation matrix of the parent bone and the transformation matrix of the bone.
3. The method according to claim 1, characterized in that The step of determining the first position of the vertices in the skin mesh in the next frame according to the global transformation matrix comprises: Obtaining vertex weights of vertices in the skinned mesh; Based on dynamics, the first position of the vertex in the next frame of the current frame is determined through the global transformation matrix of the skeleton and the vertex weight.
4. The method according to claim 1, characterized in that: The acquiring of the model restriction parameter and correcting the first position according to the model restriction parameter to obtain the second position includes: Acquire physical constraints of the vertices, and determine model restriction parameters according to the physical constraints; Determine a first movement vector according to the initial position and the first position, and obtain a second movement vector through the model restriction parameter and the first movement vector; The position of the end point of the second motion vector is determined as the second position.
5. The method according to claim 4, characterized in that The step of determining a projection vector according to the initial position of the vertex and the second position includes: Based on the initial position and the second position, obtain a third movement vector; The projection vector is obtained by the dot product result of the third movement vector and the normal vector of the vertex.
6. The method according to claim 1, characterized in that After obtaining the first position, the method further includes: An initial skin surface mesh is obtained according to the first position of the vertices in the skin mesh.
7. The method according to claim 6, characterized in that The adjusting the second position according to the projection vector to obtain the projection correction position of the vertex includes: When the second position exceeds the initial skin surface grid, adjusting the second position along the negative direction of the projection vector to obtain the projection correction position; When the second position intersects with the initial skin surface grid, the second position is adjusted along the direction of the projection vector to obtain the projection correction position.
8. The method according to claim 7, characterized in that When adjusting the second position, the method further includes: Obtaining first normal information of a first vertex in a line area connecting the vertices; An intermediate value of a first normal direction is determined according to the first normal information, and a direction of the normal vector of the vertex is adjusted according to the intermediate value.
9. The method according to claim 1, characterized in that: The combining projection dynamics and obtaining the skin movement result associated with the skeleton according to the projection correction position include: Iteratively correcting the vertex position using the model restriction parameters, determining the projection vector, and projecting the vertex position according to the projection vector, and obtaining a target skin surface mesh when a change in the vertex position in the skin mesh is less than a preset change value; The skin movement result is obtained by combining the projection dynamics with the target skin surface mesh.
10. A skeleton data processing device, characterized in that: include: A position prediction module, used to obtain a transformation matrix of a bone in a current frame, determine a global transformation matrix of the bone according to the transformation matrix, and determine a first position of a vertex in a skin mesh in a next frame according to the global transformation matrix; A first position correction module, used for obtaining a model restriction parameter, and correcting the first position according to the model restriction parameter to obtain a second position; A second position correction module, used to determine a projection vector according to the initial position of the vertex and the second position, and adjust the second position according to the projection vector to obtain a projection correction position of the vertex; The movement result acquisition module is used to obtain the skin movement result associated with the skeleton according to the projection correction position in combination with the projection dynamics.
11. An electronic device, characterized in that: include: Processing unit; as well as A storage unit, used to store executable instructions of the processing unit; Wherein, the processing unit is configured to perform the method of any one of claims 1-9 by executing the executable instructions.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 9 is implemented.