26.01.2015 Views

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

The RenderMan Interface - Paul Bourke

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Section 7<br />

EXTERNAL RESOURCES<br />

7.1 Texture Map Utilities<br />

<strong>The</strong> format of the various texture map files is implementation dependent. However, there<br />

are standard utilities that convert image files into texture map files.<br />

During two-dimensional texture access, texture coordinates (s, t) are mapped onto the texture<br />

such that s=0 maps to xmin, s=1 maps to xmax+1, t=0 maps to ymin, and t=1 maps to<br />

ymax+1. To be precise, all accesses to the half-open interval [0,1) in s and t will lie within<br />

the picture data.<br />

A wrapmode describes how the texture is accessed if the texture coordinates are outside the<br />

unit square (less than zero, or greater than or equal to one). <strong>The</strong> swrap and twrap strings<br />

specify the wrapping behavior of the s and t coordinates. <strong>The</strong> standard wrapping behavior<br />

for s and t, ”black”, is to return the value zero for all accesses outside the unit square.<br />

(Thus an RGBa texture will be transparent black, zero on all four channels.) <strong>The</strong> keyword<br />

”periodic” indicates that values of s (or t) outside [0,1) will be mapped into [0,1) by subtracting<br />

the largest integer less than or equal to the coordinate (the “floor” of the coordinate).<br />

This will wrap the value 1 back to 0, the value 1.25 to 0.25, and the value -0.1 to 0.9. <strong>The</strong><br />

result will be to repeat the texture as a tile that fills texture space in the s (or t) direction.<br />

<strong>The</strong> keyword ”clamp” indicates that values of s (or t) outside [0,1) will be mapped into [0,1)<br />

by clamping them at their minimum and maximum values. All values below zero will<br />

be clamped to zero and all values greater than or equal to one will be clamped to a value<br />

slightly less than one (at the last texture pixel).<br />

Textures are often prefiltered so that subsequent antialiasing calculations can be done more<br />

quickly at run-time. This is controlled by giving a filterfunc, which is the same as the filterfunc<br />

used in RiPixelFilter, and an swidth and twidth.<br />

7.1.1 Making texture maps<br />

Surface textures are used to modify the properties of a surface, such as color and opacity.<br />

A surface texture is accessed using the surface texture coordinates (see the section on Texture<br />

coordinates) or any other two-dimensional coordinates computed by a user-defined<br />

shader. A surface texture consists of one or more channels. A single channel or a group of n<br />

99

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!