POV-Ray : Newsgroups : povray.general : using an image_map for media density/color? : Re: using an image_map for media density/color? Server Time
1 Aug 2024 04:12:32 EDT (-0400)
  Re: using an image_map for media density/color?  
From: Mike Williams
Date: 28 Mar 2006 02:06:21
Message: <8qxMFBAS9NKEFwOC@econym.demon.co.uk>
Wasn't it Kenneth who wrote:
>Hi, all!
>
>I'm trying to use an image_map to color some media in a transparent
>box--that is, "extruding" the image_map's colors in the +Z direction,
>"filling" the box from front to back with emitting (or scattering) media,
>the colors of which correspond to the image_map colors.  My image_map has
>an alpha channel as well (the idea being that the transparent parts of the
>image_map will create NO media density.)

If this can be done, then using a single pattern isn't the way to go.
The problem is that you want all four colour channels to affect the
colour and density of the media, but using a pattern reduces the data to
a single channel.

        density {image_pattern {png "my_image.png"}}

You can split your image into three: red*alpha, green*alpha, blue*alpha.
Then use an interior that contains three media components. Since you're
using emission media, black is the same as transparent. 

interior {
  media {
    emission .5
    density {
      image_pattern {png "red.png"}
      colour_map {[0 rgb 0][1 rgb x]}
    }
  }
  media {
    emission .5
    density {
      image_pattern {png "green.png"}
      colour_map {[0 rgb 0][1 rgb y]}
    }
  }
  media {
    emission .5
    density {
      image_pattern {png "blue.png"}
      colour_map {[0 rgb 0][1 rgb z]}
    }
  }
}

For the other types of media, things get a little more complicated.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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