Jump to content
Sunbleached

Avatar animation along wrong axes

Recommended Posts

Posted (edited)

 Hello! I'm trying to create a character animation in a blender. but the rotation of the bones occurs along the wrong axes when uploaded. everything works fine in a blender. What can this be caused by?

ezgif-1-6c78ea3db342.gif.c354f950a1de3979beadc650b16ce689.gifezgif-1-e50fde9c695f.gif.2408657e3dbe8fea92cf5a0bb17ebb63.gif

Edited by Sunbleached

Share this post


Link to post
Share on other sites

I am also trying to figure out how to use Blender to create animations. Same problem: rotations about Blender's X axis become rotations about an avatar's Y axis, rotations about Blender's Y axis become rotations about an avatar's Z axis, and rotations about Blender's Z axis become rotations about an avatar's X axis.

To gain a deeper understanding of the process, I created a very minimalist two-frame animation. This animation uses only one joint (named "hip") which I rotated by 45 degrees about Blender's X axis in the second frame, then cleared all transforms in the first frame. The "hip" joint on the second frame, rotated 45 degrees about the X axis, looks like this:

SecondLife_hip001_blender.png.2a9e9fb66a488ad50fae19ba8f6ed09a.png

In the picture above, the red X axis arrow is invisible but should be pointing out of the screen. I then exported a BVH file from Blender, and here's what the BVH file looks like:

HIERARCHY
ROOT hip
{
	OFFSET 0.000000 0.000000 0.000000
	CHANNELS 6 Xposition Yposition Zposition Xrotation Yrotation Zrotation
	End Site
	{
		OFFSET 0.000000 0.000000 1.000000
	}
}
MOTION
Frames: 2
Frame Time: 0.041667
0.000000 0.000000 0.000000 -0.000000 0.000000 -0.000000 
0.000000 0.000000 0.000000 45.000005 0.000000 -0.000000 

(Yes, those 15 lines are the contents of the BVH file in its entirety.) I feel that it's important to note that the value of "Xrotation" for frame 2 corresponds precisely to the position of the 45 degree value in the last line, suggesting that Blender is working properly. There are also options to export channels in different order, but the rotation values in the BVH file always correspond correctly to frame data.

However, when I try to upload this file to Secondlife, here's what the preview looks like:

SecondLife_hip001_result.png.d7b530c99e015adb9b9c9f1e2160fb69.png

Everyone knows that the avatar's local X axis is the avatar's forward direction, the avatar's local Y axis is the avatar's leftward direction, and the avatar's local Z axis is the avatar's upward direction. So far, I have the impression that Secondlife's upload process transposes the order of coordinates for some reason. Unfortunately I can't find any documentation as to why, or more importantly, how it works and how to fix it.

If anyone would help us figure it out, I'd greatly appreciate it!

  • Thanks 1

Share this post


Link to post
Share on other sites
11 minutes ago, JackFelix551 said:

Everyone knows that the avatar's local X axis is the avatar's forward direction, the avatar's local Y axis is the avatar's leftward direction, and the avatar's local Z axis is the avatar's upward direction.

That's the rigging orientation, but for animation using a BVH file, the world coordinates differ, as well as the scale.

The animation configuration in a BVH file for SL wants the Z axis forward, Y axis up and X axis sideways. The avatar scale instead is intended to be in inches, for which in the exporter options on the left side panel, the scale should be changed from 1 (meter scale as in native blender) to 0.0254 (ratio between inches and meters). A long time ago, Blender's built in BVH exporter also provided a checkbox "Export fo SL" which apparently did the axis orientation convertion math when enabled (around 2011). Out of curiosity, i just checked the python file responsible for the bvh export, and it clearly mentions secondlife compatibility when listing bones so to not sort them so the order is respected. I also did a quick test and it defnitely works as intended.

Screenshot_28.png.3bc2a8d5457bc9ee2a6fc2f86df95d21.png

Reimporting the animation back to Blender, the character comes back in laying down in reverse in comparison to the bvh standards mentioned above, because of Blender's bone roll and orientation standards (inverted in comparison to the bvh standards by default), so that it works in SL

Screenshot_1.png.be2de7ecf80bc832d0c39debdc22e3f7.png

Therefore, looking at your picture, the roation that you were axpecting to be side-to side is, instead, correctly interpreted as back to front bow type of motion.

You will need to make an animation scene in which you adjust the orientation back to the blender's default standard, because for rigging (if you're not using avastar) the orientation is the one you correctly mention in your post. 

 

Hope this helps :)

 

  • Thanks 3

Share this post


Link to post
Share on other sites
2 hours ago, OptimoMaximo said:

That's the rigging orientation, but for animation using a BVH file, the world coordinates differ, as well as the scale.

The animation configuration in a BVH file for SL wants the Z axis forward, Y axis up and X axis sideways. The avatar scale instead is intended to be in inches, for which in the exporter options on the left side panel, the scale should be changed from 1 (meter scale as in native blender) to 0.0254 (ratio between inches and meters). A long time ago, Blender's built in BVH exporter also provided a checkbox "Export fo SL" which apparently did the axis orientation convertion math when enabled (around 2011). Out of curiosity, i just checked the python file responsible for the bvh export, and it clearly mentions secondlife compatibility when listing bones so to not sort them so the order is respected. I also did a quick test and it defnitely works as intended.

 

Reimporting the animation back to Blender, the character comes back in laying down in reverse in comparison to the bvh standards mentioned above, because of Blender's bone roll and orientation standards (inverted in comparison to the bvh standards by default), so that it works in SL

 

Therefore, looking at your picture, the roation that you were axpecting to be side-to side is, instead, correctly interpreted as back to front bow type of motion.

You will need to make an animation scene in which you adjust the orientation back to the blender's default standard, because for rigging (if you're not using avastar) the orientation is the one you correctly mention in your post. 

 

Hope this helps :)

 

Got it to work! Thank you so much!

  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...