POV-Ray : Newsgroups : povray.advanced-users : replacing colors on an image_map...how? : Re: replacing colors on an image_map...how? Server Time
29 Jul 2024 04:27:35 EDT (-0400)
  Re: replacing colors on an image_map...how?  
From: hughes, b 
Date: 27 Nov 2002 03:22:39
Message: <3de480cf@news.povray.org>
"normdoering" <nor### [at] yahoocom> wrote in message
news:web.3de471b9539782556d954fc00@news.povray.org...
> I know I use to do this prior to 3.5, I think in Megapov, I could change
the
> way an image map was read by giving it it a color_map, but I'm getting
> errors now in 3.5.
>
> Perhaps I've just forgotten the syntax?
>
> Can anyone out there help? What is the syntax for changing colors in an
> image map so that they can perform double duty?
>
> Can it only be done with grey scale or 8-bit palleted images?

Yes. 256 colors so they are indexable like a color map; but also nonindexed
(unmapped) images where the red component is used (had to look that up)
instead. So... only way I know of to do that directly is with material_map.
It's done like so:

#declare IndexColor = 123;

#declare ReplacementColor = color rgb <1,0,0>;

plane {
 z,5
 texture {
     material_map {
         sys "any256bitmap.bmp"
#local I=0;
#while (I<IndexColor)
         texture {}
#local I=I+1;
#end
         texture {
             pigment {color ReplacementColor}
         }
#local I=IndexColor+1;
#while (I<256)
         texture {}
#local I=I+1;
#end
     } // material map
 } // texture
} //plane

light_source {0,1}


I'm guessing you might have already known of this way, and unfortunately
this example here simply blanks the other indices out requiring an
additional step to add the original image back in. That would be to use a
duplicate plane beneath this one and apply a image_map to that one, then use
100% transparency as filler in the material map one.

Well, that's my thoughts on this anyhow.

Farewell,
Bob


Post a reply to this message

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