POV-Ray : Newsgroups : povray.advanced-users : Spring-Algorithm Server Time
29 Jul 2024 10:27:17 EDT (-0400)
  Spring-Algorithm (Message 1 to 10 of 12)  
Goto Latest 10 Messages Next 2 Messages >>>
From: Tim Nikias
Subject: Spring-Algorithm
Date: 6 Sep 2002 12:18:27
Message: <3d78d553$1@news.povray.org>
I've been trying to implement Hugo Elias' Springs
for cloth in order to create some strings (to finally
script some hair), but the algorithm somehow does
not work.

AFAIK some have already implemented the algorithm,
so if anyone could give me their code for me to look at
(Only the spring one, everything else need not be bothered
about), I'd be grateful...

Regards,

Tim

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde


Post a reply to this message

From: Christoph Hormann
Subject: Re: Spring-Algorithm
Date: 6 Sep 2002 12:29:57
Message: <3D78D805.165C42FC@gmx.de>
Tim Nikias wrote:
> 
> I've been trying to implement Hugo Elias' Springs
> for cloth in order to create some strings (to finally
> script some hair), but the algorithm somehow does
> not work.

IIRC clothray is based on this description so you can be sure it works. 
Having a look at the clothray source might help.

> AFAIK some have already implemented the algorithm,
> so if anyone could give me their code for me to look at
> (Only the spring one, everything else need not be bothered
> about), I'd be grateful...

A (linear) spring is really simple, the force is proportional to the
extension from the standard length.  In 3D:

#declare Dist=Pos_End-Pos_Start;
#declare Force=vnormalize(Dist)*(vlength(Dist)-Zero_Length)*c_spring;


Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Tim Nikias
Subject: Re: Spring-Algorithm
Date: 7 Sep 2002 04:22:24
Message: <3d79b740$1@news.povray.org>
When using the string-system described on
Hugo Elias' pages, my string gets very instable, wiggling
about at all kinds of sections...

Do I need to have that low a moving distance and
that high iteration? And isn't mass-speed lost
with more iterations?

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde


Post a reply to this message

From: Christoph Hormann
Subject: Re: Spring-Algorithm
Date: 7 Sep 2002 04:59:57
Message: <3D79C00D.23172B24@gmx.de>
Tim Nikias wrote:
> 
> When using the string-system described on
> Hugo Elias' pages, my string gets very instable, wiggling
> about at all kinds of sections...

Isn't that what springs and masses are supposed to do?  If you don't want
oscillation you need damping.

> Do I need to have that low a moving distance and
> that high iteration? And isn't mass-speed lost
> with more iterations?

That sounds very confused, could you rephrase your question?

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Tim Nikias
Subject: Re: Spring-Algorithm
Date: 7 Sep 2002 21:17:48
Message: <3d7aa53c@news.povray.org>
> > Do I need to have that low a moving distance and
> > that high iteration? And isn't mass-speed lost
> > with more iterations?
>
> That sounds very confused, could you rephrase your question?

I want to avoid heavy oscillation, but still have a string swing nicely
back and forth. Right now, by strings either oscillate violently and
swing back and forth, or they move smoothly, but come to an almost
complete stop when settling to a hanging-state.

The more iterations I take (and moving the nodes much less per
iteration), the smoother everything moves, but the less swinging I get.

Swinging isn't too bad, cause I want to calculate hair for stills anyway,
but I'd like to try some more stuff with springs, and thus, I need
some more insight...

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde


Post a reply to this message

From: Peter Popov
Subject: Re: Spring-Algorithm
Date: 8 Sep 2002 05:05:45
Message: <m83mnugdra9n0tons0lontlmr2jf9sg5ri@4ax.com>
On Sat, 7 Sep 2002 10:23:49 +0200, "Tim Nikias" <tim### [at] gmxde>
wrote:

>When using the string-system described on
>Hugo Elias' pages, my string gets very instable, wiggling
>about at all kinds of sections...

That's a typical result of integration instability of stiff
differential equations. There are three ways to avoid this:

