Tutorial
Heading
Oct 20, 2023

How to animate for Decentraland

Making animations for Decentraland can be quick and relaxing or stressful if you don't follow a set of rules. With this document I will not only review those rules but also try to tell you some tricks to animate faster and more comfortably if you need a change in the future

The mission

The rules to follow to make animations in Decentraland are few and simple, but having order and doing it properly from the beginning is necessary to avoid problems later. We will start by reviewing those rules and then a couple of tricks when it comes to animating.

Resources

  • Maya 2019 or 2020
  • Unity
  • Blender

Rules for animating in Decentraland

SDK7 toolkit

All instructions in this documentation follow the rules of the SDK toolkit that will soon, in its version 7, be open for public use.

The main thing to keep in mind is the order. All animations must have as a general parent a mesh which is 0,0,0.

It must be at 0,0,0 from the beginning to avoid future positioning problems. If the COG has values, it can be a problem to restructure, reposition or change the animation quickly.

To avoid frame loss problems in non-looping animations you must:

  • 30 fps animations.
  • The last frame is repeated at least 5 frames later or even 10 frames later.
  • Animations should not be scaled 0,0,0 will give error so the value should be 0,001 ( In all cases, looping or non-looping animations ).

Hierarchy needed to export a bone animation to Decentraland
COG example

It is also necessary to keep the history clean, especially if the inputs modify the retopology directly. In principle for animations that do not have bones should not be a problem but it is better to have everything clean.

Dont's in animation inputs
Do's in animation inputs

If the animation has bones they must be children of the mesh (this is because our internal tools understand the hierarchy when it comes to exporting) that's why I insist that everything is at 0,0,0.

When relating more complex structures we will avoid problems. If you have had problems with the rig at the time of linking or exporting look at this documentation: Rigging a 3D character and solving common problems

Hierarchy needed to export a bone animation to Decentraland

In this animation I put as parent a triangle since the group contains several meshes for ease of weighting the rig.

The triangle is located in the 0,0,0,0 so when adding something in the grab or repositioning in space the animation will not give problems. It also follows the hierarchy order of having a mesh as the parent of everything.

Different ways to export an animation

There are several ways to make an animation play.

To export to .glb from Unity we will need external tools, for example Needle.

  1. The first and easiest way is to change the animation type to "legacy" and rename the animation clip.

Animation clips Unity screen
Unity animation type

Animation component created by setting the animation type in legacy

Setting the animation type in legacy creates an "animation" component that contains the animation clip, renaming it is important to be able to keep an order in case you need to search for that particular animation.

  1. Export to .glb and put it in the assets folder. This will save animation and materials. Code will be able to use this glb later. Again, care must be taken with the nomenclature to maintain order.
  2. Put several animation clips to create a state machine .Use the "Animator_PM" component and the animation type in generic, so that it does not generate an animation component.

Animation clips in Unity
Unity animation type

Most frequent errors and how to solve them

My animation is not in the place where I put it

There can be several problems but the main one is that you have a keyframe placed in the main COG, always keep this cog clean to avoid reading or positioning problems in Decentraland.

If this is the case simply delete it, if you cannot find the keyframe delete it by clicking on the values and breaking its connections.

Animation location error

If you still have the same problem try the animation alone in the scene and see if it is not another .glb or gltf causing the bug.

My animation is static

It can be caused by several problems.

If animation have not bones:

  • Hierarchy problem, they must always be children of a mesh.
  • Export problem, Decentraland does not understand stepped curves and scales to 0.
  • Inputs unacceptable with correct export, for them always delete the history (everything if you have no bones, if you have bones you must delete everything but the non-deformed).

If the animation has bones:

  • If we have been copying animations from one model to another we are likely to have problems reading the bind pose. You will get this error in the console "Unable to find the bind pose for ": / Group / Main / DeformationSystem". Use the DAG node current transform. This error will pop up when exporting from Maya and in some engines like Unreal, you should always read if you get an error in the console.

Fix DAG pose error

It is necessary to remove all bindposes and rebuild only one for the skeleton.

To remove all bindposes:

  • In outliner go to the Display and uncheck DAG objects only. Then in the search bar look for "bind" which should show every bindpose in the scene, delete them all.

Rebuild the bindpose:

  • Then select each joint of your skeleton.
  • In the MEL bar, in the lower left corner type "dagPose-s-bp" and hit enter.

That will rebuild your bindpose and should fix the problem. Bindposes sometimes lag when joining and unjoining meshes or adding things to an existing set of skin objects.

To understand more about rig inside maya see this documentation: Rigging a 3D character and solving common problems

  • Hierarchy problem, remember that it must be a child of a mesh, however unintuitive it may be.

My animation fps have moved and are being lost in Decentraland

It is not always something that happens if you have frames like this but, due to lag issues, they can be lost more easily so it is better not to have them.

If you are animating in Maya you may encounter this problem, having keys between two frames.

Sometimes it gives problems and sometimes it doesn't so I recommend that you always be careful with this.

To fix it easily you can drag it from the Graph Editor, otherwise you can reposition all the keys or halve the time from Edit>Scale.

Decentraland animation fps lost

As mentioned at the beginning of the document, it is always necessary to leave several keyframes at the end of the animations that do not form loops.

I have to restructure my animation but I can't put it on 0,0,0

Don't worry, if you have this problem it.

If the problem is with a rig with its bones already weighted and applied there is no problem.

Look at this documentation to understand more about rig and follow these steps:

  • First duplicate the skeleton and the mesh.
  • Unlock the positions and do freeze, in the bones delete the residual bind pose of the duplicate so that there are no dag pose problems.
  • Apply a bind skin to join mesh and bones, don't worry about weights, they can be copied from one to the other.
  • Select first the mesh with the correct weighting and then its copy with the freeze.
  • Skin > Mirror Skin weights.

Settings panel to copy skin weights

Example to copy the skin weights

I can't do loop rotations if my part is rotated

Just make a hierarchy of groups inside, the parents add the raw value to that of the children, without affecting their animation curves.

With this type of hierarchy you can handle more complex animations without breaking the animation curves.

Unity hierarchy example
Unity hierarchy example

Example of how to make the hierarchy

Passing animations from Maya >/< Blender

Passing files between Maya and Blender is simple but there are a couple of steps to keep in mind. You just have to be careful with:

  • For animations with bones and controls, the animation must be baked into the bones to be able to pass it cleanly.
  • Keeping a clean history.

To bake an animation you must go to the top left tab and change it to animation. Then go to "Key>Bake Simulation". According to your preference configure the console and apply it. It is not necessary to bake to ones, going to twos or threes should be enough.

Bake animation screen

Results in Decentraland

Result of the animation of interaction with an object in Decentraland
Result of character animation in Decentraland

Conclusion

Animating for Decentraland is simple, as long as you keep an order. There are more mistakes that come out as a result of several problems dragged by not having order, so I insist, you should always do things starting with a good base.

Blender
Decentraland
Maya
Isabel Cutanda
Animation Lead and Environment Artist

Passionate about 3D work since childhood, rigging as my main passion

Tutorial
How to import Decentraland SkyboxEditor into Unity
Tutorial
Doing a MANA transaction in a Decentraland scene
Tutorial
Canvas (2D UI) Manager in Decentraland