Help! Bones animation is freaking me out!!!

plz drwr I need the force of all your superpowers!

as you maybe have seen in the forum, me and my mate (basically me) are trying to put together a Blender egg exporter cos we aren’t satisfied plenty by the actual options. Unfortunately neither me nor my pal are 3d geeks but just honest byte hardworkers and, to put it simple, we are actually stucked badly on bone animations.
The problem, as we have guessed, is that Blender API expose the joint/bones rest pose in world coords and when it animate ‘em up it expose the bones in local coords, as a shift from the rest position, while Panda do not; Panda needs that bloody shifts in world coords.
If it is so (plz drwr tell us if we have seen good) then we are in trouble cos’ our 3D skills are too poor to solve this and unless Panda got some hidden feature that easily match what Blender offers, we need at least a little clue of what or where to find materials to understand how to solve this headhache.

Panda wants the bones to be expressed in local coordinates–each bone relative to its parent. So you might be all right. There were a couple of minor problems with the egg file that DrWiggly posted, which I responsed to.

David

aye drwr, im just coming from there and maybe maybe I’ve found something interesting:

im pretty sure that here I could say GOTCHA!
so my question is: how to specify offsets in the animation syntax?
I haven’t found that in the egg-structure manual!
by the way I’m using the Xfm$Anim_S$ form, as i.e.:




      <Table> Bone
      {
        <Xfm$Anim_S$> xform
        {
          <Scalar> fps { 24 }
          <Scalar> order { sphrt }

          <S$Anim> y
          {
            <V> { 0.000000 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000  }
          }

          <S$Anim> x
          {
            <V> { 0.000000 0.000000 -0.110300 -0.391933 -0.783307 -1.233760 -1.698848 -2.137050 -2.507117 -2.765556 -2.863801 -2.818460 -2.691646 -2.496503 -2.245418 -1.950183 -1.622141 -1.272309 -0.911504 -0.550451 -0.199896 0.129283 0.425958 0.678630 0.875295 1.003288 1.049115 1.034922 0.995702 0.936205 0.860853 0.773827 0.679130 0.580651 0.482220 0.387661 0.300847 0.225755 0.166523 0.127520  }
          }

          <S$Anim> z
          {
            <V> { 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000  }
          }
        }

      }

There a few gotchas with blender going into egg that I found. First is the fact that blender has the heirarchy


armature
  -> bones
  -> mesh

and egg’s want the heirarchy


mesh
  -> armature
       -> bones

so you have to transform a root joint (I called armature) by the inverse of the mesh object’s transform.

The second is, its not exactly easy to figure what animation data you should be looking at within a pose. I choose to save all the default positions of the bones in a dictionary, then while I’m going through the animation frames I look at the ‘quat’ value (which is the full rotation offset from the root) and the ‘loc’ value, then convert that to a matrix and apply it to the base matrix. I suppose you don’t have to save the base matrix transform because they’re always accessable, but I was having whacky blender bugs come up so I saved them so I would be sure they wern’t modified while going through poses.

Anyway you can look at mine if you want

wickwack.com/panda

the ref doc for eggs that I used was

panda3d.cvs.sourceforge.net/pand … iew=markup

By offset I mean the x, y, z translation, which you are already specifying in your pasted example.

David

hi DrWiggly
thank you for the hint but my (I should say ‘our’ cos I’ve a crazy friend that is helping me writing the exporter) concern is not the egg structure, that we’ve digested quite enough but rather the strange behaviour we got with joint translation that is turning us mad. And looks like we’we aint solved yet this issue so we need further posts to continue to talk about this. But now I go to bed that here is 01:00 o’clock and I’m quite tired.
By the way thanks for the link - go to this thread if you haven’t already seen, panda3d.org/forum/viewtopic.php?t=1557 to get our code
so we could share code and maybe headhaches by email either.
keep in touch!

i see… bonk!
(yet another headbutt to the wall)
thanks for the try

drwr, last question before to shoot myself in the head:

if I write in an egg file to translate a joint with the scalar <S$Anim> x, as shown in the code below, let say at the frame 3 of a value or, better, an offset of -0.110300, will that joint be pulled from the state as it founds in his rest position for that value along the ABSOLUTE x axis - as is referring to the { Z-Up } - or along the x direction related to his LOCAL coordinate system, as is Panda will convert his local coordinate X to the absolute -whatever- world coordinate? or whatever else happens to that joint???


