OSL
|
IntroductionThis tutorial presents a way of randomly applying an arbitary number of texture maps to multiple surfaces using a single OSL shader. The technique relies on each surface being assigned a custom user attribute. For example, in RIB an attribute named "texname" would be of the form, Attribute "user" "string texname" ["1.tex"]
The value of the attribute is used by tbe shader when
it calls the OSL
The shading network shared by all 48 cubes is shown below.
|
Adding the Custom RenderMan Attribute
In Maya create an arbitary number of objects. Set the project and save the scene.
|
Now the proc has been loaded into Maya's memory it can be called as a
3 Select the Geometric Settings panel from the View menu.
4 Create a Geometric Settings Node.
In the "Pre Shape MEL" text field enter the following text.
Select the objects to be texture mapped and click the |
Preparing the Texture FilesFrom the RenderMan shelf open the Texture Manager.
Use the
The name of the textures directory in figure 7 ("data") must match the name of the folder chosen
by the |
Compiling and Using the OSL Shader
The AttributeTexname.osl shader should be saved and
compiled. In HyperShade create an instance of
the PxrOSL node and browse the the compiled AttributeTexname.oso file. Connect the resultRGB output
of the shader to the diffuseColor of PxrSurface - figure 3.
Unfortunately the current version (21.0) of RfM the PxrOSL node ignores the shader's metadata. Hence,
's' and 't' are not hidden and "invert" and "linearize" are not
displayed as checkboxes!
|
Rendering
The successful operation of this technique depends on a couple of important factors.
|
© 2002- Malcolm Kesson. All rights reserved.