POV-Ray : Newsgroups : povray.unofficial.patches : 0.5: strange trace behavior on isosurface Server Time
1 Nov 2024 11:16:10 EDT (-0400)
  0.5: strange trace behavior on isosurface (Message 1 to 1 of 1)  
From: Greg M  Johnson
Subject: 0.5: strange trace behavior on isosurface
Date: 7 Dec 2000 08:11:12
Message: <3A2F8B11.10EA26BD@my-dejanews.com>
The code below sometimes computes the  max, min, and average height of
an isosurface made with the pigment pattern. That is, when the trace
function (or my PC or my head) is working properly.

I was working on an animation  that made little flying particles
negotiate this city. I eventually found that my particles got dumber and
dumber. In debugging the code I found that the trace functions weren't
responding correctly: all trace calls were returning <0,0,0>.  I was
able to duplicate the problem with this much simpler code attached
below: it was reporting a max and min height of 0.   The other strange
effect was that my actual particle position & velocity -calculating
routine was taking place too fast for the tens of thousands of trace
calls I was making with it. It was as if it just reported <0,0,0>
without actually doing the work.

This problem was occurring during a time period when I had left megapov
on for more than a week crunching these animations. I rebooted my Win98
PC, had the same problem.  I reloaded mega one more time and everything
was back to normal.  Just got "normal" results on my "other" raytracing
PC.

Possibilities:
1) mega just needs to be rebooted once and a while: but how will one
know if the software has  a problem: for days I just thought I had a bad
algorithm!
2) I'm insane.


//- start of code-----------------------------------
#version unofficial MegaPov 0.5;
#include "colors.inc"
#macro distribute(iou)
        #declare Norm=<0,0,0>;
        #declare nsamps=20;
        #declare minht=100000;
        #declare maxht=-100000;
        #declare htsum=0;
        #declare i=0;
        #while (i<nsamps)
                #declare j=0;
                #while (j<nsamps)
                        #local place=<-0.99*citsize
+1.9*citsize/nsamps*i,0,-0.99*citsize +1.9*citsize/nsamps*j>;
                        #local ht=trace(city,place+1000*y,-y,Norm);
                        #declare htsum=htsum+ht.y;
                        #if(ht.y>maxht)
                                #declare maxht=ht.y;
                        #else
                                #if (ht.y<minht)
                                        #declare minht=ht.y;
                                #end
                        #end
                #declare j=j+1;
                #end

        #declare i=i+1;
        #end
        #debug "\n \n max ht "
        #debug str(maxht,4,2)
        #debug "    ave ht "
        #debug str(htsum/nsamps/nsamps,4,2)
        #debug "    min ht "
        #debug str(minht,4,2)
        #debug "\n \n"
#end

#declare Map= color_map {[0 rgb 0][1 rgb 1]
        }

#declare F=function{pigment{cells color_map {Map} scale 0.25}}
#declare grade=150;//2^(clock*9)
#declare citsize=200;
#declare city=
isosurface{
        function{y-.0-F}
        contained_by {box {-citsize,citsize}}
        max_gradient grade
        accuracy 0.001          //was 0.01
        scale 2
        pigment {rgb <0.7,0.7,0.9>}
        }

//background{White}
object{city}

distribute(1)

//camera {location <2,4.2,-10>        look_at <0,0,-7>        angle
60        }


Post a reply to this message

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