POV-Ray : Newsgroups : povray.advanced-users : Pigment functions... : Re: Pigment functions... Server Time
6 Oct 2024 13:49:48 EDT (-0400)
  Re: Pigment functions...  
From: Trevor G Quayle
Date: 11 Sep 2006 08:30:01
Message: <web.45055691a29fb3bbc150d4c10@news.povray.org>
Orchid XP v3 <voi### [at] devnull> wrote:
> >> Any hints?
> >
> > Does this help? It's approximated using the default assumed_gamma, and
> > may not be perfect, but it's a start:
>
> I see... So a pigment function has to be colour_mapped? That would
> explain why it's not working.
>
> Ah, but I can extract all three colour components, turn each into a
> pigment, and average them together... ingenius!
>
> OK, I'll give that a go.
>
> PS. I'm not using any gamma correction at all - I don't know what it is
> or how it works. So...

Yes, functions don't carry vectors.  Here is a simple example of how I use
it (I use the .red, .green and .blue filters rather than .x, .y and .z):

//START
  #local PIMAGE = function {pigment{image_map {sys ImageMap interpolate 2}}}

  #local FRd=function(x,y) {PIMAGE(x,y,0).red }
  #local FGn=function(x,y) {PIMAGE(x,y,0).green }
  #local FBl=function(x,y) {PIMAGE(x,y,0).blue }

      box{<0,0,0>,<1,1,1>
        texture{average
          texture_map{
              [pigment{function{FRed(x,y)} color_map{[0 rgb 0][1 rgb
<1,0,0>]}} finish {ambient 3 diffuse 0}]
              [pigment{function{FGrn(x,y)} color_map{[0 rgb 0][1 rgb
<0,1,0>]}} finish {ambient 3 diffuse 0}]
              [pigment{function{FBlu(x,y)} color_map{[0 rgb 0][1 rgb
<0,0,1>]}} finish {ambient 3 diffuse 0}]
            #end
          }
        }
      }

//END

-tgq


Post a reply to this message

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