Friday, November 20, 2009

The BitSquid low level animation system

In the BitSquid engine we differ between the low level and the high level animation system. The low level system has a simple task: given animation data, find the bone poses at a time t. The high level system is responsible for blending animations, state machines, IK, etc.

Evaluation of animation data is a memory intensive task, so to maximize performance means:
  • Touch as little memory as possible (i.e., compress the animations as much as possible)
  • Touch memory in a cache friendly way (i.e., linearly)
In the BitSquid engine we do animation compression by curve fitting and data quantization.

There are a lot of different possible ways to do curve fitting. Since we are curve fitting for compression it doesn't really matter what method we use as long as (a) we can keep the error below a specified threshold, (b) the curve representation is small (good compression rate), (c) the curve is reasonably smooth and (d) it does not take too long to evaluate.

In the BitSquid engine we currently use a hermite spline with implicitly computed derivatives. I.e., we represent the curve with time and data points: (t_1, D_1), (t_2, D_2), ..., (t_n, D_n) and evaluate the curve at the time T in the interval t_i ... t_i+1, with t = (T - t_i) / (t_i+1 - t_i) by




This formulation gives pretty good compression rates, but I haven't investigate all the possible alternatives (there are a lot!). It is possible that you could achieve better rates with some other curve. An advantage of this formulation is that it only uses the original data points of the curve and scaling constants in the range 0-1, which makes it easy to understand  the effects of quantization.

To do the curve fitting we just check the error in all curve intervals, find the interval D_i D_i+1 with the largest error and split it in half by introducing a new data point at (t_i + t_i+1)/2. We repeat this until the error in all intervals is below a specified threshold value. Again, it is possible that more careful selection of split points could give slightly better compression rates, but we haven't bothered. Note also that we can support curve discontinuities by just inserting two different data points for the same time point.

