Mapping Functions

Mapping functions are used to apply two-dimensional textures to surfaces. Each mapping functions defines a different method of transforming a three dimensional point of intersection to a two dimensional u - v pair termed texturing coordinates. Typically, the arguments to a mapping method define a center of a projection and two non-parallel axes that define a local coordinate system.

The default mapping method is termed u - v mapping or <#787#>inverse mapping<#787#>. Normally, there is a different inverse mapping method for each primitive type (see chapter 5). When inverse mapping is used, the point of intersection is passed to the uv method for the primitive that was hit.

<#5030#><#5030#>
<#1541#>map<#1541#> <#1542#>uv<#1542#>
Use the uv (inverse mapping) method associated with the object that was intersected in order to map from 3D to determine texturing coordinates.
The inverse mapping method for each primitive is described in Chapter 5.

<#5032#><#5032#>
<#1545#>map<#1545#> <#1546#>planar<#1546#> [#math151##tex2html_wrap_inline5034# #math152##tex2html_wrap_inline5036# #math153##tex2html_wrap_inline5038#]
Use a planar mapping method. The 2D texture is transformed so that its u axis is given by #math154##tex2html_wrap_inline5041# and its v axis by vaxis. The texture is projected along the vector defined by the cross product of the u and v axes, with the (0,0) in texture space mapped to #math155##tex2html_wrap_inline5047#.

<#5048#><#5048#>
<#1552#>map<#1552#> <#1553#>cylindrical<#1553#> [#math156##tex2html_wrap_inline5050# #math157##tex2html_wrap_inline5052# #math158##tex2html_wrap_inline5054#]
Use a cylindrical mapping method. The point of intersection is projected onto an imaginary cylinder, and the location of the projected point is used to determine the texture coordinates. If given, #math159##tex2html_wrap_inline5056# and #math160##tex2html_wrap_inline5058# define the cylinder's axis, and #math161##tex2html_wrap_inline5060# defines where u = 0 is located.
See the description of the inverse mapping method for the cylinder in Chapter 5. By default, the point of intersection is projected onto a cylinder that runs through the origin along the z axis, with #math162##tex2html_wrap_inline5064# equal to the x axis.

<#5066#><#5066#>
<#1559#>map<#1559#> <#1560#>spherical<#1560#> [#math163##tex2html_wrap_inline5068# #math164##tex2html_wrap_inline5070# #math165##tex2html_wrap_inline5072#]
Use a spherical mapping method. The intersection point is projected onto an imaginary sphere, and the location of the projected point is used to determine the texturing coordinates in a manner identical to that used in the inverse mapping method for the sphere primitive. If given, the center of the projection is #math166##tex2html_wrap_inline5074#, #math167##tex2html_wrap_inline5076# defines the sphere axis, and the point where the non-parallel #math168##tex2html_wrap_inline5078# intersects the sphere defines where u = 0 is located.
By default, a spherical mapping projects points towards the origin, with #math169##tex2html_wrap_inline5081# defined to be the z axis and #math170##tex2html_wrap_inline5084# defined to be the x axis.