POV-Ray : Newsgroups : povray.unofficial.patches : trace() not working with isosurfaces? Server Time
1 Nov 2024 17:22:23 EDT (-0400)
  trace() not working with isosurfaces? (Message 1 to 10 of 13)  
Goto Latest 10 Messages Next 3 Messages >>>
From: Vaclav Cermak
Subject: trace() not working with isosurfaces?
Date: 18 Jul 2000 11:30:27
Message: <39747813.ECD7B37A@itam.cas.cz>
Hello,

  I'am playing with ridgedfm heightfield and I'am trying
  to place some "trees" (cylinders, right now ;-) on it.
  But something is wrong: when I made box, sphere,
  isosurface with function { y } instead of heightfield,
  it works. When I use ridgedmf, or noise, or pigment
  in fuction it is unable to fund intersection of rays
  with hf. But is heightfield itself displays correctly.
  Any idea, what I'am doing bad?

Thanks

Disnel

Source code of testing scene:

#version unofficial MegaPov 0.5;

camera {
  location <10, 10, -10>
  angle 20
  look_at <0, 0, 0>
}

light_source {< 100, 100, -50> color rgb 1}
light_source {<-100, 100, -50> color rgb .5}

#default {
  texture {
    pigment {color rgb 1}
    finish {ambient 0 diffuse .8}
  }
}

//background {color rgb .7}

#declare H=1.0;
#declare Lac=1.5;
#declare Octs=12;
#declare Offset=0.0;
#declare T=1.0;

#declare HF_Func=function {"heteroMF",<H, Lac, Octs, Offset, T> }

#declare Landscape=
isosurface{
  function{y - HF_Func(x,0,z) + 1 }
  eval
  contained_by { box {<-2, -2, -2>, <2, 0, 2>} }
  scale <1, .4, 1>
}

//#declare Landscape=box {<-2, -1, -2>, <2, 0, 2>}
//#declare Landscape=sphere {<0, -10, 0>, 10}

object {Landscape}

#declare Step_x=0.3;
#declare Step_z=0.3;
#declare Max_x=2;
#declare Max_z=2;

#declare Tree=
cylinder {
  <0, 0, 0>, <0, .25, 0>, .02
  texture {
    pigment {color rgb <.5, 1, .5>}
  }
}

#macro PlaceTree(px, pz)
  #local Normal=<0, 0, 0>;
  #local Where=trace(Landscape, <px, 10, pz>, <0, -1, 0>, Normal);
  #if (Normal.x = 0 & Normal.y = 0 & Normal.z = 0)
    #warning "Tree not placed\n"
  #else
    object {Tree translate Where}
  #end
#end

#local px=0;
#while (px < Max_x)
  #local pz=0;
  #while (pz < Max_z)
    PlaceTree(px, pz)
    #if (px > 0)
      PlaceTree(-px, pz)
      #if (pz > 0)
        PlaceTree(-px, -pz)
      #end
    #end
    #if (pz > 0)
      PlaceTree(px, -pz)
    #end
    #local pz=pz+Step_z;
  #end
  #local px=px+Step_x;
#end


Post a reply to this message

From: Fabien Mosen
Subject: Re: trace() not working with isosurfaces?
Date: 18 Jul 2000 14:52:37
Message: <3974A638.DEF5AC4F@skynet.be>
The problem is due to the fact that you use the same variable
names in the macro and in the loop.  This works :

#macro PlaceTree(ax, az)
  #local Normal=<0, 0, 0>;
  #local Where = trace(Landscape, <ax, 10, az>, <0, -1, 0>, Normal);
  #if (Normal.x = 0 & Normal.y = 0 & Normal.z = 0)
    #warning "Tree not placed\n"
  #else
    object {Tree translate Where}
  #end
#end


Post a reply to this message

From: Disnel
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 11:28:35
Message: <3975C923.726301EE@itam.cas.cz>
I don't think so. It works when I replace isosurface with
box or sphere (and I think, that px and pz are declared locally
in macro). And it does not work when I replace them with
ax or az, as you wrote.

Which version od MegaPOV are you using? I use Linux version.

Fabien Mosen wrote:
> 
> The problem is due to the fact that you use the same variable
> names in the macro and in the loop.  This works :
> 
> #macro PlaceTree(ax, az)
>   #local Normal=<0, 0, 0>;
>   #local Where = trace(Landscape, <ax, 10, az>, <0, -1, 0>, Normal);
>   #if (Normal.x = 0 & Normal.y = 0 & Normal.z = 0)
>     #warning "Tree not placed\n"
>   #else
>     object {Tree translate Where}
>   #end
> #end


