Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the principle of GPU Skinning skeletal animation?

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail what the principle of GPU Skinning skeletal animation is, and the content of the article is of high quality, so the editor will share it with you for reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

Recently, in the process of upgrading 64-bit for the engine, GPU skinning also appeared abnormal, usually skeletal animation and mesh skinning are still used a lot, but the underlying principle has not been studied deeply, thinking that it is still necessary to sort out this part of the content.

Bone skinning animation

Generally called bone animation (Skeletal Animation), it is a kind of model animation (there are two kinds of model animation, vertex animation and bone animation). It contains two parts of data: Bone and Skinned Mesh. Interconnected bones form a skeleton structure that animates by changing the orientation and position of the bones. Skinning is the key point of this technology, there is a misunderstanding, literally the novice may think that the "skin" of the skin refers to the map, but in fact, the skin refers to the Mesh itself, skinning refers to attaching (binding) the vertices of Mesh to the bone, and each vertex can be controlled by multiple bones, so that the vertices in the joint change their position because they are pulled by the father and son bones at the same time, thus eliminating the gap.

The model will display Mesh and Root Bone when importing Unity

The skinning information of a vertex includes which bones affect the vertex and the weight of the vertex affected by those bones. With skinning information, as long as our bones move normally, the skin will move with the bones. In order to get the bones moving, we need animation data. In Unity, we get animation data by reading the Keyframe information in the animation file.

Using the Animation window, we can see the Keyframe data in the animation file.

Here is a brief talk about the production process. After making the model, the general modeler will hand it over to the animator to make the model animation. The commonly used works are 3dmax (more game production) and maya (film and television level). First of all, bind good bones, bipeds generally use more T-Pose, and according to the design needs to add some additional bones (wings, ribbons, etc.), according to the needs of the program to add some additional virtual body hanging points (weapons, equipment, etc.), this step usually needs to be planned in advance, otherwise it will be troublesome to change the subsequent requirements to re-bind bones. The position of the pelvis is usually chosen as the root bone, but in this case the root bone does not coincide with the world origin, and the midpoint between the two feet is usually selected in bone space as the origin (the origin of model space) to build a bone, and the root bone Bip01 is the only child bone of this bone. After binding the bones, adjust the position and orientation of the bones and K frames according to the designed animation scheme, and finally export the animation file.

When we import the model into Unity and put it in the world coordinate system, if the model has bones, the skeleton will determine the position and orientation of the model in the world coordinate system, because the vertices of Mesh are attached to the bone. What we are adjusting is the position and orientation of the root bone, and the child bone is calculated according to the parent-child relationship in the bone hierarchy. For the static model, there are no bones, all the vertices are defined on the model coordinate system, and then transformed from the model coordinate system to the world coordinate system.

In the hierarchical structure of bones, we use the coordinate space based on the joint as the origin to describe. All the sub-bones are translated, rotated and scaled based on the joint as the origin (usually the rotation matrix. Bones can have complex action combinations through rotation transformation). As shown in the following figure, the transformation of the parent bone affects itself and all child bones.

Mathematical realization

After talking about the principle of bone animation, we sort out the coordinate space transformation. The vertices of the model need to be transformed from the model space to the associated bone space (BoneOffsetMatrix), and then the world coordinates (BoneCombinedTransformMatrix) are calculated through the world transformation of the bone. The model space is the space of the modeler when modeling, which, as mentioned above, is generally the midpoint between the two feet of the model, when the model space and the world space coincide, and the Transform of the root bone is also based on the world space. So if we want to get the change matrix of the child bones in world space, we have to go through layers of matrix changes from the bottom up.

With the skinning information and the transformation of coordinate space, the next important step is vertex blending. The meaning of blending is to eliminate the gap in the joint position and make the animation more natural. The bone weight in the skin information is the key data. We need to traverse all the bones that affect the vertex, calculate the world coordinates of the vertex, and then use the bone weight to make a weighted average.

Vworld = Vmesh * BoneOffsetMatrix1 * BoneCombindMatrix1 * BoneWeight1 + Vmesh * BoneOffsetMatrix2 * BoneCombindMatrix2 * BoneWeight2 +... + Vmesh * BoneOffsetMatrixN * BoneCombindMatrixN * BoneWeightN about the principles of GPU Skinning skeletal animation, so much for sharing here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report