###### Descriptions and Examples for the POV-Ray Raytracerby Friedrich A. Lohmüller Design of Surfaces by "texture" with POV-Ray -
Deutsch
Italiano
Français

Home
- POV-Ray Tutorial

Design of Surfaces
- Colors and Textures
Index

texture Syntax
Do-it-yourself Colors
Patterns
Patterns Lists
- Regular Patterns
- Random Patterns
- Fractal Patterns
- Other Patterns
Warps
- warp mapping
> uv_mapping
Mapping
Superpositions

Surface Mapping with 'uv_mapping'

Processural patters are normally defined in the 3D space, but often we have patterns for textures, which are only defined in a 2D plane. Such patterns mostly do not fit well to 3D surfaces of rounded shapes.
The patterns of checker, hexagon, square, triangle, tiling and pavement are defined in the xz plane. These patterns must be rotated by a 'rotate<-90,0,0> to fit to a slice in the xy plane. The patterns of brick and image_map are already defined in the xy plane.
'uv_mapping' is a method to let such pattern fit bei warping the patterns around an object. The points of a 2D pattern are descriped with by 2D vectors, uv-vectors, in so-called uv-coordinates (u,v).
The u coordinate goes from 0 to 1 (width of the pattern or image), the v coordinate goes upward from 0 to 1 (the heigth of the pattern or image).

Surface mapping by 'uv_mapping' is currently defined in POV-Ray for the following objects:

1. box :   a box mapping or cube mapping like shown with 'Sky_Box' and cubemaps.
2. sphere : so-called 'spherical mapping' like with 'Sky_Domes' and skymaps.
3. lathe, sor: with a modified spherical mapping. Here: u (0...1) wraps around y axis, v coordinate linked to object's control points (0..1).
4. mesh, mesh2: UV coordinates are defined for each vertex and interpolated between.
5. bicubic_patch: UV coordinates based on patch's parametric coordinates, stretching with the control points.
6. parametric: map taken by the boundaries of the uv-space, where the parametric surface has to be calculated.
7. torus : map taken from the area <0,0><1,1> Wrapping u-coordinate around the major radius, v-coordinate around minor radius.
General Syntax for uv_mapping:
 ```texture { uv_mapping pigment{PIGMENT_BODY} | pigment{uv_mapping PIGMENT_BODY} uv_mapping normal {NORMAL_BODY } | normal {uv_mapping NORMAL_BODY } uv_mapping texture{TEXTURE_BODY} | texture{uv_mapping TEXTURE_BODY) }```

uv_mapping for box
The mapping scheme for a box is shown by the following 2 images:
Cube Mapping scheme in uv-coordinates Wrapping of a pattern with Cube Mapping

UV_mapping on a box with a pattern in the xz plane
tiling with a base length of 1 unit:
The pattern must be scaled down to 1/4 to have the same size as on a plane.
Example:
 ```box{ <0,0,0>,<1.6,0.5,1> texture { uv_mapping pigment{ tiling 6 // 1~24 Pattern_Number color_map{ [ 0.0 color rgb<1,1,1>] [ 1.0 color rgb<0,0,0>] } // end color_map scale 0.10/4 rotate<-90,0,0> scale<1/1.6,2,1> } // end pigment finish { phong 1} } // end of texture translate<0,0.0,0> } // end of box ------------------------```

uv_mapping on a box
UV_mapping on a box with uneven length / height
tiling with a base length of 1 unit:
The pattern must be scaled inverse to the box sides!
Example:
 ```box{ <0,0,0>,<1.6,0.5,1>; texture { uv_mapping pigment{ tiling 6 // 1~24 Pattern_Number color_map{ [ 0.0 color rgb<1,1,1>] [ 1.0 color rgb<0,0,0>] } // end color_map scale 0.10/4 rotate<-90,0,0> scale<1/1.6,1/0.5,1> } // end pigment finish { phong 1} } // end of texture translate<0,0.0,0> } // end of box ------------------------```

uv_mapping on a box

uv_mapping for sphere
A pattern in the xz plane mapped on a sphere:
Example:
 ```sphere{ <0,0,0>, 0.75 texture { uv_mapping pigment{ tiling 6 // 1~24 Pattern_Number color_map{ [ 0.0 color rgb<1,1,1>] [ 1.0 color rgb<0,0,0>] } // end color_map scale 0.025 rotate<-90,0,0> } // end pigment finish { phong 0.1} } // end of texture translate<0.5,0.5,0.5> } // end of sphere -------------------------```
And with a more colorful color_map:
 ```#declare Pigment_1 = pigment{ tiling 3 // 1~24 Pattern_Number color_map{ [ 0.0 color rgb<1,1,1>] [ 0.5 color rgb<1,0,0>] [ 1.0 color rgb<0,0,0>] } // end color_map scale 0.075 rotate<-90,0,0> } // end pigment // ----------------------------------------- sphere{ <0,0,0>, 0.75 texture { pigment{ uv_mapping Pigment_1 } normal { uv_mapping pigment_pattern{ Pigment_1 } 0.25} // end normal finish { phong 0.1} } // end of texture translate<0.5,0.5,0.5> } // end of sphere -------------------------```
The same effect by a warped tiling:
 ```#declare Pigment_1 = pigment{ tiling 6 // 1~24 Pattern_Number color_map{ [ 0.0 color rgb<1,1,1>] [ 0.5 color rgb<1,0,0>] [ 1.0 color rgb<0,0,0>] } // end color_map scale 0.075 rotate<-90,0,0> warp{ spherical orientation <0,0,1> dist_exp 0 } // end of warp } // end pigment //------------------------------------------ sphere{ <0,0,0>, 0.75 texture { // no uv_mapping ! pigment{ Pigment_1 } // end pigment normal{ pigment_pattern{ Pigment_1 } 0.5} // end normal finish { phong 0.1} } // end of texture translate<0.5,0.5,0.5> } // end of sphere -------------------------```

uv_mapping on a sphere

uv_mapping on a sphere

warped tiling on a sphere
For more about 'warp' see here:Mapping with Warps

uv_mapping for torus
A tiling pattern in the xz plane mapped on a torus:
Example:
 ```sphere{ <0,0,0>, 0.75 texture { uv_mapping pigment{ tiling 6 // 1~24 Pattern_Number color_map{ [ 0.0 color rgb<1,1,1>] [ 0.5 color rgb<1,0,0>] [ 1.0 color rgb<0,0,0>] } // end color_map rotate<-90,0,0> //frequency 10 scale<0.05,0.2,1>*0.25 } // end pigment finish { phong 0.1} } // end of texture translate<0.5,0.5,0.5> } // end of torus -------------------------```

uv_mapping on a torus uv_mapping on a torus 'frequency 10'

top