POV-Ray : Newsgroups : povray.general : Physics - collision detection etc Server Time
15 Oct 2026 23:18:05 EDT (-0400)
  Physics - collision detection etc (Message 1 to 18 of 18)  
From: Andy Cocker
Subject: Physics - collision detection etc
Date: 25 Jan 2001 15:37:34
Message: <3a708e8e@news.povray.org>
Is anybody actively working on equipping POV with collision-detection, and
real-world physical behaviour to objects? I understand that Chris Colefax is
holding off on his work until POV 3.5 is released (am I correct on this?).

I am asking simply because I have long wished for the capability of
animating objects simply by defining their characteristics (mass, elasticity
etc), and letting POV do the rest, but there is no way that I could even
begin to code this myself. I honestly wouldn't know where to start.

I gather there are internal shortcomings regarding the detection of an
objects extremeties (am I correct on this also?), but can these be overcome?
How does other software (proprietary in house animation software in
particular) achieve this?

Apologies if you think this should have been posted in povray.advanced-users

--
Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: David Buck
Subject: Re: Physics - collision detection etc
Date: 25 Jan 2001 16:18:17
Message: <3A709881.20F7E81E@simberon.com>
Strange that you should ask.  This is what ElastoLab does.  ElastoLab is a
physics simulating package that allows you to design scenes with gravity, air
resistance, springs, elastics, rods, and barriers then set them in motion in
real-time.  It's a low-cost application (i.e., about $30 US) I'm about to
release within the next few months.  Unfortunately for POV users, it works only
in 2D and it doesn't output coordinates to import into POV-Ray.  Writing
coordinates may be added in future versions.  I don't forsee writing a 3D
interface for it.

In a nutshell, you need to implement something called a differential equation
solver.  One technique (which is not very good) is to use Euler's Method.
Basically, you calculate all the forces at any point in time.  Gravity would be
F=mg, springs are F= -kd, air resistance is F= -cv where c is the air resistance
constant. From the forces you can calculate the accelerations of the particles
(a=F/m). From the accelerations you can calculate the velocities (v2=v1 + at
where t is the time increment) and from the velocities you can calculate the new
positions (p2=p1 + vt).  Then you recalculate the forces and do it all again.

A better way (used by ElastoLab) is Adaptive Runge-Kutta but that technique goes
well beyond what I can explain in a simple email.

When ElastoLab is ready for a public beta, I'll let you know and you can try it.

David Buck
dav### [at] simberoncom

Andy Cocker wrote:

> Is anybody actively working on equipping POV with collision-detection, and
> real-world physical behaviour to objects? I understand that Chris Colefax is
> holding off on his work until POV 3.5 is released (am I correct on this?).
>
> I am asking simply because I have long wished for the capability of
> animating objects simply by defining their characteristics (mass, elasticity
> etc), and letting POV do the rest, but there is no way that I could even
> begin to code this myself. I honestly wouldn't know where to start.
>
> I gather there are internal shortcomings regarding the detection of an
> objects extremeties (am I correct on this also?), but can these be overcome?
> How does other software (proprietary in house animation software in
> particular) achieve this?
>
> Apologies if you think this should have been posted in povray.advanced-users
>
> --
> Andy Cocker
>
> ---------------------------------------------------------------
> listen to my music at:
> www.mp3.com/lunarland
> ---------------------------------------------------------------
>
> 'I spilled spot remover on my dog. He's gone now. '
> 'I went to a restaurant that serves "breakfast at any time."
> So I ordered french toast during the Renaissance. '
>
>  - Steven Wright.
> ---------------------------------------------------------------


Post a reply to this message

From: Andy Cocker
Subject: Re: Physics - collision detection etc
Date: 25 Jan 2001 16:59:47
Message: <3a70a1d3$1@news.povray.org>
Thankyou David. that would be great.

--
Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: John VanSickle
Subject: Re: Physics - collision detection etc
Date: 26 Jan 2001 03:03:16
Message: <3A7144AE.BC7AC38@hotmail.com>
David Buck wrote:
> 
> In a nutshell, you need to implement something called a differential
> equation solver.

