|
|
Impress <yha### [at] nospamhotmailcom> wrote:
> well, I'm still on my quest to master pov-ray! I want to create a 2D array
> of cubes where each cube will have a different single color according to an
> image_map.
Try this with an image called "test.jpg" (or whatever) in the same
directory as the scene file:
#declare Image =
function { pigment { image_map { jpeg "test.jpg" } } }
#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, 0,
-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 }
> In a more general manner, I would like to know how to retrieve data inside
> the image_map to be use as a generic data inside my POV-RAY code.. so that
> I can use a map to store any kind of data that I can use later in the code.
Unfortunately image maps are not data containers which you can modify
freely. Even the trick above is just a workaround to get individual
values from the image map.
--
#macro N(D)#if(D>99)cylinder{M()#local D=div(D,104);M().5,2pigment{rgb M()}}
N(D)#end#end#macro M()<mod(D,13)-6mod(div(D,13)8)-3,10>#end blob{
N(11117333955)N(4254934330)N(3900569407)N(7382340)N(3358)N(970)}// - Warp -
Post a reply to this message
|
|