If you've used MTOR for long, you realize that the design goal of this package was not to provide a simple minded translator for Maya files, to PRMan. In fact, the goal was to provide an interactive front-end for PRMan, within the Maya system. In general, MTOR makes very little effort to convert Maya shader networks and shaders.
There are circumstances, however, when automating the conversion process can be extremely helpful. In the case where you have a Maya file, with predefined shading groups with texture files, a simple conversion to an equivalent RenderMan shader and texture file can easily be accomplished.
Running the Script:
There are three files that comprise these scripts. You can click each one to view the file, or right-click, and select "Save Link" to save these files into your Maya scripts directory.
The first file DWmayaToMtorUI.mel contains the major UI scripts. This file must be sourced, before the process can begin. Next, DWmayaToMtor.mel provides the routines for traversing the Maya DAG, selecting the appropriate nodes and creating the MTOR appearance and setting parameters. The last file, DWmayaToRmanShaderFuncs.mel provides functions that are used in this process.
When you invoke "DWmayaToMtorUIwin()", you will see the
following dialog box.
There are two modes that can by used. By default, we've chosen to have Slim automatically create textures from source images files. When Slim "knows" that a string parameter is actually a texture map filename, it tests the file to see if the input file is really a RenderMan texture. If it is not, Slim issues a command to create a RenderMan texture from the source file. Textures can be created from TIFF, Maya IFF, SGI RGB and Alias formatted image files.
In the case above, we've chosen to have Slim create the RenderMan
textures. By default, the RenderMan textures will be created in the
rmantex subdirectory of your current project. You can control the edge
behavior or the RenderMan texture by setting the U and V clamping modes.
By default, this script also sets a flag to "stretch" the texture to
match Maya default texture mapping behavior.
In some cases, you may have already pre-created all of the needed texture maps. In this case, you will need to define a path to the pre-created RenderMan textures. This is entered into the RenderMan Texture Path: dialog box. Slim will "test" the input files, but finding that they are already RenderMan textures, will not create any additional files. In addition, the input files will be stripped of their normal image extensions (.tif, tiff, .rgb, etc.) and will have the .tx extension appended. You may need to modify the behavior of the script if you choose to prename your texture using another convention.
You will not specify any U or V clamping modes in this case, as the pre-created textures already define the clamping and stretching behavior.
In this test example, we used a simple scene with 2 shading groups and 2 different texture maps. You can see from the Slim palette above, that we've brought in a single appearance to be used as the template shader.
After running the script, the scene now contains 2 additional RenderMan shaders. Each shader has been named to match the Maya shading group. You'll have to refresh the palette to see your new shaders, however. (Select " * " from the palette type pull-down menu.) You'll also want to update the swatches to see the textures. (Select swatches, and pick Appearance-> Render Icons.)
In their particular case, PowerAnimator models were being "painted" with Studio Paint 3D, and then the model files were imported into Maya. This results in a single shadinggroup and associated texture file for every piece of geometry in the scene. Obviously hand conversion would be very tedious.
Through the power of the mel scripting languange, and the mel commands provided through the MTOR plugin, this process can be completely automated!
Pixar Animation Studios