I have been nurturing the idea of developing some Laplace transform
macros for POV-Ray.  Definitely not a project for the timid, or the
math-impaired.

> One technique (which is not very good) is to use Euler's Method.
> Basically, you calculate all the forces at any point in time.  Gravity
> would be F=mg, springs are F= -kd, air resistance is F= -cv where c is
> the air resistance constant. From the forces you can calculate the
> accelerations of the particles (a=F/m). From the accelerations you can
> calculate the velocities (v2=v1 + at where t is the time increment) and
> from the velocities you can calculate the new positions (p2=p1 + vt).

Let me point out here that re-calculating the new position first, with the
formula P' = P + Vt + At^2/2 yields less inaccurate results.  This still
results in an accumulating degree of imprecision; modifying the equations
to include third-order behavior reduces the imprecision; a bit of drag
(the cV factor you mention above) will reduce the wild thrashing that can
result from the accumulating errors.

> Then you recalculate the forces and do it all again.
> 
> A better way (used by ElastoLab) is Adaptive Runge-Kutta but that
> technique goes well beyond what I can explain in a simple email.

For those interested, feed "Runge-Kutta" into your friendly
neighborhood search engine.  Google registers over 3000 hits.

Regards,
John


Post a reply to this message

From: David Buck
Subject: Re: Physics - collision detection etc
Date: 26 Jan 2001 05:48:33
Message: <3A71566B.CE8EDC4E@simberon.com>
John VanSickle wrote:

> Let me point out here that re-calculating the new position first, with the
> formula P' = P + Vt + At^2/2 yields less inaccurate results.  This still
> results in an accumulating degree of imprecision; modifying the equations
> to include third-order behavior reduces the imprecision; a bit of drag
> (the cV factor you mention above) will reduce the wild thrashing that can
> result from the accumulating errors.
>

Never implement undampened springs.  They will explode with small accumulating
errors.

> For those interested, feed "Runge-Kutta" into your friendly
> neighborhood search engine.  Google registers over 3000 hits.

Tough parts are collision detection (especially particle-particle collision),
continuous contact, and rigid bodies (requires calculating center of mass,
torques and 3D orientations).

David Buck
dav### [at] simberoncom


Post a reply to this message

From: Michael Brown
Subject: Re: Physics - collision detection etc
Date: 26 Jan 2001 21:55:18
Message: <3a723896@news.povray.org>
> Never implement undampened springs.  They will explode with small
accumulating
> errors.
Or undamped pendulums. My Newton's cradle (virtual) managed to clock up
speeds of several thousand meters per second after running it for a while :)


Post a reply to this message

From: Andy Cocker
Subject: Re: Physics - collision detection etc
Date: 27 Jan 2001 18:28:45
Message: <3a7359ad@news.povray.org>
I've just been looking at www.havok.com... WOW! Solid body dynamics, cloth
simulation.. available as a MAX plugin. *This* is the kind of thing I want
access to in POV :-)

I couldn't do it, but could any of you math wizards that frequent these
newsgroups? I hope so..
--
Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: Andy Cocker
Subject: Re: Physics - collision detection etc
Date: 27 Jan 2001 19:02:44
Message: <3a7361a4@news.povray.org>
I just wanted to mention this demo, from the HAVOK website. It's a win
executable of the real-time dynamic behaviour of falling blocks that you can
interract with. Runs fine on my P200.

http://www.havok.com/download/blocks.zip

--
Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: Michael Brown
Subject: Re: Physics - collision detection etc
Date: 28 Jan 2001 00:37:00
Message: <3a73affc$1@news.povray.org>
Maybe we should start a joint project with the sci.physics newsgroup :)

