POV-Ray : Newsgroups : povray.unofficial.patches : Hey, Warp (Tesselation patch: the fire test) : Re: Hey, Warp (Tesselation patch: the fire test) Server Time
6 Oct 2024 12:06:49 EDT (-0400)
  Re: Hey, Warp (Tesselation patch: the fire test)  
From: Jérôme Grimbert
Date: 6 Oct 2001 16:29:41
Message: <3BBF6BE1.5720D09F@free.fr>
"Tony[B]" wrote:
> 
> What Mick said... I'm dying to know if it was some little oversight, or some
> bigger problem causing the buggy meshes.

Ok, Take a deep breath now and everybody try to relax.

Here come the reason for the bug of the moving sphere... 

I would say it's a design assumption which turns out to be wrong, sometimes:
The Inside test and the trace test may disagree; 
They should not, but they do in some occurences.

The decision to add a triangle is determined by the value of Inside
at each vertex of the Tetrahedron. 
The triangle vertices are determined by the trace test between an outside/inside pair
of vertices. 
Alas, the code assumes that if one vertex is outside, and the other one is inside,
then Intersection() will always gives a valid result. 

If you really want to have fun (NOT), Try YOffs=3.5 in the sphere scene.
(Expect a Segmentation Fault, at render time, at least on my system!).


I successfully removed that bug by testing the Intersection() return 
in CalcIntersection().
I had to choose a "good" answer when Intersect failed. I choose the middle
of the segment, but there is maybe a better values ?

Here some code, for those that want to try it: 

        if (Intersection(&tess_intersect, info->Object, &tess_Ray))
        {
        Assign_Vector(info->Intersection[outs][ins][0], tess_intersect.IPoint);
        if(Smooth)
            Normal(info->Intersection[outs][ins][1],
                   tess_intersect.Object, &tess_intersect);
       }
       else
       { /* Cheating */
       Assign_Vector(info->Intersection[outs][ins][0], info->Coord[ins]);
       VScaleEq(Dir,-1/2);
       VAddEq(info->Intersection[outs][ins][0],Dir);
         if (Smooth)
           {
              VNormalizeEq(Dir);
              Assign_Vector(info->Intersection[outs][ins][1],Dir);
           }
       
       }

If you do not believe me, the demonstration of the bug is left as an exercice
to the reader.

Last point, Because good news always comes with bad news, my test with the torus
gives strange results... Still another bug, but maybe not at the same place.
Other objects seems to have survived the tesselation.


Post a reply to this message

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