POV-Ray : Newsgroups : povray.general : How to: use a image_map to retrieve single color? : Re: How to: use a image_map to retrieve single color? Server Time
2 Jun 2024 13:08:56 EDT (-0400)
  Re: How to: use a image_map to retrieve single color?  
From: Impress
Date: 4 Sep 2004 18:20:01
Message: <web.413a3e6ee30d052f902216110@news.povray.org>
Thank you very much Warp! :)

This is very useful. I modify your example in order to use the value of the
image maps as an individual value. I translate each cube according to the
green component of the picture. It work well, and I think base on that
thing I can use the value to compute any kind of stuff! :)

here it's your example modified...


// create a regular point light source
#declare Image =
  function { pigment { image_map { png "firstMap.png" } } }

#declare ImageWidth = 160;
#declare ImageHeight = 120;

#declare IndY = 0;
#while(IndY < ImageHeight)
  #declare IndX = 0;
  #while(IndX < ImageWidth)

    #declare ImageColor =
      Image(IndX/ImageWidth, IndY/ImageHeight, 0);

    box
    { -.4, .4 pigment { color ImageColor }
      translate <-ImageWidth/2 + IndX, 10.0*ImageColor.green,
                 -ImageHeight/2 + IndY>
    }

    #declare IndX = IndX+1;
  #end
  #declare IndY = IndY+1;
#end

camera { location <25, 200, -125> look_at 0 angle 35 }
light_source { <200, 500, -100>, 1 }

// ------------

btw, I modified the filename to match the file that I put in my test dir.
but you probably figure it out... ;)

thanks!
impress/OPV


Post a reply to this message

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