RIS
|
Introduction
This tutorial provides some basic information about texture mapping using
handwritten rib files,
for example, Source Image Conversion
PRMan expects source images, such as .hdr, .tif and .png files, to be converted to a
proprietary Pixar file format known as a "texture" file. Such files can be recognized
by their .tex or .tx file extension. The creation of a .tex file is done using a utility
application called
Maya & txmake
In Maya
Cutter & txmake
When editing a handwritten rib file it is the responisibility of the artist to
explicitly perform the .tex conversion. Such conversions can be accomplished using a CMD
window (Windows) or a terminal (Linux and OSX). However, we can take advantage of a couple
of features of Cutter that will enable
specify a "searchpath" for texture files ie. Option "searchpath" "texture" ["../textures:@"] For convenience .tex files should be saved in the directory specified by this "searchpath". For example, suppose we have the following directory structure. HOME_DIR/ |_ cutter/ | |_ cutter.jar | |_ run.bat | |_ ribs/ | |_ textured_scene.rib | |_ tiffs/ | |_ seal.tif | |_ textures/ In the "textured_scene.rib" file we might be using the PxrTexture and PxrSurface nodes to apply and image to a square polygon. For example,
AttributeBegin # txmake -mode periodic ../tiffs/seal.tif ../textures/seal.tex Pattern "PxrTexture" "PxrTexture1" "string filename" ["seal.tex"] "int linearize" [1] Bxdf "PxrSurface" "PxrSurface1" "reference color diffuseColor" ["PxrTexture:resultRGB"] Scale 5 1 5 Polygon "P" [-0.5 0 -0.5 -0.5 0 0.5 0.5 0 0.5 0.5 0 -0.5] "st" [0 0 0 1 1 1 1 0] AttributeEnd
If the line of commented text is selected and the
keyboard shortcut Alt+e, Control+e or Apple+e is used, Cutter will ignore the leading
# comment character and run the txmake command as
if it were being executed in a CMD or terminal window. Because the text is executed
relative to the cutter directory, the txmake command can be given the relative paths
to the source and the destination directories.
|
Texture Coordinates and PolygonsThe square polygon specified below defines the xyz coordinates of each vertex and their 'st' texture coordinates. Extra space between the 'st' coordinates is used to emphasise their correspondence to each vertex. # A B C D Polygon "P" [-0.5 0 -0.5 -0.5 0 0.5 0.5 0 0.5 0.5 0 -0.5] "st" [ 0 0 0 1 1 1 1 0] The source image is considered to have a fixed overlay of 'st' coordinates. For example, the origin of the image of the seal (s = 0, t = 0) matches the origin of the texture coordinates of the polygon - vertex A. |
|
|
Polygons - Rotated and Scaled Texture SpaceBy changing the "binding" of the 'st' coordinates on the polygon we can rotate the texture map. For example, Polygon "P" [-0.5 0 -0.5 -0.5 0 0.5 0.5 0 0.5 0.5 0 -0.5] "st" [0 1 1 1 1 0 0 0] # <-- 'st' coords turned 90 degrees # "st" [0 0 0 1 1 1 1 0] <-- original 'st' coords
Changing the 1's to, say, 4's results in a 4 by 4 repetition of texture space. For example, Polygon "P" [-0.5 0 -0.5 -0.5 0 0.5 0.5 0 0.5 0.5 0 -0.5] "st" [0 0 0 4 4 4 4 0]
|
Texture Coordinates and QuadricsThe texture coordinates of quadric surfaces are "bound" in the order shown below.
In RIB the nurbs cylinder shown above would be, |
|
© 2002- Malcolm Kesson. All rights reserved.