POV-Ray : Newsgroups : povray.newusers : How to get a texture like (y>0.8 & z>0.9) -> texture a else -> texture= b? : Re: How to get a texture like (y>0.8 & z>0.9) -> texture a else -> texture= b? Server Time
2 Nov 2024 05:22:40 EDT (-0400)
  Re: How to get a texture like (y>0.8 & z>0.9) -> texture a else -> texture= b?  
From: Slime
Date: 3 Sep 2004 16:00:53
Message: <4138cd75$1@news.povray.org>
>  function(py,pz) {
>   #if ((py>0.8) & (pz>1-0.1))
>     1
>   #else
>     0
>   #end
>  };

Anything that starts with a # is run at parse-time, not during the render.
Functions are evaluated during the render.

If that actually parsed without a syntax error, then you essentially defined
the function

function(py,pz) {0}

because the #if was parsed through during the function's *definition*, not
while it runs.

If you want to use logical branching in a function, you must use the
select() function (check the documentation for details):

function(py,pz) {
select(py-.8,
0,
select(py-.9,
0,
1
)
}

 - Slime
 [ http://www.slimeland.com/ ]


Post a reply to this message

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