POV-Ray : Newsgroups : povray.unofficial.patches : cloth simulation Server Time
1 Nov 2024 17:22:35 EDT (-0400)
  cloth simulation (Message 1 to 7 of 7)  
From: Jetlag
Subject: cloth simulation
Date: 22 Jul 2000 02:37:18
Message: <3979411e$1@news.povray.org>
I posted a cloth animation in p.b.a...

64^2 triangle mesh.
100 frames.
160 iterations per frame.
833s to generate.
277s to parse.
350s to render.

At first I wrote the code in pov, but it would have taken days to parse
anything useful.

So, I wrote a little program to generate cloth.

Then I added gravity.

Then I added sphere collision detection.

Things I haven't added yet, but would like to:

friction
mass
acceleration
velocity
cloth strength (ripping/tearing)
wind
triangle collision
smooth triangles
mesh2

I remember seeing 2 or 3 cloth simulations around. Is anyone else still
writing cloth code? Maybe we could share notes, my current algorithm is far
from being stable.


Post a reply to this message

From: Chris Huff
Subject: Re: cloth simulation
Date: 22 Jul 2000 19:38:05
Message: <chrishuff-E26F02.18384322072000@news.povray.org>
In article <3979411e$1@news.povray.org>, "Jetlag" 
<bga### [at] microsoftcom> wrote:

> I remember seeing 2 or 3 cloth simulations around. Is anyone else 
> still writing cloth code? Maybe we could share notes, my current 
> algorithm is far from being stable.

I know of 2 web pages on the subject:
Hugo Elias's page(look under "Mass & Spring models"):
http://freespace.virgin.net/hugo.elias/models/m_main.htm

Xavier Provot's page, with some techniques which can fix some of the 
problems with the method demonstrated on the page by Hugo Elias:
http://www-syntim.inria.fr/syntim/recherche/provot/index-eng.html

I am planning to do a POV patch which can do something like this, but 
generalized to work with strings and gels as well as fabric.

As far as the problems with your attempt...could you be more specific? 
Do you mean "unstable" as in it crashes, or does the simulation just 
become chaotic and go out of control?
Did you add a drag amount?

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Jetlag
Subject: Re: cloth simulation
Date: 22 Jul 2000 23:41:01
Message: <397a694d@news.povray.org>
> I know of 2 web pages on the subject:
> Hugo Elias's page(look under "Mass & Spring models"):
> http://freespace.virgin.net/hugo.elias/models/m_main.htm

That's the one I used.

> Xavier Provot's page, with some techniques which can fix some of the
> problems with the method demonstrated on the page by Hugo Elias:
> http://www-syntim.inria.fr/syntim/recherche/provot/index-eng.html

I got the texts but haven't reviewed them yet, the web site seems abandoned,
though.

> I am planning to do a POV patch which can do something like this, but
> generalized to work with strings and gels as well as fabric.
>
> As far as the problems with your attempt...could you be more specific?
> Do you mean "unstable" as in it crashes, or does the simulation just
> become chaotic and go out of control?

It becomes either chaotic or too stretchy, but sometimes both. There should
be a sweet-spot between the two, but if the gravity isn't very very small it
vanishes, the result turns out super-stretchy *and* chaotic.

On Elias's site some spring psuedo-code goes:

    ForceScaler = (Length - NormalLength) / (Length * Length) * SmallAmount

If I change the gravity, or the amount of particles, I need to change
SmallAmount, I think there's got to be a better formula. I also can't see a
logical reason to divide by Length twice, and I see SmallAmount as a kludge
anyway.  I'd like to create a model which works independant of the particle
count and gravity, where each could be changed without the end result
becoming unrealistic.

I think I need to do some research and come up with a better algorithm,
basically one that conserves energy and limits stretching to a minimum (or
none at all).

> Did you add a drag amount?

I'm not sure what you mean, like air-resistance? If so, then no. It's a very
limited model right now.


Post a reply to this message

