POV-Ray : Newsgroups : povray.newusers : color modulation in textures : Re: color modulation in textures Server Time
30 Jul 2024 00:18:34 EDT (-0400)
  Re: color modulation in textures  
From: Mike Williams
Date: 12 May 2005 05:10:10
Message: <0G$OuCAD1xgCFwFp@econym.demon.co.uk>
Wasn't it tahoma who wrote:
>> #declare R = pigment {function {IM(x,y,z).red * Cr}
>>    colour_map {[0 rgb 0][1 rgb <1,0,0>]}}
>> #declare G = pigment {function {IM(x,y,z).green * Cg}
>>    colour_map {[0 rgb 0][1 rgb <0,1,0>]}}
>> #declare B = pigment {function {IM(x,y,z).blue * Cb}
>>    colour_map {[0 rgb 0][1 rgb <0,0,1>]}}
>>
>> Then assemble the three components using an average pigment_map
>>
>> sphere {0,1
>>   pigment {average
>>     pigment_map {
>>       [1 R]
>>       [1 G]
>>       [1 B]
>>     }
>>   }
>> }
>
>The assembled colors are just 1/3 of the intensity as the original
>one's. I replaced Cr/Cg/Cb by 1/1/1. The average function
>calculates (1*<1,0,0> + 1*<0,1,0> + 1*<0,0,1>)/3 = <1/3,1/3,1/3>.
>If i could use 'add' instead of 'average' of disable the division
>by the weight sum ... any ideas?

A safe place to multiply by 3 is in the colour_map, so that it
calculates (1*<3,0,0> + 1*<0,3,0> + 1*<0,0,3>)/3.

#declare R = pigment {function {IM(x,y,z).red * Cr}
   colour_map {[0 rgb 0][1 rgb <3,0,0>]}}
#declare G = pigment {function {IM(x,y,z).green * Cg}
   colour_map {[0 rgb 0][1 rgb <0,3,0>]}}
#declare B = pigment {function {IM(x,y,z).blue * Cb}
   colour_map {[0 rgb 0][1 rgb <0,0,3>]}}

(If you multiply Cr, Cb and Cg by 3 it almost works, but, since it's
used in the pattern calculation, when the pattern calculation gives 1.0
it gets truncated down to 0.0 which is not what we want.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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