POV-Ray : Newsgroups : povray.general : Trace macro workings with isosurfaces - Pov 3.5 : Trace macro workings with isosurfaces - Pov 3.5 Server Time
3 Aug 2024 04:18:15 EDT (-0400)
  Trace macro workings with isosurfaces - Pov 3.5  
From: Stefan Viljoen
Date: 22 May 2004 08:59:05
Message: <40af4e92@news.povray.org>
Hi all

I have a problem using the trace macro - in the /advanced PovRay
installation directory, there is a scene called isocacti that uses the
built-in trace() macro to determine the "height" of ridges on a isosurface. 

I am attempting to use the same technique in one of my scenes to place
objects on the same isosurface (copied out of isocacti.pov), but trace()
seems to detect the isosurface at least 3 units too "high" - i.e . all my
objects "float" above the isosurface they are supposed to rest on. 

Exchanging the isosurface in my scene with a plane object in the xy plan
makes the trace macro in my scene work correctly - so the apparent problem
is with trying to trace() an isosurface (although - how can it work
correctly in isocacti.pov?)

My camera:

#declare center_loc = <3,4,1>;
#declare center_look = <0,0,1>;

#declare cam_loc = center_loc;
#declare cam_look = center_look;

camera
{
        sky <0,0,1>
        location cam_loc
        up <0,0,1>
        look_at cam_look
}

The "ground":

#declare Ground =
isosurface {
        function {y - f_snoise3d(x/7, 0, z/2)*0.5}
        threshold 0
        max_gradient 1.1
        contained_by {box {<-100,-3,-100>, < 100, 1, 100>}}

        texture {
                pigment {color rgb < 1, 0.9, 0.65>}
                normal {granite 0.2 scale 0.02}
                finish {
                        brilliance 0.5
                        specular 0.1
                        //diffuse 0.3
                        //ambient 0.3
                }
        }
}

object 
{
        Ground

        rotate <90,0,45>
        translate <50,-20,0>
}

#declare loc = trace(Ground,<0,0,5>,-z);

sphere
{
        <0,0,0>,0.25
        texture{pigment{color Red}}

        translate loc
}

The loc coordinate is consistently wrong - it never returns the actual
isosurface intersection with the correct Z, always a few units more - if I
do

#declare loc = trace(Ground,<0,0,15>,-z);

the error INCREASES - the sphere I want to place "on" the ground floating
"higher" and higher (i . e. +z direction).

However, exchanging the isosurface with a plane, instantly fixes the problem
and the sphere drops precisely to the surface of the plane.

But why does it work with the same isosurface in isocacti.pov? Can it be
that I use a different camera? Or because my isosurface is slightly
inclined? (Isocacti seems to use a "flat" isosurface in the xz plane) But
logically that should not matter?

This has really got me baffled - any help appreciated!

Regards,

Stefan Viljoen
Software Support Technician
Polar Design Solutions


Post a reply to this message

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