POV-Ray : Newsgroups : povray.newusers : How to use self defined functions as patterns? : How to use self defined functions as patterns? Server Time
16 Apr 2024 13:30:56 EDT (-0400)
  How to use self defined functions as patterns?  
From: rastertastic
Date: 2 Apr 2018 09:05:01
Message: <web.5ac22a4ac20ce887122abcd30@news.povray.org>
Just started using Povray really don't understand almost anything about it yet,
so maybe I should peruse the manual more but instead I will ask a question with
the risk of not making sense.

Section "3.4.7.1.12 Function Pattern" explains that it's possible to define a
function and use that as a pattern. The manual gives an example:
#declare Foo = function { x + y + z}.

Ok but that function doesn't give values in the range [0,1], for example in the
positive x,y plane Foo just keeps growing.

So if I want to use that function as the pattern type for, say, a color map, can
I specify such ever larger values in the color map.

For example could I use a color map like

color_map {
  [0  color Red]
  [10  color Green]
  [20  color Blue]
  [30  color Pink]
  }

But rendering the following doesn't produce what I might expect if that is
supposed to work:

plane { <0, 1, 0>, 0
    texture {
      pigment { function { Foo(x, y, z) }

               color_map {
                 [0  color Red]
                 [10  color Green]
                 [20  color Blue]
                 [30  color Pink]
               }
      }
    }

}

So basically I'm asking clarification on how to use such self-defined functions
like  x + y + z  as patterns with, say, color maps.


Post a reply to this message

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