16th back-to-bone Animation

Source: Internet
Author: User
This article introduces another type of resource: skeleton animation. This part is mainly written by my colleagues. But I also know a little about it, so I will introduce it here. A skeleton animation resource contains multiple animation sequences. We call it animpiece (this name is a bit earthy). Each segment of animpiece is usually equivalent to a role action. An animpiece includes:

 

1. A name, represented by a string ID 2. Key Frame information of the skeleton. For the storage format, see:

 

(It looks like a guitar, a good melody)

 

3. event information. An animpiece can contain multiple events. Each event has a name (string ID) and a time. this event will be triggered when the animation is played at this time, and the outside can respond to this event and do some things.

 

The content of bone animation data is not complicated, but the generation method is still a little troublesome.

 

The first is its export method. in this engine, we try to use only one step to generate resources. In other words, we try not to use multiple steps to create resources. the so-called multiple steps. For example, if we first export a bone animation with multiple actions from Max and there is a file, this is the first step; then, a skeleton animation editor reads the file, splits it into multiple animpiece in the editor, sets the event point for each animpiece, and compresses it, finally, it is saved as a bone animation resource. this is the second step. the downside is that once an animation of an action is modified, the two steps should be taken from the beginning, all the work we have done in the skeleton animation editor is done in white. of course, you can solve this problem in many ways. For example, you can write an editor that is powerful enough to import a single motion animation, and can replace the original animpiece animation data (without affecting other configuration information ). but this obviously increases the editor complexity. our solution is to directly move the editor to the maxversions and directly edit the data source. The editor features much simpler. in this way, we only need one step to generate the resources we need.

 

This is how we export bone animation resources.

 

We wrote a new Max object (in abone01) through the plug-in. This object is used to record various related information about the skeleton animation, this information can be stored together with the skeleton data. in the Max file. we can edit this information through the editing panel of Max. during resource export, the export plug-in processes the skeleton data based on the information to directly generate the final skeleton animation resource. save the information generated by the resource in a custom data format in the Max file. This simplifies the development of the editor and the process of exporting resources by art, I think it is a recommended method. in combination with the resource hot loading mechanism, we currently use our export plug-in. It takes only a few seconds for art to modify it in Max to see the effect in the map editor/game. this will make art more willing to make some minor adjustments to achieve more perfect results.

 

Another problem in generating skeleton animation resources is data compression. from the data storage method of animpiece above, you can know the compression method of the skeleton data. First, we will use a fixed frequency (currently 30 frames/second) sample the skeleton animation in Max. compress each bone as a track. (for example, if this bone animation has 40 bones, we have 40x3 tracks in total ). the compression method is normal linear compression (assume there are three keys, K0, K1, K2, they correspond to the time t0, T1, T2, we use T1 in K0, linear interpolation between K2 to get k1'. If the error between K1 and k1' is within the permitted range, K1 can be discarded ). in addition, we use a simplified storage method for the rotating data. A rotation is a quaternary element. After normalization, we use the short type to store its four components. this saves half of the memory.

 

The compression of bone animation has recently undergone a major change. The above describes the modified method. The previous method is as follows:

 

(This music almost)

 

We process all the skeleton data on the skeleton as a key (no matter how many bones there are, we only have three tracks: POS/rotation/scale ), the advantage of doing so is that when calculating the skeleton animation, We can greatly reduce the number of key searches. There are only three tracks, which means we only need to perform three binary searches, the modified method requires more queries. but the disadvantage is also obvious: the compression rate is too low. A key contains dozens of bones. It is difficult to meet the compression conditions at the same time, we can only compress the keys with less than 10% of the test data (10% or 10.

 

The following is a comparison of the two methods:

 

The testing environment is: 3500-frame skeleton animation, 30 frames/second, and 42 skeleton systems, divided into about 60 animpiece. the CPU is genuine Intel (r) 2140 @ 1.6 GHz, which ensures that the animation after compression is not obviously deformed.

 

Finally, we chose the current method. one thing to note is that the same animpiece bone data should be placed together in the memory as closely as possible without gaps, which can improve the performance of animation computing. I guess it is the impact of the memory cache hit rate.

 

During the specific compression, we also adjusted the compression precision of different parts of the bones. The closer the root of the bones, the stricter the error restriction, to avoid the movements, the skeleton at the end of the skeleton (such as the wrist and ankle) can be relaxed.

 

In addition, different animpiece can set different compression precision. Some actions may be insensitive to errors, so we can increase their compression ratio. of course, this requires art to be controlled, and no optimization is made in the above test.

 

This is basically the case for the skeleton animation. Next we will introduce the path animation.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.