POV-Ray : Newsgroups : povray.advanced-users : My first grass. : Re: My first grass. Server Time
29 Jul 2024 06:16:20 EDT (-0400)
  Re: My first grass.  
From: Tom Melly
Date: 4 Oct 2002 12:10:36
Message: <3d9dbd7c$1@news.povray.org>
"Corey Woodworth" <sch### [at] hotmailcom> wrote in message
news:3d9daca5$1@news.povray.org...

>     #if (vlength(Norm)!=0)
>       sphere {
>         Inter, .5
>         texture {
>           pigment {color green 1}
>         }
>       }
>     #end

All that (vlength(Norm)!=0) is checking is that you've hit your hf (the only
time when vlength is 0 is when you've missed the object).

I haven't used trace for a while now, but iirc what you want to do is check
whether Norm.x and Norm.z are under a certain range. I think the following would
only place a sphere if the point was perfectly flat:

#if(Norm.x = 0 & Norm.z = 0 & Norm.y != 0)
       sphere {
         Inter, .5
         texture {
           pigment {color green 1}
         }
       }
#end

or, with a bit more give and take...

#if(abs(Norm.x) < 0.1 & abs(Norm.z) < 0.1 & Norm.y != 0)
       sphere {
         Inter, .5
         texture {
           pigment {color green 1}
         }
       }
#end

... but wait for corrections from others (untested).


Post a reply to this message

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