POV-Ray : Newsgroups : povray.binaries.animations : Re: Flowing Water take 4 (985KB) : Re: Flowing Water take 4 (985KB) Server Time
20 Jul 2024 13:11:54 EDT (-0400)
  Re: Flowing Water take 4 (985KB)  
From: Geoff Wedig
Date: 20 Jun 2001 09:26:42
Message: <3b30a492@news.povray.org>
Rune <run### [at] mobilixnetdk> wrote:

> "Christoph Hormann" wrote:
>> I understand the problem, but it only occurs, if you
>> already start below the surface, so i wonder how this
>> happens (since originally everything is above and
>> there should be no way to get below)

> Not exactly correct.

> The old algorithm worked like this:

> The particle motion is calculated using an OldLocation and a NewLocation for
> the particle. The collision detection algorithm traces a ray between these
> two points:

> \        V  /
>  \      /  /
>   \    /  /
>    `--o--?
>      /
>     V

> Then both the OldLocation and the NewLocation are rotated around the
> collision point:

> \           /
>  \         /
>   \       /
> <--`--o--?--<

> In order to avoid errors the ray is moved a tiny bit along the normal vector
> of the surface:

> \           /
>  \         /
> <-\---o---/-<
>    `-----?

> The new algorithm works the same way except that if the algorithm loop is
> run more than once, then for each loop the ray is traced not from the
> OldLocation but from the collision point from the loop before. That works
> fairly well, but not perfect.

> Perhaps one reason for the occasional errors could be that a ray
> accidentally hits exactly between two triangles of the heightfield?

Have you considered only rotating the bit of the ray that you haven't
already travelled?

> \        V  /
>  \      /  /
>   \    /  /
> <--`--o--?

Like so?  That would keep the ray above the surface, just use a shorter
ray.

> In order to avoid errors the ray is moved a tiny bit along the normal vector
> of the surface:

> \           /
>  \         /
> <-\---o---/-<
>    `-----?

This might cause errors with highly contorted surfaces  consider:

               V
             // 
    ---------/
   ---------o-

V just misses hitting the tip of the upper surface.  If it is moved along
the normal, it could end up inside the upper surface.  You might want to
move a short distance along the ray itself.  This means that any movement of
o will remain outside the surface.

Geoff


Post a reply to this message

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