1. Loose the equations, i.e. use softer springs
2. Increase integration precision, i.e. decrease the integration step
3. Improve precision, i.e. use a higher-order integration technique
(Adams, Runge-Kutta etc. or even implicit Euler)

>Do I need to have that low a moving distance and
>that high iteration?

To put it shortly, yes. If you are ready to dig into some math and
physics, I can point you to some more complex answers :)

>And isn't mass-speed lost with more iterations?

If you mean linear momentum (the product of mass and velocity, as a
vector), well, yes of course it is lost in the process... after all,
there *are* external forces at work, non-conservative at that,
otherwise your system would oscillate for ever.

There's a catch related to damping and integration step. You will
notice that if you reduce the integration step 10 times, for example,
the damping seems to increase dramatically. That's a pretty obvious
reason to that - you do apply damping (and that's a multiplication)
ten times more often :) So you have to reduce damping accordingly to
get the same (more or less) results.

There's quite a lot to say on the subject. If you need more info, be
prepared for a lot of reading - but it's so much fun! :))


Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Tim Nikias
Subject: Re: Spring-Algorithm
Date: 8 Sep 2002 06:51:40
Message: <3d7b2bbc$1@news.povray.org>
I like to read... :-)

Where are those links?

--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde

>
> There's quite a lot to say on the subject. If you need more info, be
> prepared for a lot of reading - but it's so much fun! :))
>


Post a reply to this message

From: Peter Popov
Subject: Re: Spring-Algorithm
Date: 8 Sep 2002 09:21:31
Message: <0mimnuc5ibgfeml5ps68fdnv38h73l2t7g@4ax.com>
On Sun, 8 Sep 2002 12:32:00 +0200, "Tim Nikias" <tim### [at] gmxde>
wrote:

>I like to read... :-)
>Where are those links?

I think all these documents are still available online, since this is
how I found them about a year and a half ago.

I think it was Demetri Terzopoulos who started it all back in the 80s,
since most early documents reference to his works. The math in there
is pretty tough but really easy at the same time, once you get past
the vocabulary.

David Baraff & Andrew Witkin, the Pixar simulation crew leaders & main
researchers, provide quite easily digestible material. Not on the
research-level, at least not for the public, but enough to give you a
very good start. Mr. Baraff still lurks c.g.r.r. and offers help in
his field - I was even honored to be contacted by him a couple of
years ago :) You can check out the research section on Pixar's site,
there might be newer material available.

Johan Jansson et. al are (or now were?) a group of MEng students in
Norway, I think, who were interested on deformable body dynamics and
had some quite interesting stuff to show. Johan contacted me
personally when I started gathering material for my BEng project, to
share some ideas etc. His atomic approach is quite interesting as,
though being a mass-spring model in its core, inherently provides for
collision and self-collision detection.

Xavier Provot is quite heavy on the cloth simulation scene, I even
think he ventures into strings themselves. Check for yourself whether
he has anything of interest here:
http://www-rocq.inria.fr/mirages/SYNTIM_OLD/recherche/provot/index-eng.html

<shameless plug>
Lastly, may I humbly suggest I sent you my BEng project? If your
computer chokes on Word, I can PDF it for you.
</shameless plug>

Note that most of these papers refer to 3D deformable bodies. Strings
are a special case where much optimization is possible, and hair is
quite an interesting case (as you have electrostatics there, as well).
You may find some interesting info online, especially if you look into
the making of Final Reality, if it is publicly available. If you can
get your hands on SIGGRAPH proceedings (I can't :( ), there's TONS of
information there, but what you should most be looking for are several
names: Terzopoulos + Metaxas, Baraff + Witkin, O'Brien, Provot

That much for now. Happy reading :)

	Baraff, D. and Witkin, A. Dynamic Simulation Of Nonpenetrating
Flexible Bodies. In Edwin E. Catmull, editor, Computer Graphics
(SIGGRAPH 92 Conference Proceedings), volume 26, pages 303-308, July
1992.

	Baraff, D. and Witkin, A.. Large Steps In Cloth Simulation. In
