POV-Ray : Newsgroups : povray.newusers : Calculating the pigment RGB values with functions? : Re: Calculating the pigment RGB values with functions? Server Time
5 Oct 2024 15:54:40 EDT (-0400)
  Re: Calculating the pigment RGB values with functions?  
From: clipka
Date: 17 Sep 2009 19:51:18
Message: <4ab2cb76$1@news.povray.org>
Hadmut Danisch schrieb:
> 
> How would I achieve to have texture where all four channels (rgbt) are
> calculated with function?

At present, the virtual machine used to implement functions in POV-Ray 
does not support vectors. However, you can achieve the desired effect 
with average pigments as follows:

- Declare four functions, one for each of R, G and B and T.

- Mix and color the RGB components using the 'average' pattern (note 
that each component is "colorized" with a factor of 3):

    #declare MyPigmentRGB = pigment {
      average
      pigment_map {
        [1 function { MyFnR(x,y,z) } color_map [0 rgb 0][1 red   3]]
        [1 function { MyFnG(x,y,z) } color_map [0 rgb 0][1 green 3]]
        [1 function { MyFnB(x,y,z) } color_map [0 rgb 0][1 blue  3]]
      }
    }

- To mix in the transparency, use another pigment map to fade between 
the RGB pigment as above, and a purely transparent pigment:

    #declare MyPigmentRGBT = pigment {
      function { MyFnT(x,y,z) }
      pigment_map {
        [0 MyPigmentRGB]
        [1 color rgbt 1]
      }
    }

(Didn't test either of these; I may have introduced one or two syntax 
errors.)


Post a reply to this message

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