About animation optimization levels

Intermediate Optimization

When converting an animated model to BBMOD, you can choose an optimization level you would like to use for its animations. The higher the optimization level is, the less computation has to be done in GameMaker to find bones' final position, which is then passed to shaders. This also comes with restrictions of what you can do with the animations that use higher optimization levels.

Contents

Table of optimization levels

Level Transformations are stored in Transform bones in GML Attachments Transitions Shader-ready data
0 Parent-space
1 World-space
2 World-space and bone-space

Tip: Use argument --optimize-animations (-oa) in BBMOD CLI to configure the animation optimization level. E.g. ./BBMOD.exe Character.fbx -oa=1.

Level 0 (default)

When using level 0, bone transformations are in parent-space, which means that each bone's transform is relative to their parent bone. To retrieve the final position of such bone, we have to traverse all bones from the root to the current one and accumulate their transforms like so: offset * bone * (parent1 * ... * parentN) * root. The benefit of this is that transformations of individual bones can be modified on runtime in GML, which can be used for example for inverse kinematics. On the downside, for models with a lot of bones (or for a lot of models with just a few bones) this is a very expensive operation, which would have a negative effect on your game's performance.

This is the default setting, but you should choose it only for models which absolutely need to modify bone transformations in GML!

Level 1

When using level 1, bone transformations are in world-space, which means that a bone's parent transformation is already factored in. To retrieve the final position of such bone, all we have to do is multiply its transform with its offset: offset * bone. Compared to level 0, this saves a lot of computation. Since the bones are in world-space, their transformation can still be retrieved with get_node_transform and used for attachments.

If your model does not require inverse kinematics or similar techniques, this level is a great performance boost and a great choice for your game.

Level 2

When using level 2, bone transformations are stored in world-space and bone-space. Bone-space means that even bones' offsets are already factored in and the data is ready to be sent to shaders, without any additional computation required. Playback of animations with bone-space transforms available is super fast. One the downside, this optimization level requires more memory.

This level is the best choice for your game's performance, but it has the same limitations as level 1 and greater memory usage.

Which one to choose?

We have all heard that premature optimization is the root of all evil, so we suggest you choose the least restrictive optimization level you can use and start from there. I.e. if you know that you do not need inverse kinematics, just use level 1 for everything and later on, when your game is getting closer to release, if the fps are not high enough, think about which assets could use level 2. You can choose different levels for different assets and find the right configuration for your game as it develops.

Could not find what you were looking for?

We are still working on more tutorials. If you need additional help with BBMOD, please have a look at the documentation or join our Discord community. Thank you for your patience.