SIGGRAPH 98 Conference Proceedings, Annual Conference Series, pages
43-54. ACM SIGGRAPH, Addison Wesley, July 1998.

	Jansson, J., Vergeest, J. S. M Implementation And Analysis Of
A Mechanics Simulation Module For Use In A Conceptual Design System.
Proceedings of DETC00 2000 ASME International Design Engineering
Technical Conferences, September 10-13, 2000

	Jansson, J., Vergeest, J. S. M., A General Mechanics Model for
Systems of Deformable Solids. Proceedings International Symposium On
Tools and Methods for Concurrent Engineering 2000 (2000).

	Metaxas, D. and Terzopoulos, D. Dynamic deformation of solid
primitives with constraints. In Edwin E. Catmull, editor, Computer
Graphics (SIGGRAPH 92 Conference Proceedings), volume 26, pages
309-312, July 1992.

	O'Brien, J. F., Hodgins, J. K. Graphical Modeling and
Animation of Brittle Fracture. SIGGRAPH 99 Conference Proceedings,
137-146, 1999

	Terzopoulos, D. and Fleischer, K. Modeling Inelastic
Deformation: Viscoelasticity, Plasticity, Fracture. In Computer
Graphics (SIGGRAPH '88 Proceedings), volume 22, pages 269-278, August
1988.

	Terzopoulos, D., Platt, J., Barr, A., and Fleischer, K..
Elastically Deformable Models. In Maureen C. Stone, editor, Computer
Graphics (SIGGRAPH 87 Conference Proceedings), volume 21, pages
205-214, July 1987.

	Van Gelder, A. Approximate simulation of elastic membranes by
triangulated spring meshes. Journal of Graphics Tools, 3(2):21-41,
1998 

	Witkin, A., Gleicher, M., and Welch, W. Interactive Dynamics.
Computer Graphics, 24(2):11-22, March 1990.

Peter Popov ICQ : 15002700
Personal e-mail : pet### [at] vipbg
TAG      e-mail : pet### [at] tagpovrayorg


Post a reply to this message

From: Christoph Hormann
Subject: Re: Spring-Algorithm
Date: 8 Sep 2002 09:46:58
Message: <3D7B54D1.19F2616B@gmx.de>
Tim Nikias wrote:
> 
> I want to avoid heavy oscillation, but still have a string swing nicely
> back and forth. Right now, by strings either oscillate violently and
> swing back and forth, or they move smoothly, but come to an almost
> complete stop when settling to a hanging-state.
> 
> The more iterations I take (and moving the nodes much less per
> iteration), the smoother everything moves, but the less swinging I get.

This is clearly an indication that you have to use smaller integration
steps (unless there is some flaw in your code of course).  If the
integration step size is of the same order as the oscillation frequencies
of your system you are likely to get problems.  As Peter said you can
either weaken your springs or improve integration.

BTW, hair is a typical example of a very stiff system: low masses and very
low elasticity in longitudinal direction (and even worse at the same time
high bending elasticity).  On the other hand hair has very strong internal
damping which usually simplifies simulation.

Christoph

-- 
POV-Ray tutorials, IsoWood include,                 
TransSkin and more: http://www.tu-bs.de/~y0013390/  
Last updated 13 Aug. 2002 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Tim Nikias
Subject: Re: Spring-Algorithm
Date: 10 Sep 2002 14:12:25
Message: <3d7e3609@news.povray.org>
Thanks for the suggested search topics! Looks like
I've got to read A LOT! :-)

But I've been experimenting a little these days, and I've
found that using repulsion-systems to stay away from inter-
sections and springs to keep single hairs in a stable length
doesn't work too well (way too slow).

I thought about cooking an algorithm which at least takes
care that a hair is bent correctly and stays out of other,
simple objects. Hair-Hair-Interaction isn't a necessity.

Anyone got any good (and free) spring algorithms with
good explanations so that I know what to do to make them
"softer" / less rigid?


--
Tim Nikias
Homepage: http://www.digitaltwilight.de/no_lights/index.html
Email: Tim### [at] gmxde


Post a reply to this message

Goto Latest 10 Messages Next 2 Messages >>>

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