adam0101
adam0101

Reputation: 31055

Getting animation to render correctly with Three.js ObjectLoader

I'm trying to render an animation in Three.js using a mesh from MakeHuman. The mesh loads correctly, but gets very distorted when the animation runs. If I add a SkeletonHelper, I can see that the skeleton does the animation correctly, however it's orientation is different than the mesh.

When the mesh loads it is face-down and the skeleton is right-side-up. If I rotate the mesh in Three.js so it is right-side-up, then the skeleton goes up-side-down for some reason. I'm not sure if this is maybe contributing to the mesh distortion.

Here's the steps I'm taking:

  1. Make a mesh in MakeHuman.
  2. Export as a Collada *.dae file.
  3. Import into Blender.
  4. Retarget to a BVH mocap file using the MakeWalk Blender add-on.
    • If I play the animation in Blender at this point, it looks perfect.
  5. Because multiple sites say this fixed their problems, I clear any location, rotation, or scale on the mesh and armature.
  6. Export the whole scene using the Three.js exporter for Blender.
  7. Load the scene and embedded animation using the ObjectLoader.

Any help would be much appreciated. Thanks.

Update - I was able to (briefly) get the model to mostly animate as expected (with just a little distortion) and the skeleton and mesh were both pointing in the same direction, but now I can't reproduce my success. I'm fairly certain that (in Blender) either clearing or applying the rotation, location, and scale is what made the difference, but when I try to run through the steps again, I can't get it to do it anymore. The skeleton and mesh are not in sync again. That has to be the problem, right?

I'm thinking I need to apply the rotation and location, but clear the scale. However, when I try to apply the location, the scale no longer appears "cleared". I guess I don't understand how Blender works. What is the proper way to clear or apply Rot,Loc,Scale? Do I apply/clear before or after retargeting to the BVH? Maybe both? Do I need to do that on each mesh and/or bone?

Upvotes: 1

Views: 886

Answers (1)

adam0101
adam0101

Reputation: 31055

So I figured out how to make it work, although I could never figure out why my previous method wasn't working.

As soon as you import the model into Blender (and all the meshes are selected by default) clear the rotation, location, and scale. Then, if the model is facing the wrong way, press 'n' to show the Transform panel, select the root mesh node in the Outliner, and rotate it as needed. Then, click ctrl+A to apply the rotation.

So basically, instead of keeping the rotation that was set during the import process, clear it and apply your own.

Upvotes: 0

Related Questions