Post a reply to this message

From: Disnel
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 13:01:41
Message: <3975DEF5.F1A6AFCE@itam.cas.cz>
... and it also works with isosurface sphere....


Post a reply to this message

From: Chris Huff
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 13:28:30
Message: <chrishuff-78F1F0.12290319072000@news.povray.org>
In article <39747813.ECD7B37A@itam.cas.cz>, Vaclav Cermak 
<dis### [at] itamcascz> wrote:

>   I'am playing with ridgedfm heightfield and I'am trying
>   to place some "trees" (cylinders, right now ;-) on it.
>   But something is wrong: when I made box, sphere,
>   isosurface with function { y } instead of heightfield,
>   it works. When I use ridgedmf, or noise, or pigment
>   in fuction it is unable to fund intersection of rays
>   with hf. But is heightfield itself displays correctly.

Try increasing the accuracy of the isosurface.

-- 
Christopher James Huff - Personal e-mail: chr### [at] maccom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://homepage.mac.com/chrishuff/
TAG Web page: http://tag.povray.org/


Post a reply to this message

From: Tim Riley
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 14:09:24
Message: <3975EECF.97D54001@its.bldrdoc.gov>
Disnel wrote:
> 
> I don't think so. It works when I replace isosurface with
> box or sphere (and I think, that px and pz are declared locally
> in macro). And it does not work when I replace them with
> ax or az, as you wrote.
> 
> Which version od MegaPOV are you using? I use Linux version.
> 
> Fabien Mosen wrote:
> >
> > The problem is due to the fact that you use the same variable
> > names in the macro and in the loop.  This works :
> >
> > #macro PlaceTree(ax, az)
> >   #local Normal=<0, 0, 0>;
> >   #local Where = trace(Landscape, <ax, 10, az>, <0, -1, 0>, Normal);
> >   #if (Normal.x = 0 & Normal.y = 0 & Normal.z = 0)
> >     #warning "Tree not placed\n"
> >   #else
> >     object {Tree translate Where}
> >   #end
> > #end

Another problem is that "Normal" is a reserved word. When I changed it
to something else (such as "Norm"), it worked.


Post a reply to this message

From: Ron Parker
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 14:15:46
Message: <slrn8nbsqa.4br.ron.parker@linux.parkerr.fwi.com>
On Wed, 19 Jul 2000 12:09:19 -0600, Tim Riley wrote:
>Another problem is that "Normal" is a reserved word. When I changed it
>to something else (such as "Norm"), it worked.

Is not.  Reserved words don't have capital letters in them.  Try it as 
posted and see if it works that way.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Fabien Mosen
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 16:13:37
Message: <39760AB5.9EC409D@skynet.be>
Disnel wrote:
> 
> I don't think so. It works when I replace isosurface with
> box or sphere (and I think, that px and pz are declared locally
> in macro). And it does not work when I replace them with
> ax or az, as you wrote.

At least, once I did that, it worked fine... 
otherwise it didn't...

> Which version od MegaPOV are you using? I use Linux version.

Win version, MegaPOV 0.5A


Post a reply to this message

From: Tim Riley
Subject: Re: trace() not working with isosurfaces?
Date: 19 Jul 2000 17:26:56
Message: <39761D12.F7088486@its.bldrdoc.gov>
Ron Parker wrote:
> 
> On Wed, 19 Jul 2000 12:09:19 -0600, Tim Riley wrote:
> >Another problem is that "Normal" is a reserved word. When I changed it
> >to something else (such as "Norm"), it worked.
> 
> Is not.  Reserved words don't have capital letters in them.  Try it as
> posted and see if it works that way.


I tried it as posted, then changed the variable names in the PlaceTree
macro as suggested; neither would work (Normal was always equal to <0,0,0>).
When I changed the variable name to Norm, it did work (placed a tree at
each point). I realize that "normal" is reserved, but I can't explain why
"Norm" works and "Normal" does not.


Post a reply to this message

From: Disnel
Subject: Re: trace() not working with isosurfaces?
Date: 20 Jul 2000 08:45:25
Message: <3976F465.21185F2E@itam.cas.cz>
> 
> Try increasing the accuracy of the isosurface.
> 

Already tried 0.0000000001, no success.....


Post a reply to this message

Goto Latest 10 Messages Next 3 Messages >>>

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