POV-Ray : Newsgroups : povray.advanced-users : replacing colors on an image_map...how? Server Time
29 Jul 2024 06:22:24 EDT (-0400)
  replacing colors on an image_map...how? (Message 1 to 3 of 3)  
From: normdoering
Subject: replacing colors on an image_map...how?
Date: 27 Nov 2002 02:20:04
Message: <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?

-- normdoering


Post a reply to this message

From: hughes, b 
Subject: Re: replacing colors on an image_map...how?
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

From: Johannes Dahlstrom
Subject: Re: replacing colors on an image_map...how?
Date: 27 Nov 2002 08:22:57
Message: <3de4c731@news.povray.org>
normdoering wrote:

> 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?

There's the image_pattern, which uses a (internally grayscaled) image as a 
pattern. Then it can be used anywhere a pattern can be used with an 
appropriate kind of blend map (eg. color_map, texture_map, density_map...).


Post a reply to this message

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