Cloth and Panda3D

Moderator: BenChang

Cloth and Panda3D

Postby fandubbed » Thu Oct 18, 2012 9:24 pm

What is the most effective way to simulate cloth in Panda3D? Can nCloth properties be transferred into the engine :?:
fandubbed
 
Posts: 3
Joined: Mon Sep 10, 2012 6:07 pm

Re: Cloth and Panda3D

Postby BenChang » Sat Oct 20, 2012 1:49 pm

No, nCloth generally won't transfer into realtime engines; AFAIK there aren't any. My guess is that the simulation approach one would use for realtime would be different enough from what nCloth does for rendered that it would be hard to make them behave the same.

There are a number of ways you can approach this in Panda, depending on what you're trying to do. the key question is whether the soft object needs to be dynamic (influenced directly by forces at runtime) or if it can be canned (deformation and motion is pre-rendered)

1. if you want a full soft-body cloth simulation, try Bullet. Look in the manual and check out the soft body cloth and rope sample programs. Be aware that there is a performance cost, as with any high-end physics, so use this if it's a core part of your gameplay, like if you're making a physics platformer or physics puzzle game.

2. for some simple cloth applications, such as a flag waving in the wind, you can accomplish this with a simplified mass+spring simulation. There's a good O'Reilly book called, I think, "Physics for Game Programmers" or something like that in the library with an excellent chapter on how to do this. The simulation code is quite straightforward, as long as you're not worried too much about collisions - the tricky decision is in linking it to the visual model. You can generate the mesh from scratch, and then animated the verts. Or, you can populate the mesh with a grid of unconnected joints in Maya, smooth bind to them, get access to the joints in panda and then drive their positions with the output of the simulation.

3. for clothes, the easiest thing is to have the deformation of the clothing be part of the character animation. you can do that with bones by adding extra joint chains along the clothing. for a cape, for example, you could create a joint chain off off the top of the spine, bind the cape to it, and then animate it appropriately just by joint rotation for each animation of your character. this will usually get you better results than dyamics anyway because you can really control the use of animation principles to give the cape character.

4. you can also use blendshapes. start with nCloth, get it into rest pose, duplicate it. run the ncloth sim, duplicating the mesh at other key points. make a blendshape with your first duplicate as the base mesh and the others as blends. animate the blends as normal; they should output to panda just like joint-based animation.
User avatar
BenChang
 
Posts: 176
Joined: Mon Jan 17, 2011 4:48 pm

Re: Cloth and Panda3D

Postby fandubbed » Sat Oct 20, 2012 2:02 pm

Thank you very much
fandubbed
 
Posts: 3
Joined: Mon Sep 10, 2012 6:07 pm


Return to Art and Animation

Who is online

Users browsing this forum: No registered users and 1 guest

cron