"Andy Cocker" <big### [at] mariner9fsnetcouk> wrote in message
news:3a7359ad@news.povray.org...
> I've just been looking at www.havok.com... WOW! Solid body dynamics, cloth
> simulation.. available as a MAX plugin. *This* is the kind of thing I want
> access to in POV :-)
>
> I couldn't do it, but could any of you math wizards that frequent these
> newsgroups? I hope so..
> --
> Andy Cocker
>
> ---------------------------------------------------------------
> listen to my music at:
> www.mp3.com/lunarland
> ---------------------------------------------------------------
>
> 'I spilled spot remover on my dog. He's gone now. '
> 'I went to a restaurant that serves "breakfast at any time."
> So I ordered french toast during the Renaissance. '
>
>  - Steven Wright.
> ---------------------------------------------------------------
>
>


Post a reply to this message

From: Andy Cocker
Subject: Re: Physics - collision detection etc
Date: 28 Jan 2001 09:54:46
Message: <3a7432b6@news.povray.org>
"Michael Brown" <emb### [at] i4freeDELETETHISconz> wrote in message
news:3a73affc$1@news.povray.org...
> Maybe we should start a joint project with the sci.physics newsgroup :)

Well, I honestly do think that it would be a fantastic addition to POV..
this in conjunction with POV's scripting language would be ever so powerful.
I'm sure it will happen eventually... :-)

--
Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: Warp
Subject: Re: Physics - collision detection etc
Date: 28 Jan 2001 10:03:17
Message: <3a7434b5@news.povray.org>
This can be really hard for some mathematical objects.
  Imagine two different julia-objects colliding... How do you calculate
that?

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Chris Huff
Subject: Re: Physics - collision detection etc
Date: 28 Jan 2001 11:04:37
Message: <chrishuff-4F6740.11052728012001@news.povray.org>
In article <3a7434b5@news.povray.org>, Warp <war### [at] tagpovrayorg> 
wrote:

>   This can be really hard for some mathematical objects.
>   Imagine two different julia-objects colliding... How do you calculate
> that?

I'd probably start out by computing a bunch of points on the surface and 
using the Inside test to figure out an approximate center of 
gravity...but I know virtually nothing about this kind of thing, so this 
is just guesswork.

Maybe limit it to mesh objects, that way you could also simulate the way 
the surface is deformed by it's interactions with other objects. I don't 
think the deform patch would be sufficient for this...and handling only 
meshes should make it easier.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

From: Andy Cocker
Subject: Re: Physics - collision detection etc
Date: 28 Jan 2001 14:07:13
Message: <3a746de1@news.povray.org>
"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-4F6740.11052728012001@news.povray.org...

> I'd probably start out by computing a bunch of points on the surface and
> using the Inside test to figure out an approximate center of
> gravity...but I know virtually nothing about this kind of thing, so this
> is just guesswork.
>
> Maybe limit it to mesh objects, that way you could also simulate the way
> the surface is deformed by it's interactions with other objects. I don't
> think the deform patch would be sufficient for this...and handling only
> meshes should make it easier.

I'd be happy with solid-body dynamics so surface deformations wouldn't be an
issue. Maybe if it was just limited to the simpler POV primitives without
CSG initially.. even just spheres, or blobs would be great too for liquid
effects.

Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: John VanSickle
Subject: Re: Physics - collision detection etc
Date: 29 Jan 2001 01:57:51
Message: <3A7529F7.6F99D04F@hotmail.com>
David Buck wrote:
> 
> Never implement undampened springs.  They will explode with small
> accumulating errors.

I posted an anim to p.b.animations many moons ago, which demonstrates this.
A falling tetrahedron behaves wonderfully until about a half second after
the rebound.  There was dampening, just not enough.

Modifying the motions equations to include third-order motion (ie, d3x/dt3)
greatly reduced the error, so that less dampening as needed.  It's
possible that calculating the dampened sinusoid which best matches the
current velocity, acceleration, and higher derivatives will yield a closer
approximation of real motion, but I haven't looked into it very far.

And since all real-world springs are very slightly dampened anyway,
a slight dampening is needful for realism.

Regards,
John


Post a reply to this message

