6.3.5 UV-Mappings

From [pov:6.7.7]:
All textures in POV-Ray are defined in 3 dimensions. Even planar image mapping is done this way. However, it is sometimes more desirable to have the texture defined for the surface of the object. This is especially true for bicubic_patch objects and mesh objects, that can be stretched and compressed. When the object is stretched or compressed, it would be nice for the texture to be glued to the object's surface and follow the object's deformations.

When uv_mapping is used, then that object's texture will be mapped to it using surface coordinates (u and v) instead of spatial coordinates (x, y, and z). This is done by taking a slice of the object's regular 3D texture from the XY plane (Z=0) and wrapping it around the surface of the object, following the object's surface coordinates.

Note: some textures should be rotated to fit the slice in the XY plane.

Syntax:
texture {
 pigment { uv_mapping PIGMENT_BODY }
 normal  { uv_mapping NORMAL_BODY  }
 texture { uv_mapping TEXTURE_BODY }
}

Surface mapping is currently defined for the following objects:

bicubic_patch UV coordinates are based on the patch's parametric coordinates. They stretch with the control points. The default range is (0..1) and can be changed.

mesh, mesh2 UV coordinates are defined for each vertex and interpolated between.

lathe, sor modified spherical mapping... the u coordinate (0..1) wraps around the y axis, while the v coordinate is linked to the object's control points (also ranging 0..1). Surface of Revolution also has special disc mapping on the end caps if the object is not 'open'.

sphere boring spherical mapping.

box the image is wrapped around the box.

With the keyword uv_vectors, the UV coordinates of the corners can be controlled for bicubic patches and standard triangle mesh.

For bicubic patches the UV coordinates can be specified for each of the four corners of the patch. This goes right before the control points. The syntax is:

  uv_vectors <corner1>,<corner2>,<corner3>, <corner4>
with default
  uv_vectors <0,0>,<1,0>,<1,1>,<0,1>

Similarly for mesh it looks like

	mesh {
	  triangle { ... }
		uv_vectors <0.0>,<1,0>,<1,1>
		...
		texture { pigment { uv_mapping image_map ... } }
	}

Interior Texture

From [pov:6.7.9]:
Syntax:

object {
  texture { TEXTURE_ITEMS... }
  interior_texture { TEXTURE_ITEMS...}
}

All surfaces have an exterior and interior surface. The interior_texture simply allows to specify a separate texture for the interior surface of the object. For objects with no well defined inside/outside (bicubic_patch, triangle, ...) the interior_texture is applied to the backside of the surface. Interior surface textures use exactly the same syntax and should work in exactly the same way as regular surface textures, except that they use the keyword interior_texture instead of texture.

Note: Do not confuse interior_texture {} with interior {}: the first one specifies surface properties, the second one specifies volume properties.

Andreas Kriegl 2003-07-23