<CoordinateSystem> { Z-Up }

[snip]...[/snip]

  <Bundle> Cube.obj
  {
    <Table> "<skeleton>"
    {

      <Table> Bone
      {
        <Xfm$Anim_S$> xform
        {
          <Scalar> fps { 24 }
          <Scalar> order { sphrt }

          <S$Anim> y
          {
            <V> { 0.000000 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000  }
          }

          <S$Anim> x
          {
            <V> { 0.000000 0.000000 -0.110300 -0.391933 -0.783307 -1.233760 -1.698848 -2.137050 -2.507117 -2.765556 -2.863801 -2.818460 -2.691646 -2.496503 -2.245418 -1.950183 -1.622141 -1.272309 -0.911504 -0.550451 -0.199896 0.129283 0.425958 0.678630 0.875295 1.003288 1.049115 1.034922 0.995702 0.936205 0.860853 0.773827 0.679130 0.580651 0.482220 0.387661 0.300847 0.225755 0.166523 0.127520  }
          }

          <S$Anim> z
          {
            <V> { 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000 -0.000000  }
          }
        }

      }
    }

Hi there,
I’m not sure if it will help or confuse you more. So if it confuse, please ignore this post before shooting me.
I’ve used drWiggly translator and everything was good except the fact that bones hasn’t their VertexRef defined. So maybe source of drWiggly’s translator could help? In fact I didn’t test too much, just wing with aileron, but it worked good. Aileron was rotating round point I asked it in bledner. When I used the other panda exporter it was rotating round the median point of wing.

As usual I want to use code written by others just as a last resort - but don’t get me wrong, I don’t do this for overconfidence but to try to understand by myself what I’m doing and in the specific case how 3d works from inside, pretty new argument for me - but be sure that if I will continue to stay stuck another couple of days, surely I’ll watch it and snatch all I can! :wink:

I’m having a bit of difficulty parsing the question, but in general, each joint’s transform is expressed locally to that joint. So an X axis translation is really a translation along that joint’s X axis–it is not necessarily the same as the global X axis, especially if the joint’s parent has a rotation.

David

Each set of joint animation information is basiclly a transform for that joint. That information is directly set as the local transform for that joint in panda, no adding or anything is being done with the previous frame of information.

Blender gives you lots of different animation information; poseMatrix is sightly different then “quat” and “loc”, and localMatrix is different again. Panda will want the “localTransform” for that joint (which is relative to the parent joint) for each frame. There are many methods to figure out the bones’ local transform, I played with data until I found a method that gave me what was needed.

that is precicsely what I was asking for David
but that is not the same behaviour that I got from my script. I’m sure that I’m doing wrong something really simple and really really stupid and that’s what driving me mad but I’m not actually able to get rid of it!!!
time to make holiday? :unamused:

aye DrWiggly, you’re certainly right and I’ll sure do watch out what you’ve done cos I can’t stand it no more with this …
just tellme: are you working with Blender 2.41 or 2.42?

I’ve seen your script DrWiggly and I got errors:


blender-bin:216: RuntimeWarning: tp_compare didn't return -1 or -2 for exception
  1
Traceback (most recent call last):
  File "<string>", line 252, in gui
  File "<string>", line 216, in buildExportables
  File "<string>", line 1109, in doExport
  File "<string>", line 514, in End
  File "<string>", line 592, in WriteMeshes
  File "<string>", line 607, in write_AnimBundle
  File "<string>", line 629, in write_AnimBones
AttributeError: evaluatePose

and this make me guess that you are working with Blender 2.42 or worst that I’m working with a buggy version (I kill myself if is true)
but there is more: you do not use IPO animation! and my issues concern just IPOcurve action animation so I am to a dead end again!!! :open_mouth:
ok guys I go holyday - let’s see us after a good period of rest, sunbaths and…chicks! :wink:

bye!

I ran it on 2.41 and 2.42a, version 2.42 is buggy from what I was reading on the blender boards, so they release the “a” version to fix some stuff.

Yeah I’m not doing IPO animation. So you may be stuck there again :slight_smile:. Although from Panda’s scene editor movie they have something called motion paths you can setup from within their tool. It might be something I get around too. I probably need to find a good Blender IPO tutorial, to see what its all about.