Page 1 of 1

BVH import?

Posted: Fri Oct 14, 2016 10:12 pm
by neeters_guy
So as to not go off topic, I decided to start a new thread based on jahnocli's comment from this thread new to moho - some very general questions:
jahnocli wrote:neeters_guy mentioned that "...taking 3D data and mapping it onto 2D is a non-trivial task..." Well, I'm *sure* I've mentioned this before, but the interestingly-named Awesome Animator can do this, and the developer just seems to be 'some guy'. Maybe Smith Micro could buy his company and use the code? Or something?
So a little explanation. The "non-trivial" aspect was my paraphrase of the comment made by Lost Marble in 2004:
Lost Marble wrote:I think it would be really difficult to flatten the animation data like you describe. Moho is 2D, so the thinking is that you could just remove one dimension. However, as an artist, you usually want at least a little appearance of depth in a 2D cartoon drawing, otherwise it looks like a grade schooler's drawing.

Once you arrange a character's parts in a 2D plane to give the appearance of depth, I don't think there's an accurate mapping from a true 3D space to that 2D projection. For example, if a character is supposed to be partially turned away from the camera, you might position the further shoulder joint a little bit higher than the nearer one. But that's just an arbitrary position - there's no real notion of 3D there. Moho would have no way of knowing that you intended one arm to appear further from the camera, or whether the character's shoulders were at different heights.
Given that, I thought I'd give jahnocli's suggestion a go. I installed the trial of Awesome Animator (AA) and it does indeed have an import bvh option. I searched on google and found a bunch of free bvh files here: CMU Graphics Lab Motion Capture Database

For my test, I chose the smallest file, 08_10.bvh, a simple walk cycle. Here's a screenshot of Awesome Animator after import:


I then rendered it out and compared it against the animated clip from the CMU website. Here's a side-by-side comparison.


What do you think? I'll let you draw your own conclusion insofar as how well AA implements bvh import. Would this be a useful addition to Moho's feature set?

It occurs to me that since bvh is a text format, perhaps it can be implemented as a script?

Anyway, I hope this post helps illuminate the topic further.

Re: BVH import?

Posted: Sat Oct 15, 2016 5:46 pm
by jahnocli
Interesting. I have to declare a vested interest here! Obviously there are some compromises, but I think it would be very useful.

Re: BVH import?

Posted: Tue Oct 18, 2016 11:50 am
by chucky
I've been pretty keen on this idea for years, I've pleaded a case for this tech many times... I'll add my support to your suggestion here too..

Re: BVH import?

Posted: Tue Jan 17, 2017 12:52 pm
by SimplSam
A little New Years treat! BVH import and animation in Moho 12 (theoretically it should also work in AS 10/11).

I will post a more detailed HOWTO shortly - but here is a little teaser to keep you going ...

Re: BVH import?

Posted: Tue Jan 17, 2017 3:30 pm
by jahnocli
I LOVE YOU!!! Now that's what I call a teaser! And in a different universe I would want to marry you and have your babies!

Re: BVH import?

Posted: Tue Jan 17, 2017 3:46 pm
by chucky
iteque , you freakn genius!

I had to check this wasn't an April fools joke.

I knew this was possible, what a great thing you have done!

OK so it's not perfect yet , I see.
A couple of places aren't properly tracking/ the 2d bone length doesn't match, quite.

This is certainly a teaser and hopefully a start to some exciting possibilities.
Well done iteque, creature of the arcane ways.
Thankyou for sharing your mystical invention.

Oh side note:
I hadn't seen the lost marble quote about the impossibilities of this.
I found that quite strange, tracking 2d from 3d seems (in theory) as simple as the process of rendering. If the picture plane can see the 3d object as a 2d translation then sure mapping bones position back from the picture plane into a 2d scene would be just the reverse of the 3d render?
I really know nothing about these processes other than what my eyes see and my own brain does when I draw from a 3d object. If my amoebic brain can do it then sure moho can.
I'd love to know how you have done this.
I guess the bvh part is just ( in a manner of speaking - it is certainly an achievement) extruded shapes rotating as per the bvh instructions.
The real magic here is how you go the 2d rig to puppet from the 3d.

C'mon give us a taste, eh? 8) :D

Re: BVH import?

Posted: Wed Jan 18, 2017 5:17 am
by DK
Wa wa wa WA? :shock:


Re: BVH import?

Posted: Wed Jan 18, 2017 6:08 pm
by SimplSam
Thanks for the thumbs up's...

A simplified summary of what's going on:

- Load BVH file into memory
- Capture Frame count/rate and set Moho Frame rate
- Draw 2D Bones T-Pose (Frame 0) - using regular Moho bones
- Draw 3D Bones T-Pose (Frame 0) - using extruded Vectors (each bone has its own layer **)
- Frame-by-Frame Animate the 3D Bone group layers using X,Y,Z Translation of root bone and X,Y,Z Rotation of non-root bones
- Frame-by-Frame Animate the 2D Bones using X,Y,Z Translation of root bone and Z Rotation of non-root bones

** Each 3D bone layer is parented by a Group layer, which also parents any child bone group layers. The Translations or Rotations are applied to the parenting Group Layer. In this way the movements of a Parent bone automatically affect the Child bones, and Child bones (layers) only need to move relative to their parent - in a similar fashion to Moho 2D bones. The Root bone is normally a central hip bone or similar. The 2D and 3D bones have no real relation - other than the 'final' z-rotaional value of the 3D bone (after XYZ rotations) is used to set the z-rotation of its 2D sibling.

3D Bone layer example:

Code: Select all

	{> LeftUprArm Group layer <}
	  (LeftUprArm Vector draw layer) 

	    {> LeftLwrArm Group layer <}
	      (LeftLwrArm Vector draw layer)

	        {> LeftHand Group layer <}
	          (LeftHand Vector draw layer)

Re: BVH import?

Posted: Mon Apr 03, 2017 6:15 am
by SimplSam
I have created the "Official" v1.0 (#470402.02) release topic, notes & video at: viewtopic.php?f=12&t=30778