|
![](/i/fill.gif) |
Wasn't it Eric James who wrote:
>
>The closest I can see would be to use custom functions to do it, which is
>above my knowledge level without a bit of further guidance or examples, for
>which I would be extremely appreciative.
It's not easy. What you have to do is this:
Declare pigment functions from the two image maps
#declare IM1 = function {pigment {image_map {jpeg "tex1.jpg" interpolate 2}}}
#declare IM2 = function {pigment {image_map {jpeg "tex2.jpg" interpolate 2}}}
Perform separate mathematical operations on the red, green and blue channels, to
produce three blended pigments, one for each colour channel. These pigment
functions need to have a colour_map that triples the brightness (see later).
You can perform whatever arithmetic operations you want here. I'm just going to
add them.
#declare R = pigment {function {IM1(x,y,z).red + IM2(x,y,z).red}
colour_map{[0 rgb 0][1 rgb <3,0,0>]}}
#declare G = pigment {function {IM1(x,y,z).green + IM2(x,y,z).green}
colour_map{[0 rgb 0][1 rgb <0,3,0>]}}
#declare B = pigment {function {IM1(x,y,z).blue + IM2(x,y,z).blue}
colour_map{[0 rgb 0][1 rgb <0,0,3>]}}
Finally assemble the three component pigments using an "average" pigment_map.
By averaging three pigments that are on different colour channels, the
brightness gets divided by 3. That's why we tripled the brightness earlier.
E.g. if the output colour of a particular pixel is white, we'd get that by the
fact that (<3,0,0> + <0,3,0> + <0,0,3>)/3 = <1,1,1>.
sphere {0,1
pigment {average
pigment_map {
[1 R]
[1 G]
[1 B]
}
}
}
--
Mike Williams
Gentleman of Leisure
Post a reply to this message
|
![](/i/fill.gif) |