POV-Ray : Newsgroups : povray.programming : [RFC] Little isosurface patch ? : [RFC] Little isosurface patch ? Server Time
3 Jul 2024 06:08:49 EDT (-0400)
  [RFC] Little isosurface patch ?  
From: Wolfgang Wieser
Date: 26 Feb 2004 17:52:35
Message: <403e78b2@news.povray.org>
I am not completely sure about what I am talking here but at least 
what I propose in the following lines removed black spots on the isosurface 
of my Mars renderings. (These spots only occur when the light comes under 
a flat angle and when no_shadow is NOT set.)

In isosurf.cpp, the recursive part of the root finder reads: 

---------------------------------------
static int IsoSurface_Function_Find_Root_R(ISOSURFACE* ISOSRF, ISO_Pair*
EP1, 
        ISO_Pair* EP2, DBL dt, DBL t21, DBL len, bool in_shadow_test)
{
        DBL temp;

        temp = fabs((EP2->f - EP1->f) * len);
        if(ISOSRF->gradient < temp)  // update "max gradient found"
                ISOSRF->gradient = temp;

        if((ISOSRF->eval == true) && [...]
                [...]

        if(t21 < ISOSRF->accuracy)
        {
        #if ORIGINAL
                if(EP2->f < 0)
                {
                        ISOSRF->tl = EP2->t;
                        return true;
                }
                else return false;
        #else /* !ORIGINAL /
                if(EP2->f <= 0 && EP1->f >= 0.0)
                {
                        ISOSRF->tl = 0.5*(EP2->t+EP1->t);
                        return true;
                }
                else if(EP2->f < 0)  // This will normally not be reached (ww). 
                {
                        ISOSRF->tl = EP2->t;
                        return true;
                }
                else return false;
        #endif
        }
        [...]
---------------------------------------

The idea is that in case we cross the isosurface threshold and 
one point is outside (EP1) while the other one is inside (EP2), 
then the average of the two depth values should give a better 
estimate for the actual intersection than merely using EP2. 

(This works because the root solver continuously halfes the interval 
the root is in.)

The "else if" stmt is the original code which is probably not reached 
normally because in case both points are inside the isosurface, we 
should not be here. 

At least that is what I think from reading the code because unfortunately 
it completely lacks descriptive comments. 

Maybe somebody with a clue could comment on that. 

Wolfgang


Post a reply to this message

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