imagemappingraytracingimagemappovray

image_map in Pov-ray not working as expected


I would like to map an image I have to the face of a box in Pov-ray.

The image's dimensions are 1500x1125 (Example Image)

So I set up a scene with a light source above a camera looking at a box

camera{location <3,1.8,0> look_at <3,1.8,1>}
light_source{<3,20,0>  color rgb <1,1,1>}
box{<0,0,0> <1,0.75,1> texture{pigment{image_map{png "Test1.png"}}} translate <2.5,1.425,3>}

The box's dimensions are 1x0.75 (z not relevant) which has the same 4:3 ratio as the image.

However, when the scene is rendered, the width of the image maps perfectly onto the box but some of the height is cut off. The image does not look stretched and I am confused why it does not fit.


Solution

  • IIRC, porvray will always read images as if they had a 1:1 aspect ratio. If you insert a scale inside your pigment statement, before using it, that should fix it:

    box{
       <0,0,0> <1,0.75,1> 
       texture{
           pigment {
               image_map{png "Test1.png"}
               scale <1, 0.75, 1>
           }
       } translate <2.5,1.425,3>
    }
    

    (I apologize for not testing this to be really sure right now).