From: Warp
Subject: Re: Physics - collision detection etc
Date: 29 Jan 2001 05:45:03
Message: <3a7549ae@news.povray.org>
Andy Cocker <big### [at] mariner9fsnetcouk> wrote:
: or blobs

  AFAIK blobs are also one of the most difficult primitives.

-- 
char*i="b[7FK@`3NB6>B:b3O6>:B:b3O6><`3:;8:6f733:>::b?7B>:>^B>C73;S1";
main(_,c,m){for(m=32;c=*i++-49;c&m?puts(""):m)for(_=(
c/4)&7;putchar(m),_--?m:(_=(1<<(c&3))-1,(m^=3)&3););}    /*- Warp -*/


Post a reply to this message

From: Peter Popov
Subject: Re: Physics - collision detection etc
Date: 31 Jan 2001 00:38:48
Message: <223a7tg48m6a0i6jj0gon0a52k1libk95p@4ax.com>
On Sat, 27 Jan 2001 23:28:16 -0000, "Andy Cocker"
<big### [at] mariner9fsnetcouk> wrote:

>I've just been looking at www.havok.com... WOW! Solid body dynamics, cloth
>simulation.. available as a MAX plugin. *This* is the kind of thing I want
>access to in POV :-)
>
>I couldn't do it, but could any of you math wizards that frequent these
>newsgroups? I hope so..

My thesis will be (with luck) algorithms for simulating string, cloth,
solid body, gel, fluid, field and some other interesting stuff. And of
course I plan to code it as a POV patch. It should be due June or
September.

Please don't ask more. I am the one who would like it the most to see
it working.


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


Post a reply to this message

From: Andy Cocker
Subject: Re: Physics - collision detection etc
Date: 31 Jan 2001 18:42:41
Message: <3a78a2f1@news.povray.org>
"Peter Popov" <pet### [at] vipbg> wrote in message
news:223a7tg48m6a0i6jj0gon0a52k1libk95p@4ax.com...

> My thesis will be (with luck) algorithms for simulating string, cloth,
> solid body, gel, fluid, field and some other interesting stuff. And of
> course I plan to code it as a POV patch. It should be due June or
> September.
>
> Please don't ask more. I am the one who would like it the most to see
> it working.

Good luck with it Peter.

--
Andy Cocker

---------------------------------------------------------------
listen to my music at:
www.mp3.com/lunarland
---------------------------------------------------------------

'I spilled spot remover on my dog. He's gone now. '
'I went to a restaurant that serves "breakfast at any time."
So I ordered french toast during the Renaissance. '

 - Steven Wright.
---------------------------------------------------------------


Post a reply to this message

From: October
Subject: Re: Physics - collision detection etc
Date: 9 Feb 2001 18:46:03
Message: <3a84813b@news.povray.org>
You could get away with using some sort of "bounding box" coding (similar to
what is used to calculate collision detection in many video games) to
envelope complex objects (like the julias mentioned earlier) in a shape that
was transparent to the camera that adopted the original object's properties
(gravity, etc.) and much faster to operate with, say a rough mesh or even
simple primatives.

This wouldn't fool the eye under very close inspection but for a camera
perspective that didn't percieve great detail it would probably work.

"Chris Huff" <chr### [at] maccom> wrote in message
news:chrishuff-4F6740.11052728012001@news.povray.org...
> In article <3a7434b5@news.povray.org>, Warp <war### [at] tagpovrayorg>
> wrote:
>
> >   This can be really hard for some mathematical objects.
> >   Imagine two different julia-objects colliding... How do you calculate
> > that?
>
> I'd probably start out by computing a bunch of points on the surface and
> using the Inside test to figure out an approximate center of
> gravity...but I know virtually nothing about this kind of thing, so this
> is just guesswork.
>
> Maybe limit it to mesh objects, that way you could also simulate the way
> the surface is deformed by it's interactions with other objects. I don't
> think the deform patch would be sufficient for this...and handling only
> meshes should make it easier.
>
> --
> Christopher James Huff
> Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
> TAG: chr### [at] tagpovrayorg, http://tag.povray.org/
>
> <><


Post a reply to this message

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