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
30 Jul 2024 06:18:35 EDT (-0400)
  Re: How to get a texture like (y>0.8 & z>0.9) -> texture a else -> texture=b?  
From: gonzo
Date: 4 Sep 2004 02:11:47
Message: <41395ca3@news.povray.org>
D. H. Berlin wrote:
> I hope the title says all :)
> 
> I have tried with a function and an declare:
> #declare myfu =
>  function(py,pz) {
>   #if ((py>0.8) & (pz>1-0.1))
>     1
>   #else
>     0
>   #end
>  };
> 
> #declare stufe_holz_metal =
>     texture {
>       function { myfu(y,z) }
>       texture_map {
>         [ 0.0 tex_a ]  // tex_a and tex_b are declared elsewhere
>         [ 1 tex_b ]
>       }
>     };
> 
> But that doesn't work.


You can put your textures in an array;

#declare Mytexture = array[2] {
   ...tex_a,
   ...tex_b
}

Then use something like;

object {
   Myobject
   texture {
     Mytexture[ ((py>0.8) & (pz>1-0.1)) ]
   }
}

RG


Post a reply to this message

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