POV-Ray : Newsgroups : povray.programming : Parametric object with shadow gets black : Re: Parametric object with shadow gets black Server Time
5 Jul 2024 14:22:36 EDT (-0400)
  Re: Parametric object with shadow gets black  
From: Wolfgang Wieser
Date: 25 Jun 2003 17:30:48
Message: <3efa1486@news.povray.org>
Massimo Valentini wrote:
> "Massimo Valentini" ha scritto
> : I don't think a quick patch is easy, but, may be, it suffices a loop.
> 
> Instead of a loop it is possible to set appropriately the range
> for intersections, so that the first is the correct.
> 
> The following patch should fix the shadow problem, 
>
Hey, that's cool! It seems to work well. There is lots of self-shadow 
and the whole object throws shadow. AND it is no longer solid black. 

Does anybody know if there is any reason for doing 
>   if (Depth1 == Depth2)
>    Depth1 = 0;
around line 222?
Shouldn't one use 
    if(fabs(Depth1-Depth2)<=some_epsilon)  Depth=0;
instead?

> though not the accuracy one.
> 
The accuracy problem is caused by the array index overflow. 
I don't know what one should do. Of yourse, one could dynamically 
enlarge the array but before doing that one should be certain 
that the loop will ever terminate in all situations. 
I mean -- this is FP numerics and I'm not sure if we can trap 
situations where things break (no convergence...). 
I'm not sure about that (no time to study the code in depth) but 
it is possible that there is no emergency break in the code which 
makes sure that we give up numeric calculation when it comes clear 
that the desired accuracy cannot be reached? Trying to reach 
1e-20 accuracy with standard FP is simply ridiculous...

Wolfgang

> --- obj/fpmetric.cpp 2003-06-23 22:10:24.000000000 +0200
> +++ fpmetric.cpp 2003-06-23 22:11:30.000000000 +0200
> @@ -222,6 +222,9 @@
>  
> +  if (Depth1 < DEPTH_TOLERANCE)
> +    Depth1 = DEPTH_TOLERANCE;
> +
>   if ((Depth1 += 4 * Par->accuracy) > Depth2)
>    return false;


Post a reply to this message

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