POV-Ray : Newsgroups : povray.general : Particles 101 : Particles 101 Server Time
6 Aug 2024 12:28:21 EDT (-0400)
  Particles 101  
From: Mark Hanford
Date: 21 Mar 2002 17:32:34
Message: <3c9a5f82@news.povray.org>
global_settings{waffle on}

Okay, so I've made a start on my particle system, but would like a couple of
pointers (or even cheeky samples).  Here's what I've got so far...

Make Some Particles (on first frame):
    pos1=rand(...)
    velocity1=rand(...)
    force1=0
    mass1=1
do for each frame_number
    Load Particle Data (pos, velocity, force, mass, ...extras...)
    Draw The Particles
    Calculate New Positions
    Save Particle Data
next frame_number

Now this seems like a logical choice of steps, so I assume (?) my troubles
are with the calculations.  It must have taken even Him some time to get the
rules right...

The only interaction I'm looking at is the attraction due to each of the
other particles, with BigG being a guess for this system:
//newforce = oldforce + direction*(Universal Gravitation)
#declare force1 = force1 +
    vnormalize(pos2-pos1) * ((BigG * mass1 * mass2) / vlength(pos2-pos1)^2);

which should give me a nice force pulling the particle around, yes?  This is
where I kind of "made it up" to get something that looked like it works:
#declare velocity1 = velocity1+force1;  //first leap of faith
#declare pos1 = pos1+velocity1;  //second leap of faith

Now while this can create some quite nice animations, it seems heavily
dependent on correct settings for BigG with relation to ParticleCount and
mass.
So, is this to be expected?  Particles either achieve escape velocity
immediately, or clash together and head off together into the distance.

Any help greatfully received, although just putting all this down in words
seems to help sometimes too ;)
--

Mark Hanford
http://www.mrhanford.com/povray


Post a reply to this message

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