POV-Ray : Newsgroups : povray.advanced-users : Reproducing pigment from functions ... : Re: Reproducing pigment from functions ... Server Time
29 Jul 2024 12:28:54 EDT (-0400)
  Re: Reproducing pigment from functions ...  
From: Abe
Date: 12 Apr 2002 18:00:54
Message: <3CB75832.881C4B28@taconic.net>
...except it still will not work for color component values outside of
the range of 0 to 1 since the technique is limited by the color_map
index range. A workaround (if one knew beforehand the color range) would
involve scaling FNPIG by 1/[maximum expected color range] and setting up
the color_map entries to cover the maximum expected color range.

Abe

Abe wrote:
> 
> #declare REBUILD = pigment {
> average
> pigment_map {
>    [1 function{FNPIG(x,y,z).red}     colour_map {[0 rgbft<-2, 0, 0, 0,
> 0>][1 rgbft< 3, 0, 0, 0, 0>]}]
>    [1 function{FNPIG(x,y,z).green}   colour_map {[0 rgbft< 0,-2, 0, 0,
> 0>][1 rgbft< 0, 3, 0, 0, 0>]}]
>    [1 function{FNPIG(x,y,z).blue}    colour_map {[0 rgbft< 0, 0,-2, 0,
> 0>][1 rgbft< 0, 0, 3, 0, 0>]}]
>    [1 function{FNPIG(x,y,z).filter}  colour_map {[0 rgbft< 1, 1, 1, 0,
> 0>][1 rgbft< 1, 1, 1, 5, 0>]}]
>    [1 function{FNPIG(x,y,z).transmit}colour_map {[0 rgbft< 1, 1, 1, 0,
> 0>][1 rgbft< 1, 1, 1, 0, 5>]}]
>  }
> }
> 
> This seems to work. I'm fairly certain the math is OK, but I still have
> to mull it over. Seemed to worked in a visual comparison test with the
> original and rebuilt pigments side by side.
> 
> Michael Andrews wrote:
> >
> > Warp wrote:
> > >
> > > Michael Andrews <m.c### [at] readingacuk> wrote:
> > > > #declare REBUILD = pigment { ... }
> > >
> > > > how do you define REBUILD to give the same pigment as PIG, based on
> > > > FNPIG?
> > >
> > >   AFAIK, it's not currently possible.
> > >
> > Well, yes it is possible (see the picture I just posted in Gilles' fast
> > cloud thread on p.b.i) but the method I've found is pretty brute-force
> > and klutzy. I was hoping somone would have a bright idea on how to do it
> > better than I have. That's why I haven't posted my attempt yet - I don't
> > want to predispose folks to look at the problem from one direction.
> >
> > If noone comes up with anything by the weekend I'll post my solution.
> >
> > Bye for now,
> >         Mike Andrews.


Post a reply to this message

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