Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Natural Motion
PostPosted: Thu Sep 18, 2008 1:28 pm 
Offline

Joined: Fri Nov 02, 2007 7:08 am
Posts: 11
Okay, a long time ago I was trying to make a way to integrate cal3d and bullet to make a sort of naturalmotion-style effect, where a character will act out its animations but also be affected by physics. I implemented it using an algorithm found here: http://graphics.cs.williams.edu/papers/DynamoVGS06/

At first it was barely workable; the character would wobble and fall down and generally fail to look like a competent human being. But on their suggestion I fiddled with damping values, restoring forces, and a few other things and now it looks somewhat better. Still far from ideal, but close enough that the smaller issues are pretty visible.

You can download a poorly-hacked demo here:
http://www.mediafire.com/?sharekey=f273 ... b9a8902bda

Left-click to rotate the camera, right click to zoom in and out, and middle-click to 'grab' the model so you can move it around (like in the official bullet demos).

One problem is that the constraints on the fingertips don't seem to do much; you can see this if you try to move her around really fast. Her hands will look like they're being stretched to the floor. It's easy to see if you change to the physics view mode (click on the spanner-looking button in the bottom left) that it's as though her thumbs fell off. Why might this be?


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Thu Sep 18, 2008 6:21 pm 
Offline

Joined: Thu Nov 29, 2007 7:08 pm
Posts: 25
Hi Blairvoyant,

I tried downloading and running your app, but... "The application failed to initialize properly (0xc0150002)..."
Any ideas? Perhaps due to my glut version (3.7.6)?

Cheers,
Eddy


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Thu Sep 18, 2008 9:32 pm 
Offline

Joined: Fri Nov 02, 2007 7:08 am
Posts: 11
Seems likely; I have uploaded another .rar with the GLUT32.dll that I use...

I was getting the same error when I first tried running the app on this computer, but after re-compiling everything it worked...


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Fri Sep 19, 2008 8:55 am 
Offline

Joined: Sun Jan 07, 2007 4:29 pm
Posts: 48
Location: Oxford, England
Same error as before...


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Fri Sep 19, 2008 3:27 pm 
Offline

Joined: Fri Nov 02, 2007 7:08 am
Posts: 11
After some experimentation with a few other computers it seems that the solution is to install the visual C++ 2008 redistributable package. (it's just a few .dll's, 1.8mb)

http://www.microsoft.com/downloads/deta ... laylang=en

Also, here is the new version (compiled with /MT and without unnecessary debugging info)
http://www.mediafire.com/?sharekey=c0aa ... b9a8902bda


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Fri Sep 19, 2008 9:40 pm 
Offline

Joined: Thu Nov 29, 2007 7:08 pm
Posts: 25
Hi Blairvoyant,

That did it, it's working on my machine now.
Cool demo!
As for what the problem is... it's hard to say just from the results. (Although, are you really representing individual fingers as bodies? If so, wow.)

Cheers,
Eddy


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Sun Sep 21, 2008 5:14 am 
Offline

Joined: Fri Nov 02, 2007 7:08 am
Posts: 11
Well, my guess is that it's because I don't really understand how constraints work.

As it stands, it loads the model, and each vertex that has greater than a certain weight on a bone (50% at the moment) is added to a convex hull body. Then, a 6dof constraint is created at the joint in the bones, attaching the new body to its parent bone.

Code:
      btGeneric6DofConstraint* p2p = new btGeneric6DofConstraint(
         *(pBone->getbtbody()),                   // this bone's convex hull object
         *(pParent->getbtbody()),                // the parent bone's convex hull object
         corebonetransform.getIdentity(),       // the default transform of the bone according to cal3D
         parenttransform.inverse()*corebonetransform,   // the offset from the parent
         true);                               // don't process collisions between these two bones, otherwise the character will look like its joints are dislocated
      p2p->setAngularLowerLimit(btVector3(-SIMD_PI*0.25f,-SIMD_PI*0.25f,-SIMD_PI*0.25f)); // prevent the joints from bending unnaturally far
      p2p->setAngularUpperLimit(btVector3(SIMD_PI*0.25f,SIMD_PI*0.25f,SIMD_PI*0.25f));
      p2p->setLinearLowerLimit(btVector3(0,0,0));    // prevent the joints from sliding out of place
      p2p->setLinearUpperLimit(btVector3(0,0,0));
      m_vectorjoints.push_back(p2p);          // add the joint to the skeleton object, mostly for deletion purposes
      btWorld->addConstraint(p2p, true);       // add the joint to the bullet physics pipeline

So... what exactly does bullet do to enforce these constraints? Does it just move them iteratively? Apply forces? Do I need to set more parameters?


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Tue Sep 23, 2008 3:34 pm 
Offline

Joined: Thu Nov 29, 2007 7:08 pm
Posts: 25
Hmmmm.... that corebonetransform in the constructor looks fishy. (Based on the comment "the default transform of the bone according to cal3D".) What you want here is the transform to the constraint from the bone's origin (in the bone's space).

However, the first thing I would check is what's really happening to the rigid bodies to make sure you don't have a skinning problem. Can you show these without the mesh?

Cheers,
Eddy


Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Thu Sep 25, 2008 12:30 pm 
Offline

Joined: Fri Nov 02, 2007 7:08 am
Posts: 11
Yup. Just press the 'bone' button in the lower-right-hand corner of the window (see attached image.) The red dots in the middle of the platform show the 'target' bone positions, while the blue dots show the points from each convex hull rigidbody (independent of the graphical mesh.)

But hmm.. sorry, the comments were a little bit on-the-fly. The first argument (corebonetransform.getIdentity()) is just an identity transform ([1 0 0][0 1 0] [0 0 1] [0 0 0]) because the constraint is located at the origin of the child bone. The second argument (parenttransform.inverse() * corebonetransform) should in theory be the offset of the child bone's origin from the parent bone's origin; they are both defined in absolute terms, so the product should be a relative term. Maybe I messed up the math?


Attachments:
button.PNG
button.PNG [ 13.49 KiB | Viewed 4261 times ]
Top
 Profile  
 
 Post subject: Re: Natural Motion
PostPosted: Sat Nov 01, 2008 7:35 pm 
Offline

Joined: Tue Oct 17, 2006 7:22 am
Posts: 1
Location: Russia
Excuse me, but can you make demo - there a chracter walks on bumpy terrain or steps up on a slope?
or post sources, if you drop off this project and don't mind about?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group