RMS
|
Introduction
This tutorial provides three examples of how primvars can be setup and used with RMS and HyperShade.
The reader should refer to the tutorial
RIB/RSL: Using PrimVars for basic information about primvars.
Example 1 - using a "float" primvarSetting Up the Material
1 In HyperShade create an instance of Blinn and assign it to several surfaces.
4 Add the following TCL expression (figure 2)
Alternatively, enter the name of the material directly without using TCL, for example,
5 Scroll to the "Common Material Attributes" tab,
6 Rename the "Rman Prim Var Float Attibute" to "Dc" as shown in figure 4.
The name "Dc" is arbitary but it is less confusing if it matches the name chosen from the "RenderMan TCL Expression Manager" window. The name of the node, currently "rmanPrimVarFloat1", need not be changed. |
Setting Up the Surfaces
7 Copy and paste the MEL proc, shown in listing 1, into Maya's script window. Listing 1
|
|
8 Select the surfaces to which Blinn was assigned, PointsGeneralPolygons [1] [4] [0 1 3 2] "P" [xyz data...]
"constant float Dc" [0.5523]
Note the prefix acts only as a "hint" to RfM - it is not included in the name of the primvar.
Naming ConventionsAny name can be chosen in step 6, however, it must match the name of the attribute assigned to surfaces in step 8. For example, if "foo" was used in step 6 then "foo" must be used in step 8. |
"Dc" & Blinn's Diffuse Parameter?
But how does the random value of the "Dc" primvar control the brightness of Blinn? To discover
the answer use the MEL command "rman genrib". This will generate the rib files and shader(s) that would normally
be used by the external version of prman. Go to the "renderman/PROJECT/shaders" directory and look
for the compiled blinn material, for example, "blinn2_rfm.slo". Open a cmd (Windows) or shell
(Linus/OSX) and cd to the "shaders" directory. Enter this command, |
Example 2 - using a "color" primvar
Setting Up the Material
1 In HyperShade create an instance of Blinn and assign it to several surfaces. |
Setting Up the Surfaces
7 Copy and paste the MEL proc, shown in listing 2, into Maya's script window. Listing 2
|
|
8 Select the surfaces to which Blinn was assigned, PointsGeneralPolygons [1] [4] [0 1 3 2] "P" [xyz data...]
"constant color C" [0.520171 0.486881 0.625127]
Note the prefix acts only as a "hint" to RfM - it is not included in the name of the primvar.
|
Example 3 - using a "string" primvar
The workflow for strings is slightly different to floats and colors. Unlike the previous examples
there is no need to use a "Rman Prim Var String" node because the shader parameter, "fileTextureName",
is automatically "exposed" as a result of connecting a File node to Blinn's "Color" control. This
example demonstrates how an arbitary number of images can be used as texture maps.
Setting Up the Material
1 In HyperShade create an instance of Blinn and assign it to several surfaces. |
Setting Up the Surfaces
4 Copy, paste and execute the MEL procs, shown in listing 3, in Maya's script window. images/map1.tif
images/map2.tif
images/map3.tif
images/map4.tif
Executing the following in the script window will echo the full paths to the images. getTexnames("textureDB.txt");
For example. /Users/mkesson/Documents/maya/projects/PrimVar/images/map1.tif
/Users/mkesson/Documents/maya/projects/PrimVar/images/map2.tif
/Users/mkesson/Documents/maya/projects/PrimVar/images/map3.tif
/Users/mkesson/Documents/maya/projects/PrimVar/images/map4.tif
The proc named string $paths[] = getTexnames("texturesDB.txt");
makeTextures($paths);
After executing the code the images directory would contain the following textures.
/Users/mkesson/Documents/maya/projects/PrimVar/images/map1.tif.tex
/Users/mkesson/Documents/maya/projects/PrimVar/images/map2.tif.tex
/Users/mkesson/Documents/maya/projects/PrimVar/images/map3.tif.tex
/Users/mkesson/Documents/maya/projects/PrimVar/images/map4.tif.tex
However, if "textureDB.txt" had contained a list of prman textures the proc will not
use txmake ie. it will not take any action. string $paths[] = getTexnames("texturesDB.txt");
if(size($paths) > 0) {
makeTextures($paths);
addStringPrimVar("MAP_fileTextureName", $paths);
}
The text shown in red ("fileTextureName") is the name of the shader parameter that would normally be assigned the path to a texture. However, because primvars are being used its value remains an empty string. Listing 3
|
|
|
© 2002- Malcolm Kesson. All rights reserved.