From: Tony[B]
Subject: Re: cloth simulation
Date: 22 Jul 2000 23:52:36
Message: <397a6c04@news.povray.org>
> I think I need to do some research and come up with a better algorithm,
> basically one that conserves energy and limits stretching to a minimum (or
> none at all).

Just read the Provot papers. It's in there.


Post a reply to this message

From: Michael Langton
Subject: Re: cloth simulation
Date: 23 Jul 2000 07:15:24
Message: <usklns00aa1muei4lb0ndkaic1ejepftt2@4ax.com>
Hi,
>I remember seeing 2 or 3 cloth simulations around. Is anyone else still
>writing cloth code? Maybe we could share notes, my current algorithm is far
>from being stable.
I'm also working on cloth simulation, with external utilities written
in C++ (not pov-script, I found it way too slow).  I started off using
Hugo Elias' spring model, but, like you, found it very unstable in
terms of being *really* stretchy in unwanted places.  I have since
switched to using (basically) Xavier Provot's method (it's just the
standard physical model of springs, really) which lets me reduce
damping, and hence make the cloth look *much* more real/alive than it
did before (I posted to p.b.a a while back, and yours looks pretty
similar to that, though I haven't tried anything like that cool
rolling sphere...) - it's really surprising the difference a slightly
different spring model makes.  The gist of it is:
  force = (|dp| - normal_length)*normalise(dp)
(where dp is the vector between the two points connected by the
spring).
I currently have no friction in my model, nor detailed collision (just
planes and spheres, so far).  I do have mass, velocity, acceleration,
smooth triangles etc. (the smooth triangles have problems, but work
better than bezier patches, IME).
Currently I am working on a generalised cloth/gel/string system, which
will hopefully let me build entire models that move/bounce/interact
within their environment.  I have also been spending time trying to
make decent articulated structures (people) to wear all this cloth...

- Michael


Post a reply to this message

From: Chris Huff
Subject: Re: cloth simulation
Date: 23 Jul 2000 11:47:14
Message: <chrishuff-2429A4.10475223072000@news.povray.org>
In article <397a694d@news.povray.org>, "Jetlag" <bga### [at] microsoftcom> 
wrote:

> I got the texts but haven't reviewed them yet, the web site seems 
> abandoned, though.

I've poked through the papers, but haven't really tried to analyze them 
yet. I haven't been able to figure out exactly how their model is put 
together.


> I'm not sure what you mean, like air-resistance? If so, then no. It's 
> a very limited model right now.

Basically just a damping effect, which decreases velocities by a certain 
amount each step. The simplest way to do it would be to multiply the 
velocity by a certain variable amount...1 being no resistance, 0 being 
infinite resistance. Using a greater amount of damping(a smaller value) 
might help to keep the simulation stable. Similar to air resistance, but 
more simplistic.

One thing you might try to do is separate the passage of time from the 
number of iterations, so each iteration covers a specifiable amount of 
time. You could just increase the iterations while keeping the time 
constant to help make the simulation more stable.
The only disadvantage to this is speed, but it might be possible to use 
more iterations only in areas which need it, areas which are under a lot 
of stress or which are moving quickly relative to the neighboring areas.

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Geoff Wedig
Subject: Re: cloth simulation
Date: 25 Jul 2000 12:08:02
Message: <397dbb62@news.povray.org>
Jetlag <bga### [at] microsoftcom> wrote:

> I remember seeing 2 or 3 cloth simulations around. Is anyone else still
> writing cloth code? Maybe we could share notes, my current algorithm is far
> from being stable.

I've recently been working on cloth models, though I don't have much to
show.  I'm mainly interested in static pictures, and have found a couple
ways to avoid some of the problems that probably aren't generalizable.  My
code is currently in Python, but even that is too slow, so I'll be
converting to c++ in the near future.

One thing I do have is collision detection with cylinders (I was trying to
model clothing), but that's still *very* primitive.

Geoff


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.