POV-Ray : Newsgroups : povray.advanced-users : Reproducing pigment from functions ... : Re: Reproducing pigment from functions ... Server Time
29 Jul 2024 12:14:24 EDT (-0400)
  Re: Reproducing pigment from functions ...  
From: David Wallace
Date: 12 Apr 2002 20:58:22
Message: <3cb782ae$1@news.povray.org>
"RAY" <RAY### [at] yahoocom> wrote in message news:3cb73511@news.povray.org...
>
>
> --
> __________________
>  RAY
> "Michael Andrews" <m.c### [at] readingacuk> wrote in message
> news:3CB### [at] readingacuk...
> > Hi Folks,
> >
> > I was playing with Gilles' cloud pigment and hit a problem: what is the
> > best (ie fastest rendering) way to reproduce an arbitrary pigment from
> > it's function?
> >
> > For example, given
> >
> > #declare PIG = pigment { bozo colour_map {[0.2 rgbf 1][0.5 rgb
> > y*1.3][0.7 rgb x transmit 1] } }
> > #declare FNPIG = function { pigment { PIG } }

Replace this with a five-parameter function:

#declare FNPIG = function(rd,gr,bl,ft,tr) { pigment { PIG } }

> >
> > #declare REBUILD = pigment { ... }
> >
> > how do you define REBUILD to give the same pigment as PIG, based on
> > FNPIG?
> >
> > Normally it's just a matter of
> >
> > #declare REBUILD = pigment {
> >   average
> >   pigment_map {
> >     [1 function { FNPIG(x,y,z).x } colour_map {[0 rgb 0][1 rgb 3*x]} ]
> >     [1 function { FNPIG(x,y,z).y } colour_map {[0 rgb 0][1 rgb 3*y]} ]
> >     [1 function { FNPIG(x,y,z).z } colour_map {[0 rgb 0][1 rgb 3*z]} ]
> >   }
> > }
>
> would #declare REBUILD = pigment {function {FNPIG}}; work

After replacing the FNPIG function, the simple declare should work:

#declare REBUILD = pigment { function(rd,gr,bl,ft,tr) {FNPIG}}

>
> > but with filter, transmit or colours with values greater than one this
> > doesn't work.
> >
> > I've come up with one structure which works, but is very slow for how I
> > am using it.
> >
> > So, I was hoping someone can come up with a better method. Any takers?
> Yes ;-)
>
>


Post a reply to this message

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