We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexDiscussionExhibition › Cloth Simulation
Page Index Toggle Pages: 1
Cloth Simulation (Read 3965 times)
Cloth Simulation
Jun 10th, 2005, 3:54am
 
I made a cloth simulation using a spring mesh:

http://andrew.cmu.edu/~mwkaufma/cloth/

I'm fishing for comments/critiques of the kinematic simulation toolkit I'm making.  What other components are useful in simulations?  Does anyone have a good reference on doing:

Wind Forces?  Fluid Mechanics?  Rigid Bar/Torque mechanics?

I think in tandem with the AnimationController (read: keyframing engine) that I wrote and posted about earlier, this could make a very robust and interesting package.

--Max
Re: Cloth Simulation
Reply #1 - Jun 10th, 2005, 6:27pm
 
Pretty hawt.

What integration method did you use to calculate? Euler? Verlet? Runge-Kutta? Is the cloth handling internal collisions?

A REALLY sweet feature would be to automatically switch between these, sort of a intregrate(VERLET) syntax.

pretty sweet toolkit you got going there. I'm curious.. what is "abstract" when you write that before "class"?



Yes. Fluid sim would be very handy, like being able to define a box-range for a fluid field, then define the viscosity and such.

Looking at your code... every mass and force is registered to a Physics class and is updated thru it? Pretty good idea!

Torque would be extremely handy. As well as surface friction (non linear friction?)

Keep it up :] This is awesome.


PS: you're from carnegie mellon. do you know of a programmer named Eugene? He's korean, kinda chub (haven't seen him for like 6 years though...) and a very good GL programmer.
Re: Cloth Simulation
Reply #2 - Jun 10th, 2005, 6:33pm
 
One more thing.

What about a constructor for a force that takes 3D rotation vectors, such as quaternions? That way not all vectors have to be coordinates.. they can be defined from rotations as well.

ex:
Code:

vec1 = new vector(25,25,0);    
//define vector at 25,25,0
vec2 = new vector(vec1,30,45,0,100);
 //define vector as vec1, rotated 30 degrees left, 40 degrees up, no twist, 100 points magnitude
Re: Cloth Simulation
Reply #3 - Jun 10th, 2005, 9:35pm
 
(i) I just used simple euler integration, since it's quick and doesn't require two-steps to start.  Runge-Kutta's only second-order, so I don't think the improvement would be very much, since the time-step is processing's framerate.  Vertlet isn't so hot for kinematics in processing, because the framerate usually varies, and that messes things up.

(ii) Abstract classes are like partially implemented interfaces.  You can have a reference to an abstract class, but you can never instantiate one.  You can write constructors, however, and call them in it's descendents with "super" like in any other class.  I use it to define all methods and protocols common to any force (and avoid redundant coding).  This does require java to use it's type-checker, though, so it reduces performance.

(iii) So far my roomate tells me that fluid sims would require a node per pixel, which is kind of ridiculous at present.  I'm researching a better model at the E&S library right now with little success.

(iv) I want torque too, but I'm trying to think of how to implement it.  I think I need a Lever class that is represented by a static node and a dynamic node that rotates around it.  Then forces could either be defined on the whole bar or at a point, openning up the possibility of making spring loaded puppet arms with their spring properties key-framed Smiley

(v) Sorry, I don't know any Eugenes.  Pretty much everyone is a programmer here.

(vi) Quaternions would be easy.  I wanna hold off on last-minute gift ideas and flesh out the whole skeleton of the package first.

My ultimate goal is to have a kinematics package to work in tandem with my keyframing class (http://andrew.cmu.edu/~mwkaufma/gob2) and my obj loading class to make animating natural motion simple, and then make MEL bindings for Maya.
Re: Cloth Simulation
Reply #4 - Jun 11th, 2005, 3:26am
 
max wrote on Jun 10th, 2005, 9:35pm:
My ultimate goal is to have a kinematics package to work in tandem with my keyframing class (http://andrew.cmu.edu/~mwkaufma/gob2) and my obj loading class to make animating natural motion simple, and then make MEL bindings for Maya.

I like the original cloth applet. When you say you want the kimematics package to work with keyframing how do you intend that to work Would you be working outh things like cloth dynamics on the fly, or would they be pre calculated (so you could step back through them or jump straight ahead)
Re: Cloth Simulation
Reply #5 - Jun 12th, 2005, 6:00am
 
On the fly (though not necessarily in real-time).  I'm modelling an animated scene not as a series of images, but instead as a collection of parameters that change over time according to functions.  Programming kinematics moves much of the burden of defining those functions to the computer, so I have to key fewer parameters by hand, and let the rest react to my input, like a signal response.
Re: Cloth Simulation
Reply #6 - Jun 12th, 2005, 10:06am
 
If you've not seen this already I found it while researching processing libraries - its an animation controller class for an earlier version of Processing but quite a lot of work has already gone in to it.

It allows you to set custom draw methods which take % float value, e.g. at the time point 20% would be a 5th of the way into the animation and the method would return the x, y coordinate for that point in time.

See: (.java source available)
http://jim.jklabs.net/index.htm
Page Index Toggle Pages: 1