POV-Ray : Newsgroups : povray.binaries.images : The dark side of the trees (121 kbu) : Re: The dark side of the trees (121 kbu) Server Time
15 Aug 2024 12:15:47 EDT (-0400)
  Re: The dark side of the trees (121 kbu)  
From: Christopher James Huff
Date: 23 Jul 2002 22:03:59
Message: <chrishuff-E3E08F.20564823072002@netplex.aussie.org>
In article <4vnrju8p4dnopfhb4ckuc4narsdevjg2j5@4ax.com>,
 Peter Popov <pet### [at] vipbg> wrote:

> >(you render in a 48 bits PNG, you use it as an image_map
> >  that fits exactly the screen, and you process it using
> >  eval_pigment and reconsturct the image with colored
> >  boxes)
> 
> I'd rather use a function pigment for that - much faster than parsing
> a gazillion boxes.

That's a good idea...you could do the same thing as the post_process 
curves filter without needing the patch, though it would still have the 
limitations of what you can put through a PNG file. A image_map pigment 
function run through three spline functions and combined into the final 
image with an average pigment would do the trick:

#declare imgFn = function {pigment {image_map {...}}}
#declare rCurveFn = function {spline {...}}
#declare gCurveFn = function {spline {...}}
#declare bCurveFn = function {spline {...}}

...
pigment {average
    pigment_map {
        [pigment {function {rCurveFn(imgFn(x, y, z).red).x}
            color_map {[0 rgb 0][1 rgb < 3, 0, 0>]}}]
        [pigment {function {gCurveFn(imgFn(x, y, z).green).x}
            color_map {[0 rgb 0][1 rgb < 0, 3, 0>]}}]
        [pigment {function {bCurveFn(imgFn(x, y, z).blue).x}
            color_map {[0 rgb 0][1 rgb < 0, 0, 3>]}}]
    }
}

I used three splines here to make it easier to adjust each channel 
separately, since splines use vectors you should be able to use just one 
spline. You could also do things like use a spline value to scale the 
color according to the brightness of the color.

-- 
Christopher James Huff <chr### [at] maccom>
POV-Ray TAG e-mail: chr### [at] tagpovrayorg
TAG web site: http://tag.povray.org/


Post a reply to this message

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