POV-Ray : Newsgroups : povray.pov4.discussion.general : Feature request: "resolution" keyword for gradients and maps : Re: Feature request: "resolution" keyword for gradients and maps Server Time
7 May 2024 23:40:21 EDT (-0400)
  Re: Feature request: "resolution" keyword for gradients and maps  
From: SharkD
Date: 23 Jun 2008 22:25:01
Message: <web.48605a1a9d0a8abb1729cc4e0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> SharkD <nomail@nomail> wrote:
> > Could you please post an example?
>
> #default { finish { ambient 1 } }
> background { rgb z*.5 }
> camera { location <0, 0, -10> look_at 0 angle 35 }
>
> #declare ThePattern = function { pattern { gradient y } };
> #declare SteppedPattern = function { int(10*ThePattern(x, y, z))/10 };
>
> // Original pattern:
> box
> { <-1, -2, 0>, <1, 2, .1>
>   pigment
>   { function { ThePattern(x, y, z) }
>     color_map { [0 rgb 0][1 rgb 1] }
>   }
>   translate -x*1.1
> }
>
> // Stepped pattern:
> box
> { <-1, -2, 0>, <1, 2, .1>
>   pigment
>   { function { SteppedPattern(x, y, z) }
>     color_map { [0 rgb 0][1 rgb 1] }
>   }
>   translate x*1.1
> }
>
>
> --
>                                                           - Warp

Thanks for the response! I turned your suggestion into a wiki article so that
others may benefit from it.

http://wiki.povray.org/content/HowTo:Turn_a_function_into_a_stepped_function

-Mike


Post a reply to this message

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