Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Pages: 1 2 [3] 4

Author Topic: Anim8or Meshes put through Their Paces With BVH  (Read 22749 times)

Francesco

  • Full Member
  • ***
  • Posts: 182
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #30 on: December 13, 2008, 11:44:24 am »

Yes that's not a walk around the block, Lynn, but I like very much to take on challenges, even more if I'm really interested in the final result - which I am for sure. And welcome back! I think it's always a good day the new gear's day ;)

You're welcome Andrew, as I said above it's not a joke but it can be done. Just like you said, the most tricky part will be to manage all that amount of actual animation data, but I've got some ideas to work it out. I'm currently stuck on a crash due to a bug that is silly (I guess) and slippery (for sure).

Have good time people!
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1113
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #31 on: December 13, 2008, 02:45:52 pm »

Quote
Hiho,

Much obliged for the input and the link. I'll check it out! Always value your thoughts cause you have much better brains than me ..... Just think how smart you'll be when you get to my age!!

Be a Conehead when he gets to my age!!

I`d like to see a program that will use bvh files that would be excellent.
Logged
O

Francesco

  • Full Member
  • ***
  • Posts: 182
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #32 on: December 14, 2008, 03:52:21 pm »

Still a long way to go, but I think I have worked out most of the things I need to know to save the final .an8 converted file. Though, most of these things are still only in my mind - as for actual code, I've just fixed the bug I mentioned above, so far I only have the BVH loader complete.

More to come, as soon as I have something really working I will post it in a separate thread - thanks for hosting me in this topic so far Andrew ;)
« Last Edit: December 14, 2008, 03:54:53 pm by Francesco »
Logged

headwax

  • Sr. Member
  • ****
  • Posts: 600
    • View Profile
    • Headwax's Website
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #33 on: December 15, 2008, 10:48:58 am »

Kevin a Conehead :) ?

Francesco, thanks for doing that! It's sounds like a miracle :)

One request? Can we have an option to have the first frame as the default pose . IE with the bones set in the usual t-shape (or star shape) that a lot of figures are modelled in?

there is this program. http://davedub.co.uk/bvhacker/

I don't know if it is any help to you. But it gives you a choice of having frame 1 as the default pose. You might be able to tear it apart to see how it works ?????????

Cheerios



Random anim8or render :)

Logged

kreator

  • Hero Member
  • *****
  • Posts: 1113
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #34 on: December 15, 2008, 08:35:10 pm »

conehead.....
Logged
O

hihosilver

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1294
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #35 on: December 15, 2008, 09:51:43 pm »

Haha a conehead!?  I sure hope not...  might get in the way of my everyday activities.  Not to mention good look ;)
Francesco, that sounds great!  I love it when people take initiative like that and help people out.  Awesome.
I'm wondering headwax, do you have motion capture software/tools?  How do you create the BVH files?
Logged

Francesco

  • Full Member
  • ***
  • Posts: 182
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #36 on: December 16, 2008, 02:41:18 am »

Thank you all people for your interest, I hope to finish it as soon as possible.

Thank you Andrew for the pointer about BVHacker, it will be good to check out if I am doing everything correctly. About setting the figure object in t-pose or in *-pose, I'm still far from having completely worked out the BVH format, but nonetheless I have a small update, and I will do my best to implement your request.

So, I've completed the AN8 project export part and most of the data conversion.

To sum up, I can feed the program with the BVH file and get a AN8 project containing all the animation data, but I'm not yet done with the nodes->bones conversion to build the AN8 figure.

It is more tricky than I thought in a first time, but I'm working it out step by step.

I've added an option to resample the animation data scaling down the frame rate. As test file I am currently using a BVH file I got from Animazoo, the one with the Capoeira flying kick. It's a 900+ frames file sampled at 120fps, and I'm getting a AN8 file with a single bone (the hips) moving and rotating in scene mode, sampled at 30fps. That's not so much but you can guess the satisfaction I felt seeing this very first export working in Anim8or.

Some loudthinking now, just in case you guys have some good advice or pointer to give.

-------

The BVH file can store more than a skeleton at once, and each rootnode, unlike Anim8or's rootbones, is able to rotate and to translate in space. I have converted this concept by building a figure for each skeleton and by adding a motion track in scene mode for each figureelement (read this as "figure+sequence in scene mode").

Conceptually I am on firm ground here with the multiple-skeleton stuff, but I need a BVH file containing a multiple skeleton, in order to feed it both to my software and to BVHacker and check out if everything is running smooth. Can somebody provide me with such a file?

-------

About stripping out more of that large amount of animation data, apart from resampling it at a lighter framerate, I thought about computing out peaks and pauses for each joint motion, but it's a tricky thing for sure and I'll leave it for later, when the raw conversion will be complete and stable.

On the way to get there, I'll add another option to pick out a fixed amount of frames per second and set the keyframes with them.

-------

I'm making the program as a console executable, you will be able to drop "file.bvh" onto it and get a "file.bvh.an8" straight away, there will be also the option to change the conversion preferences via program arguments or by interacting with the program.

-------

More to come, wish you good time Anim8ing meanwhile ;)
Logged

headwax

  • Sr. Member
  • ****
  • Posts: 600
    • View Profile
    • Headwax's Website
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #37 on: December 16, 2008, 03:11:51 am »

Hiho, but imageine how fast you can swim in your lifesaving duties!

http://sites.google.com/a/cgspeed.com/cgspeed/motion-capture/cmu-bvh-conversion

No motion capture facilities! The motherlode of BVH files is above. Released by a university, or carnegie institute.

I've been using truespace to load them up then save them, so I can use them with Carrara. Truespace arranges them in a usable form, seems to filter them.

 Truespace is very powerful software, free, and an interface as bad as blender :)

Both truespace and carrara have non linear animation, so you can have the BVH file in one track, then make another track with the same skeleton, and override or blend or multiply the keyframes of the bones in the original BVH track with the new tracks- supposedly. You can cut and paste parts of the animation just like anim8r uses it's seequnces.

Francesco.!

Sounds like an amazing job you are doing.!!!!!!!!!!!!!!!!!!!

I haven't seen any bvh files with more than one skeleton yet. Check that link I posted above.- there might be one I have missed.

I've been translating the above bvh files through Truespace, so if you want help on that let me know.

In addition, I've been rendering at 12 frames a second which seems to give good smooth movement.

Have you seen the framerate changer available for anim8or?

That could come in handy somewhere.

cheers again, thanks for the amazing work

Logged

hihosilver

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1294
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #38 on: December 16, 2008, 11:33:42 pm »

Haha!  Perfect aerodynamics there!
Oh wow, I just took a look at one of the subcategories and just in one there is a ridiculous amount of different files!  That really is the motherload.
Ahh, blending animations, I believe 3ds max has that feature now, seems nice.
That could be something fun to look into.  Heck, I could even probably use those as references to learn realistic animation!
Logged

Francesco

  • Full Member
  • ***
  • Posts: 182
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #39 on: December 19, 2008, 07:09:37 pm »

Another small update.

Maybe it is all only working in my mind, or maybe I'm just a single step away from having a working solution.

Sorry if I get into technical details, but the problem I'm stuck on is pretty technical.

The concept a BVH file relies on is:
- a hierarchy of joints whose distances are stored as relative XYZ offsets
- each joint starts as "non rotated"
- each frame rotates each joint by a certain roll, pitch and yaw angles

Now to get this into anim8or I could either:
- go with the best, longer way of converting each joint to a bone and recompute all the motion angles, frame by frame;
- go with the work-it-around, shorter way of recreating non-rotated joints with zero-length rotating bones, interleaving them with fixed bones to represent offsets, and direct-stream copy the RPY angles from BVH motion into AN8 sequence;

I took the workaround way, and as I said above, I miss one single step to close the process.

The thing I miss is converting joint offsets to quaternion orientation, in order to set it into the figure section, inside of the an8 project. Or better, I have a chunk of code for that, but the quaternions I'm getting seem to be wrong, when I feed them to anim8or.

To have an example of the final result, take a look to the bvh and an8 files attached, they show the same skeleton and the same animation in both programs (bvhacker and anim8or), but the orientation of the anim8or bones is the result of manual editing - hence the name, "desired result.an8".

This is the code I'm using to convert XYZ offsets to RPY angles, which get then converted to a quaternion. Anyone has enough trig and quat knowledge to tell me what's going wrong with it?



/*
Radians(x, y) returns the angle between the positive X axis and the
line connecting origin and P(x,y).
This function work correctly, hence I'm not reporting it here
*/

/*
heading, attitude and bank are only other names for roll, pitch and yaw
I'm using this function as taken from
http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm
*/

quaternion RadRPYtoQuat(float heading, float attitude, float bank) {
  // Assuming the angles are in radians.
  float c1 = cos(heading/2);
  float s1 = sin(heading/2);
  float c2 = cos(attitude/2);
  float s2 = sin(attitude/2);
  float c3 = cos(bank/2);
  float s3 = sin(bank/2);
  float c1c2 = c1*c2;
  float s1s2 = s1*s2;
  quaternion result;
  result.w = c1c2*c3 - s1s2*s3;
  result.x = c1c2*s3 + s1s2*c3;
  result.y = s1*c2*c3 + c1*s2*s3;
  result.z = c1*s2*c3 - s1*c2*s3;
  return result;
}


point3 BoneRPY(point3 p) {
  float roll, pitch, yaw;
  yaw = -Radians(p.y, p.x);
  p.y = p.y * cos(yaw) - p.x * sin(yaw);
  roll = Radians(p.y, p.z);
  pitch = 0;
  return point3(roll, pitch, yaw);
}

int main() {

/*
  parse the BVH file, get nodes and so on
  then:
*/

  point3 p = BVH_Node.Offset;
  p = BoneRPY(p);
  quaternion q = RadRPYtoQuat(p.x, p.y, p.z);
  AN8_Bone.orientation = q;

/*
  store bone into figure hierarchy, print out the an8 file and so on
  end of the story
*/

}


The BoneRPY() function is the part I'm not sure about. In my mind, I'm getting the yaw from a mere projection, I'm rotating a coordinate to avoid angle misrepresenting and I'm getting roll. Two euler's angles should be enough to get every possible orientation, isn't it?

I feel lost, really, hope somebody could help me sorting this out.

PS: rename "test.bvh.txt" removing the ".txt" part, I've added it to let the forum accept it as attachment. It's a trivial issue, just matter of clarity.


[Edit: Anim8or expects quaternions to be stored in xyzw order, am I right? It seems to be so, but I ask to be sure]
« Last Edit: December 19, 2008, 07:17:22 pm by Francesco »
Logged

headwax

  • Sr. Member
  • ****
  • Posts: 600
    • View Profile
    • Headwax's Website
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #40 on: December 20, 2008, 03:18:16 am »

Hi ho, it's very interesting looking at how the bvh files make bits of the character moves - eg unexpected movements like head jerks because of inertia when the body changes direction in a dance move . Of course as expert anim8ors  we all would expect that :(

Francesco, it lookd like you are coming along in leaps and bounds and leaps and bounds and LEAPS and bounds :)

Unfortunately I can't help in the maths, as the modst I ever inderstood about scripts is how to turn the traffic lights off in Leslie's tutorials :(.

Uggh. Last time I did maths at uni I got 49 out of fifty for first semester and 2 out of fifty for second semester ( I went surfing :)  in second semester)

But I am eagerly awaiting your discoveries.

Thanks for all the hard work.
Logged

Francesco

  • Full Member
  • ***
  • Posts: 182
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #41 on: December 20, 2008, 07:11:57 pm »

You're welcome Andrew, I hope to sort things out asap.

Crossing fingers ;)
Logged

Francesco

  • Full Member
  • ***
  • Posts: 182
    • View Profile
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #42 on: December 21, 2008, 12:33:25 pm »

I was definitely lost in a glass of water.

So far, the only problem about the code I pasted above is about the eulers to quaternion function, which exchanges roll with pitch or something like this - at least is seems to be so.

So, the basis pose seems to be worked out. I'm attaching a picture that shows the basic pose of a BVH file (I guess that this pose isn't OK for easy skinning). Adding the starting t-pose as you requested is not done yet, Andrew.

After having fixed the skeleton conversion, I realised that the motion angles cannot be fed to Anim8or in the raw way, because BVH and AN8 use different rotation orders.

Nonetheless, using the raw motion data I've made a simple render showing the hooker walk taken from Animazoo.com

As you can notice, most of the animation goes fine, but the lower section of both legs bends to weird angles (more the motion, more the error when feeding erroneous rotation order).

So, this is what my converter can do so far. As soon as I sort out the rotation order conversion I will share the executable.

The video inside of the zip file is an XviD, fyi.

Enjoy!
Logged

headwax

  • Sr. Member
  • ****
  • Posts: 600
    • View Profile
    • Headwax's Website
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #43 on: December 21, 2008, 10:20:57 pm »

That's aabsolutely amazing Francesco !!!!!!!!!!!!



I think you have changed the face of anim8or!

Edit

I ran hooker walk through truspace then resaved it. Don't think it will make much difference. seems to have just changed the frame rate! Reason? Sometimes the bvh files act weird in parts regardless of the software. Truesoace tends to filter it somehow.
« Last Edit: December 22, 2008, 03:29:24 am by headwax »
Logged

kreator

  • Hero Member
  • *****
  • Posts: 1113
  • Anim8or, Blender, & Carrara. A Great Combination!
    • View Profile
    • Anim8orWorld
Re: Anim8or Meshes put through Their Paces With BVH
« Reply #44 on: December 22, 2008, 07:32:19 am »

Well what can I say ... This is just what Anim8or and Animators really need !!!!

I am extremely impressed Francesco!!  this addition like some of NickE`s scripts are opening more and more new doors for anim8or

I look forward to the finished result as I expect Andrew does as well!
Logged
O
Pages: 1 2 [3] 4