POV-Ray : Newsgroups : povray.general : hi~, everybody, how to modulate two bmp files with the third bmp file? : Re: hi~, everybody, how to modulate two bmp files with the third bmp file? Server Time
1 Aug 2024 22:20:27 EDT (-0400)
  Re: hi~, everybody, how to modulate two bmp files with the third bmp file?  
From: Christopher James Huff
Date: 10 Mar 2005 09:17:03
Message: <cjameshuff-060E72.09170110032005@news.povray.org>
In article <web.42300839aa72325b598059850@news.povray.org>,
 "lien0n" <nomail@nomail> wrote:

> plane{z,-0.00001
>   pigment {
>     image_map {
>       function 256 128 { pigment {
>         color (1-Factor(x,y,z).gray)*Wetting(x,y,z) +
> Drying(x,y,z)*Factor(x,y,z).gray     (*)
>       }}
>     }
>   }
> }

Break the pigment out to see what's going wrong:
pigment {
    color (1-Factor(x,y,z).gray)*Wetting(x,y,z) +
           Drying(x,y,z)*Factor(x,y,z).gray
}

Put simply...you can't do this. There's no mechanism in standard POV-Ray 
for taking a color function and using it directly as a pigment color. If 
there were (and if this were corrected to extract gray values from 
Wetting() and Drying()), this would still give a grayscale result.

It is possible, though...just a bit tricky. You have to average 3 
separate pigments, with the colors multiplied by 3 to counter the divide 
in the average so you can get a straight add.

pigment {average
    pigment_map {
        [1
            function {(1-Factor(x,y,z).red)*Wetting(x,y,z).red +
               Drying(x,y,z).red*Factor(x,y,z).red}
            color_map {[0 rgb 0] [1 red 3]}
        ]
        [1
            function {(1-Factor(x,y,z).green)*Wetting(x,y,z).green +
               Drying(x,y,z).green*Factor(x,y,z).green}
            color_map {[0 rgb 0] [1 green 3]}
        ]
        [1
            function {(1-Factor(x,y,z).blue)*Wetting(x,y,z).blue +
               Drying(x,y,z).blue*Factor(x,y,z).blue}
            color_map {[0 rgb 0] [1 blue 3]}
        ]
    }
}

Oh, and for the sake of your disk space, bandwidth, and everyone else, 
please don't use BMPs. PNGs let you do everything they do and more, are 
compressed, and are lossless.

-- 
Christopher James Huff <cja### [at] gmailcom>
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/


Post a reply to this message

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