RovRay Image Mapping

In memory of my great friend and colleague, late Dr. Mark Harris. This page was made possible by his great lectures in this course in 2000.

In POV-Ray mapping, an image, which can be in gif, tga, and png formats among others, is mapped to the unit square [0,1] x [0,1], then projected in the z direction. This will hit a cube "head-on", but will wrap around a sphere or other curved shape in a generally less useful way. By constrast, in OpenGL we can (and are forced to) assign texel to point associations to control the map any way we want.

If we map a picture snow.bmp (Note this image is different from the one on the box) onto a unit cube, then no scaling is necessary. Here's an example:

` background {color rgb <1,1,1>} camera {    location <1.5, 1.3, -1.5>    look_at <.5 .5 .5>  }  light_source { <15, 10, -10> color rgb 1}  plane { y, 0    pigment { checker color rgb <1,0,0> , color rgb 1 }    finish { ambient .5 diffuse .5 }    scale 0.5  }    box{ <0 0 0> <1 1 1>  pigment    {   image_map {gif "snow.gif"} }   finish {ambient .6 diffuse .6}     } `

If we change the scale of the box, the picture is tiled onto the surface:

` background {color rgb <1,1,1>} camera {    location <2.5, 2.3, -2.5>    look_at <.5 .5 .5>  }  light_source { <15, 10, -10> color rgb 1}  plane { y, 0    pigment { checker color rgb <1,0,0> , color rgb 1 }    finish { ambient .5 diffuse .5 }    scale 0.5  }    box{ <0 0 0> <2 2 2>  pigment    {   image_map {gif "snow.gif"} }   finish {ambient .6 diffuse .6}     } We can add the word "once" to suppress the tiling: background {color rgb <1,1,1>} camera {    location <2.5, 2.3, -2.5>    look_at <.5 .5 .5>  }  light_source { <15, 10, -10> color rgb 1}  plane { y, 0    pigment { checker color rgb <1,0,0> , color rgb 1 }    finish { ambient .5 diffuse .5 }    scale 0.5  }    box{ <0 0 0> <2 2 2>  pigment    {   image_map {gif "snow.gif" once} }   finish {ambient .6 diffuse .6}     }Better still, we can change the scale of the image map:  background {color rgb <1,1,1>} camera {    location <2.5, 2.3, -2.5>    look_at <.5 .5 .5>  }  light_source { <15, 10, -10> color rgb 1}  plane { y, 0    pigment { checker color rgb <1,0,0> , color rgb 1 }    finish { ambient .5 diffuse .5 }    scale 0.5  }    box{ <0 0 0> <2 2 2>  pigment    {   image_map {gif "snow.gif"} scale 2 }   finish {ambient .6 diffuse .6}     }`