POV-Ray : Newsgroups : povray.general : Some aid in physics required... : Re: Some aid in physics required... Server Time
3 Aug 2024 20:15:15 EDT (-0400)
  Re: Some aid in physics required...  
From: Tim Nikias v2 0
Date: 25 Feb 2004 03:48:43
Message: <403c616b$1@news.povray.org>
> I still don't get it. Am I correct to seem to remember that you said
> that your system uses variable time steps? And that is the reason that
> there can be as much as 3500 steps per frame? If it is a problem that
> your system creates 3500 steps per frame when a particle slides along a
> surface, then why don't you just tell it to use fewer steps?


The idea for the adaptive timesteps is simple: I've got a minimum and a
maximum timestep along with a maximum distance. I begin with using the
maximum timestep. If the particle moves more than the given maximum
distance, I reduce the timestep until I can use some value between min and
max timestep. If I'm already using the min timestep, I can't go any lower
than that when just basing the timestep on the distance. This is to ensure
that the simulation won't run longer than it would take for the min
timesteps to compute when particles are in free-fall.

Now it's done like this: I've got the position and the velocity of a
particle. I move the particle by a given timestep along the velocity and
thus get a new position. Then I check if an object lies between the former
and the new position. If it does, I just use a linear solution to find when
during the timestep the impact occurs. That value is used to recalculate
speed and/or other data that may be passed along with the particle. I
position the particle at the impact point, reverse the velocity-vector and
move on from there. Thus, the actual minimum timestep won't be used, but
maybe an even smaller one for impacts. Why I do that? When a particle gets
into tight spaces, I may have to bounce the particle off of several
surfaces, even when using just the minimum timestep. I still want to get as
much precision as possible, sort of approaching using so tiny iterations
that it'll converge against 0. The adaptive system is there simply because
when in free-fall, I can easily jump across larger timesteps because there's
no interferance.

So when an object gets hit, the timestep gets adjusted to the amount of time
it would require the particle to get from former position till impact
position based on the initial velocity (which also leaves some accuracy
behind, I know that). So, once a particle gets really slow and is just on a
surface, a particle will impact very, very quickly (even during a min
timestep) and hundreds of these impacts occur (that's why the iteration can
run up to 3500 or more).

What I want to do is thus switch from "fast bouncing/hopping/oscillation" to
"frictionless sliding on surface". So, instead of calculating very minimal
hops, I assume that I'd be having dozens of these hops and just check if I
can safely move the particle along the surface without an obstacle in
between. In this manner, the particle may of course get airborn (e.g. I'm
.5*x units away from the edge of a box and move it by one unit towards -x,
I'll be -.5*x over the edge, there's no obstacle inbetween and everything is
fine). So, at the end, if I am airborn (if the particle is higher above a
surface than a given threshold) I switch back to the bouncing-model.

Now, in theory, if using too large timesteps, a particle will of course be
visibly inaccurate: if the particle gets moved way too far across the edge,
it'll look quiet unrealistic. Now, the maximum distance takes care that a
particle won't move farther than that. And I can even add some more checks
in between, as I've said, 20 checks is better than 3500 hops.

> You talk about calculating the slow-down when a particle slides uphill.
> Why can you only calculate that with your current model when you use a
> huge number of steps? Why doesn't the calculations work equally well
> (though slightly less precise) when fewer steps are used?

It's not the problem that I can't calculate that with fewer steps, the
problem was the impact-approach on the timesteps (which I don't want to drop
or change significantly because so far it works very well for tight corners
and such, leaving the hopping aside). I was at loss of the formula for
calculating the loss of speed when moving uphill, but I think I've found
one, and I'll have to try to see if it works.

Regards,
Tim

-- 
"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.