POV-Ray : Newsgroups : povray.general : At-render texture blending : Re: At-render texture blending Server Time
30 Jul 2024 08:23:09 EDT (-0400)
  Re: At-render texture blending  
From: Alain
Date: 29 Nov 2009 16:41:20
Message: <4b12ea80$1@news.povray.org>

> "Siber" <nomail@nomail> wrote:
> 
>> I had originally exported them simply as black and white images, white
>> representing where the color should be added. I have since put the information
>> in the alpha channel as well, in an attempt to get layering to work, but haven't
>> been successful in that yet.
> 
> 
> 
> 
> It sounds like you should be able to use the image_map as a pigment function,
> then make the color_map match the colors you want.  I believe someone above
> mentioned this, so here is some sample code:
> 
> //--------------
> #declare ImageMap = function{
>     pigment{
>         image_map{
>             "test.png"
>             map_type 0
>             interpolate 2
>         }
>     }
> }
> 
> 
> box{
>     0, 1
>     pigment{
>         function{ ImageMap(x,y,z).gray }
>         color_map{
>         // color of the black areas of the image
>         [0.00 color rgb <0.5,0.5,0.5> ]
>         // color of the white areas of the image
>         [1.00 color rgb <1.0,0.0,0.0> ]
>             }
>     }
> }
> 
> //--------------
> 
> The image "test.png" is a grayscale png, and the color_map determines what the
> actual colors will be.  You could use this in a layered pigment, and set some of
> the colors to be transparent.  Alternatively, you could use this in a
> pigment_map, and specify different pigments to be associated with the grayscale
> range of the input image.
> 
>     HTH
>  -Reactor
> 
> 
You can even do this:

box{
     0, 1
     texture{
         function{ ImageMap(x,y,z).gray }
         texture_map{
         // Make the black areas glow with a bozo pattern
         [0.00 texture{ pigment{boso scale 0.1}finish{ambient 1 diffuse 
0}} ]
         // Make the white parts a red mirror
         [1.00 texture{ pigment{rgb <1.0,0.0,0.0>}finish{ambient 0 
diffuse 0.1 reflection 0.8}} ]
             }
     }
}



Alain


Post a reply to this message

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