POV-Ray : Newsgroups : povray.general : Some aid in physics required... : Re: Some aid in physics required... Server Time
3 Aug 2024 20:13:12 EDT (-0400)
  Re: Some aid in physics required...  
From: Tim Nikias v2 0
Date: 25 Feb 2004 05:30:45
Message: <403c7955$1@news.povray.org>
> If I understand you right, then things happen like this in your system:
>
> On impact, the particle is moved to the surface, so it is practically 0
> units away from the surface. After this, when you calculate the new
> position, and find out that there is a surface between the old and the
> new position, you use linear interpolation to find the impact time.
> Since the old position was about zero distance from the surface, the
> interpolation will tell you that the new impact happened at the SAME
> time as the old impact. Thus you get extremely frequent impacts as you
> describe.

I'm placing them a small value (.00001) away from the surface, because if
I'd be using a trace downwards with 0 distance, I'd shoot right through the
floor. With this tiny distance I still have some time pass between new
impacts, otherwise my system would catch itself in a loop. But basically,
you're right.

> I must admit that I think the idea of switching between two modes to
> solve the problem is a rather clumsy hack, especially the ways you have
> to "detect" when to switch.
>
> A better solution in my opinion is to not create a new time-step every
> time an impact occurs, but instead allow for several impacts in the same
> time-step. However, gravity will only be added once every time-step, so
> in most cases you will never have more than one impact per time-step.
> This way, you can use your normal algorithm to control the lengths of
> time-steps dependent on distance, regardless of impacts, and thus you
> can have pretty large time-steps also when a particle is sliding along a
> surface. (The cases where you will still have many impacts are for
> example those where your particle gets caught in a v-like-shape, but
> those situations are not that frequent.)

Ah, that's an idea I hadn't thought about... Let me see: I have a particle
lying on the floor. Gravity gets added, one impact is calculated, it
rebounces off the floor, probably staying a certain distance above the
floor. It falls back down, maybe gets even more momentum due to the
falling... That wouldn't work. A lying particle would then suddenly start
jumping. If I'd apply dampening, the effect might be lessened to a degree
which solves that problem, but still, gravity or other effects would add
energy to a particle where it's theoretically not possible. The design idea
was to easily introduce new effects: I use Macros to generate the
velocity/energy based on the timestep, and my system takes care of moving
the particle accordingly. Building the effects into the structure like
checking if it's already on the floor and thus gravity need not be added
would be counterproductive.

Basically I have no other choice than to switch between modes with this
model. Might be a little clumsy, but its the result that counts. That aside,
I've read a thesis paper once where they mentioned just that problem, though
with a more simulational background, it was essentially the same: what if
cohesive forces or stationary particles would directly counter-effect an
energy? The thesis went on with some solutions to various types of this
(lying particle with gravity, sticky particles on walls, etc), but it seems
like I've lost that PDF with my System crash last year, and googling for
particles... Well, there are dozens of papers on that.

BTW, how did you handle this in your particle system? Like you described,
one impact per timestep? Did you then use dampening etc? I'm not sure how
flexible your system is, e.g. User-Defined Macros for Wind/Gravity/Special
Effects. IIRC one could supply starting positions and velocities, and things
like gravity and wind are "hardwired" into the internal processes. But I
might be wrong, so I'll rather wait for your reply. :-)

Regards,
Tim

PS: Just had an idea: I could maybe just trace the surface normal and if
it's close enough to the particle, energies added towards the normal get
nullified when the velocity at the moment aren't high enough so that a
rebounce might be feasible... That'd be a combination of your idea of using
just the minimum timesteps but allowing several hits and my idea of having a
simple check to avoid adding impossible energies... I'll have to look into
that.

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>
Email: tim.nikias (@) nolights.de


Post a reply to this message

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