Animation compression can be done either in local space or in global space. The advantage of keeping the animations in global space is that there is no error propagation through the bone hierarchy, which means that you can use larger error thresholds when compressing the animations. On the other hand, the movement of a bone in global space is typically more complicated. (For a closed fist on a moving arm, the fingers will have no movement in local space, but a lot of movement in global space.) Since a more complicated movement is harder to compress, it might be that the global representation is more expensive, even though you can use a higher threshold. (I haven't actually tried this and compared - so much to do, so little time.)

Also, if you are going to do any animation blending you will probably want to translate back to local space anyhow (unless you blend in global space). For this reason, the BitSquid engine does the compression in local space.

For Vector3 quantization we use 16 bits per component and the range -10 m to 10 m which gives a resolution of 0.3 mm.

For quaternions we use 2 bits to store the index of the largest component, then 10 bits each to store the value of the remaining three components. We use the knowledge that 1 = x^2 + y^2 + z^2 + w^2 to restore the largest component, so we don't actually have to store its value. Since we don't store the largest component we know that the remaining ones must be in the range (-1/sqrt(2), 1/sqrt(2)) (otherwise, one of them would be largest). So we use the 10 bits to quantize a value in that range, giving us a precision of 0.0014.

So, to summarize, that gives us 48 bits per Vector3 curve point and 32 bits per quaternion curve point, plus 16 bits for the time stamp. Now the only thing remaining is to package all these curve points for all the bones in a cache friendly way. This will be the topic of another blog post, since this one is already long enough.

31 comments:

  1. While compressing quaternions, you don't store the sign of the largest component. How do you cope with that?

    ReplyDelete
  2. The quaternions (x, y, z, w) and (-x, -y, -z, -w) represent the same rotation, so I flip the signs so that the largest component is always positive.

    ReplyDelete
  3. I might be thinking about this the wrong way, but is storing the index of the largest component really useful? To me it seems like you use 2 bits to gain log2(sqrt(2)^3) = 1.5 bits of precision?

    ReplyDelete
  4. Yes you could use arithmetic encoding to store x, y and z using 10.67 bits per component for the range -1, 1 and this would give you slightly better precision for these values.

    The problem comes when you want to reconstruct w using sqrt(1-x^2-y^2-z^2) because that function is numerically unstable for small w.

    Have a look at this graph:

    https://www.desmos.com/calculator/nfdbj0law4

    Below w=0.5 the error starts to become bigger than the error (0.001) in the input values and as we get closer to zero the error becomes a lot bigger (0.03).

    ReplyDelete
  5. From: Appvn Apk Download
    Aptoide Apk Download
    Thank you for sharing valuable information. Thanks for providing a great informatic blog

    ReplyDelete
  6. WOW! I Love it...
    and i thing thats good for you >>


    GOOD HEALTH Thank you!

    ReplyDelete
  7. Are you looking for an Islamabad call girl for an unplanned chance meeting? If you would prefer to have a one-night stand or pleasure with a Sexy lady, have a browse through our website.Islamabad call girl We would help you find the Top Call Girls for those who need an expressive, long-term affiliated partner. We never intend that you become a call Girl in Lahore free from such a bitter experience, and our promises to our clients compel us to take appropriate steps to eliminate these risks so that our client VIP High Class Demand from Escorts Lahore that they should never be deprived of these values they deserve

    ReplyDelete
  8. Are you looking for an Escorts in Karachi for an unplanned chance meeting? If you would prefer to have a one-night stand or pleasure with a Sexy lady, have a browse through our website. We would help you find the Top Call Girls for those who need an expressive, long-term affiliated partner. We never intend that you become a call Girl in Lahore free from such a bitter experience, and our promises to our clients compel us to take appropriate steps to eliminate these risks so that our client VIP High Class Demand from Escorts Lahore that they should never be deprived of these values they deserve Escorts in Karachi

    ReplyDelete
  9. I think this is one of the best blogs I've seen. In your article, you provide such valuable content. My latest post is about How to Get Better at Using a Mouse. Read the article Computer Mouse Tips and have a good reading experience.

    ReplyDelete
  10. The title of this blog post is something I've never heard of from blogs I've read. It's good to read your blog posts about the checklist for blogger containers. This is a real post I share with you where you can read MOUSE BUTTON DOESN'T WORK. Please refer to the article Fix The Mouse.

    ReplyDelete
  11. I did not seen this kin post when we are talking about digital marketing edible web tech is Best seo agency in amritsar and digital marketing in amritsar service provider in amritsar

    ReplyDelete
  12. For a digital business, a good website serves as a platform to sell products and services across the world and therefore achieve the business goals. It is necessary to know the basics of an adequate website through experienced website developers. Caneplus Technology is one of the leading digital marketing companies in India providing high-quality website development service in Noida, India.

    website development services

    ReplyDelete
  13. If you accomplish to have the duration to author a report and there are no Custom Software Engineering Services, composing essays keeps the day. I appreciate how the method prevents multifarious databases. help with florida assignment is a skilled online 'Custom Software Engineering Services' assistance committed to helping high academy and institute investigators. Gratitude to our educational script.

    ReplyDelete
  14. There are many ways to revise the online quran classes. Many people follow a practice of revising three Juz each day. One method is to review the first Juz of the day after Fajr, the second Juz after Asr, and the third Juz after Isha'. While this method works well for many people, it may not be the most effective method. Regardless of what method you choose, remember that the most important key to learning the Quran is self-dedication and great motivation.

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. The BitSquid low-level animation system is a proprietary animation system created by the now-defunct video game development studio BitSquid. The system was designed to provide a high level of control and efficiency for animating characters and objects in real-time.

    The BitSquid animation system was based on a data-driven architecture, which allowed developers to separate the animation logic from the underlying code. This meant that animators could focus on creating animations without needing to worry about the technical details of how those animations would be implemented in the game engine.

    The system also featured a high-performance runtime that could handle complex animation blends and transitions with minimal CPU overhead. Additionally, it included tools for creating procedural animations, which allowed for more natural and dynamic movement in game characters.

    The BitSquid animation system was used in several high-profile video game titles, including the critically acclaimed game "How long is the LSAT – A Must-Read for pre-law Students"! However, BitSquid was acquired by Autodesk in 2014, and the technology behind the system was subsequently integrated into Autodesk's Stingray game engine.

    ReplyDelete
  18. I think this is one of the best blogs I've seen. In your article, you provide such valuable content. My latest post is about How to Get job confidently . Read the article Interview tips and have a good reading experience.

    ReplyDelete
  19. I'm glad for your great blog. Myfirstoys specializes in childrens bikes toys that are designed to provide fun and learning experiences. Their wide range of bikes includes models suitable for different ages and skill levels. With durable construction, vibrant colors, and safety features, Myfirstoys offers high-quality bikes that promote physical activity and motor skill development in children.

    ReplyDelete
  20. The fragrance collection in Pakistan boasts a diverse array, catering to various preferences, from the crisp invigoration of body sprays to the sophisticated allure of men's body sprays and the timeless elegance of perfumes.
    perfumes in Pakistan!

    ReplyDelete