The RenderMan Interface - Paul Bourke
The RenderMan Interface - Paul Bourke
The RenderMan Interface - Paul Bourke
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
15.7 Texture Mapping Functions<br />
Texture maps are images that are mapped onto the surface of a geometric primitive. <strong>The</strong><br />
<strong>RenderMan</strong> <strong>Interface</strong> supports three primitive types of texture access: basic texture maps<br />
(via texture), environment maps (via environment), and shadow or z-buffer maps (via<br />
shadow). Texture maps are accessed using two-dimensional coordinates and return floats<br />
or colors. Environment maps are accessed using a direction and return floats or colors.<br />
Shadow maps are accessed using points and return floats.<br />
For two-dimensional access (texture), the texture coordinates default to the texture coordinates<br />
attached to the surface, (s,t). <strong>The</strong>se default texture coordinates are equal to the<br />
surface parameters, the current texture coordinates, or the texture coordinates passed with<br />
the geometric primitive. Texture coordinates can also be computed in the Shading Language.<br />
This generality allows for many different types of coordinate mappings. Images<br />
stored in various map projections can be accessed by computing the map projection given<br />
a point on a sphere. This allows basic texture maps to be used as environment maps. Images<br />
can also be mapped onto surfaces using a two step process. First the surface of the<br />
geometric primitive is mapped to the surface of a parametric primitive, such as a plane or<br />
cylinder, and then the parameters of this primitive are used as the texture coordinates. This<br />
is sometimes called a decal projection.<br />
For three-dimensional access (environment and shadow), the texture coordinates must always<br />
be explicitly specified.<br />
<strong>The</strong>re is no restriction on how texture map values are used in the Shading Language. For<br />
example, displacement mapping can be performed by moving a point on the surface in<br />
the direction of the normal by the amount returned by a basic texture map. Transparency<br />
mapping differs from color mapping only in which variable, either Os or Cs, the texture<br />
is assigned to. <strong>The</strong>re is also, in principle, no limit on the number of texture accesses per<br />
shader or the number of texture maps per shader or per frame.<br />
Texture maps are created in advance from image data via three types of MakeTexture procedures<br />
that are defined as part of the <strong>RenderMan</strong> <strong>Interface</strong>. <strong>The</strong>se are described in Part<br />
I in the section on Texture Map Utilities. RiMakeTexture creates a texture map for access<br />
via texture. RiMakeCubeFaceEnvironment and RiMakeLatLongEnvironment create an<br />
environment map for access via environment. RiMakeShadow creates a shadow map for<br />
access via shadow. A texture file may contain several channels of information and have any<br />
horizontal or vertical resolution. This information is normally inherited from the image<br />
from which the texture is made. <strong>The</strong> s coordinate is assigned to the horizontal direction<br />
with increasing values moving right. <strong>The</strong> t coordinate is assigned to the vertical direction<br />
with increasing values moving down. <strong>The</strong>se coordinates are normalized to lie in the range<br />
0 to 1 so that changing the resolution of the texture map has no effect on the shaders that<br />
access the texture map. When a texture map is created, the wrap mode is also specified.<br />
<strong>The</strong> wrap mode controls what values are returned if the texture coordinates fall outside the<br />
unit square. Allowed wrap modes are: periodic, black and clamp. periodic causes the texture<br />
data to tile the plane, black causes accesses outside the unit square to return the value 0, and<br />
clamp causes the texture coordinates to be clamped to the closest point on the unit square<br />
and the texture value associated with that point to be returned.<br />
<strong>The</strong> texture access functions normally pass the texture map through a low-pass filter to<br />
143