| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 
 | 
<!--  This file copyright Persistence of Vision Raytracer Pty. Ltd. 2003-2004  -->
<html> 
<head>
  
<!--  NOTE: In order to users to help find information about POV-Ray using  -->
 
<!--  web search engines, we ask you to *not* let them index documentation  -->
 
<!--  mirrors because effectively, when searching, users will get hundreds  -->
 
<!--  of results containing the same information! For this reason, the two  -->
 
<!--  meta tags below disable archiving and indexing of this page by all  -->
 
<!--  search engines that support these meta tags.  -->
 
 <meta content="noarchive" name="robots">
   
 <meta content="noindex" name="robots">
   
 <meta content="no-cache" http-equiv="Pragma">
   
 <meta content="0" http-equiv="expires">
   
<title>3.5.7 UV Mapping</title>
 <link href="povray35.css" rel="stylesheet" type="text/css"> 
</head>
 <body> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_120.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_120.html">3.5.6 Layered Textures</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong class="NavBar">POV-Ray 3.6 for UNIX documentation</strong><br> <strong>3.5.7 
   UV Mapping</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_122.html">3.5.8 Triangle Texture Interpolation</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_122.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 
<h3><a name="s03_05_07">3.5.7 </a>UV Mapping</h3>
<a name="s03_05_07_i1"><a name="uv_mapping"></a>
<p>
  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 <em>glued</em> to the object's surface and follow the object's 
 deformations. 
</p>
<p>
  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. 
</p>
<p class="Note">
  <strong>Note:</strong> some textures should be rotated to fit the slice in the XY plane. 
</p>
<p>
  Syntax: 
</p>
<pre>
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)
}
</pre>
<h4><a name="s03_05_07_01">3.5.7.1 </a>Supported Objects</h4>
<p>
  Surface mapping is currently defined for the following objects: 
</p>
<ul>
 
 <li>
   <strong>bicubic_patch</strong> : 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.<br>  
 </li>
 <li>
   <strong>mesh, mesh2</strong> : UV coordinates are defined for each vertex and interpolated between.<br>  
 </li>
 <li>
   <strong>lathe, sor</strong> : 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). <br>Surface of Revolution also 
  has special disc mapping on the end caps if the object is not 'open'.<br>  
 </li>
 <li>
   <strong>sphere</strong> : boring spherical mapping.<br>  
 </li>
 <li>
   <strong>box</strong> : the image is <em>wrapped</em> around the box, as shown below.<br>  <br><br><center><img alt="UV Boxmap" src="images/reference/boxmap.png"></center> 
  
 </li>
 <li>
   <strong>parametric</strong> : In this case the map is not taken from a "fixed" set of coordinates but 
  the map is taken from the area defined by the boundaries of the uv-space, in which the parametric surface has to be 
  calculated.<br>  
 </li>
 <li>
   <strong>torus</strong> : The map is taken from the area <0,0><1,1> where the u-coordinate is wrapped 
  around the major radius and the the v-coordinate is wrapped around the minor radius. 
 </li>
</ul>
<h4><a name="s03_05_07_02">3.5.7.2 </a>UV Vectors</h4>
<p>
  With the keyword <code>uv_vectors</code>, the UV coordinates of the corners can be controlled for bicubic patches 
 and standard triangle mesh. 
</p>
<p>
  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. <br>The syntax is: 
</p>
<p>
  <code>  uv_vectors <corner1>,<corner2>,<corner3>, <corner4></code> <br>with 
 default <br><code>  uv_vectors <0,0>,<1,0>,<1,1>,<0,1></code> 
</p>
<p>
  For standard triangle meshes (not mesh2) you can specify the UV coordinates for each of the three vertices <code>uv_vectors 
 <uv1>,<uv2>,<uv3></code> inside each mesh triangle. This goes right after the coordinates (or 
 coordinates & normals with smooth triangles) and right before the texture. <br>Example: 
</p>
<pre>
  mesh {
    triangle {
      <0,0,0>, <0.5,0,0>, <0.5,0.5,0>
      uv_vectors <0,0>, <1,0>, <1,1>
    }
    triangle {
      <0,0,0>, <0.5,0.5,0>, <0,0.5,0>
      uv_vectors <0,0>, <1,1>, <0,1>
    }
    texture {
      uv_mapping pigment {
        image_map {
          sys "SomeImage"
          map_type 0
          interpolate 0
        }
      }
    }
  }
</pre>
 <br> 
<table class="NavBar" width="100%">
  
 <tr>
   
  <td align="left" nowrap="" valign="middle" width="32">
    <a href="s_120.html"><img alt="previous" border="0" src="prev.png"></a> 
   
  </td>
   
  <td align="left" valign="middle" width="30%">
    <a href="s_120.html">3.5.6 Layered Textures</a> 
  </td>
   
  <td align="center" valign="middle">
    <strong>3.5.7 UV Mapping</strong> 
  </td>
   
  <td align="right" valign="middle" width="30%">
    <a href="s_122.html">3.5.8 Triangle Texture Interpolation</a> 
  </td>
   
  <td align="right" nowrap="" valign="middle" width="32">
    <a href="s_122.html"><img alt="next" border="0" src="next.png"></a> 
   
  </td>
   
 </tr>
  
</table>
 </body> </html>
 |