Mtor
|
IntroductionPixar's RenderMan Artist Toolkit (RAT) enables most of the functionality "normally" accessed via their GUI's ie. mouse and keyboard input, to be controlled directly via MEL scripts. The documentation on mtor/MEL scripting can be found at, Pixar/docs-X.X/programmingRAT/mtor_slim/index.html The documentation on slim/MEL scripting can be found at, Pixar/docs-X.X/programmingRAT/mtor_slim/index_slim.html This tutorial developes a MEL script that
A new script Making & Writing a Ribbox with Mel was added to this tutorial May 2007. |
Accessing Slim CommandsInvoking a slim command from MEL takes the general form of, slimcmd slim COMMAND -flag1 -flag2... // for example string $palette = `slimcmd slim CreatePalette -edit -new`; or slimcmd reference COMMAND -flag data; // for example string $path = "$RMANTREE/lib/shaders/plastic.slo"; string $plastic = `slimcmd $palette CreateInstance -file $path`; slimcmd $plastic GetProperties -name "Cs"; or slimcmd reference COMMAND info; // for example slimcmd $palette SetLabel "my palette"; By reference I mean a string that indentifies a slim object - Pixar's documentation calls them "handles". |
Accessing Mtor CommandsInvoking an mtor command from MEL takes the general form of, mtor control COMMAND parameter_name parameter_value; // for example mtor control attach surface `slimcmd $plastic GetID`; or mtor control COMMAND -rg parameter_name -value parameter_value; // for example mtor control setvalue -rg dspyRez -value "320 240";
The -rg flag means "renderman globals".
|
Creating a PaletteBecause the MEL script we are writing will most probably be run several times we need to check for the existance of a previously created palette.code snippet 1
|
Adding a ShaderThe macro $RMANTREE will expand to the full path of the Pixar directory.code snippet 2
|
Setting Shader ValuesNotice the use of quoted curly braces to enclose multiple values. Internallyslim uses the TCL scripting language - lists are enclosed in parenthesises. code snippet 3
|
Attaching a ShaderNotice an instance of the shader is referenced by its ID number. code snippet 4
|
Setup Mtor & Rendercode snippet 5
|
© 2002- Malcolm Kesson. All rights reserved.