Monthly Archives: July 2012

Navigating mental ray in Maya: ideas and experience

Since the integration of mental ray in Maya may obscure modern workflows, many of the posts here explain how to make the correct choices. But typically we assume some prior knowledge of Maya and mental ray.

We will begin a series soon on how to make modern choices and avoid pitfalls in the UI (like the default absence of shadows, no passes with materials unless using the *_passes materials, etc).

If you have experience where you have had difficulty tracking down a problem only to discover it was a checkbox or some other snafu, leave that here in the comments with a short description. We can use this information to make new users more efficient and help refresh the rest of us too. We will try and include this in sections explaining basic scene setup. Our cheat sheet for quickly rendering.

If you are a developer, it might be helpful for you to see where some defaults could be changed and alter the corresponding .mel in your installation to make a new default.

Please keep the comment factual and tidy. We reserve the right to edit it to the essence of the problem. ūüėČ

For example:

My passes kept rendering black using the mia_material_x. I discovered I should upgrade them to the mia_material_x_passes shader.

SIGGRAPH users meeting

August 5th at about 4pm there will be a bit of a formal/informal (not open bar) user group meeting downtown near the convention center.

For now it looks like the JW Marriot will be the location. The Pool Bar. If this changes I will post it here when we know.

JW Marriot, Rooftop Bar, Los Angeles

More can be found here

Working with string options

I’ve written an example script for working with string options in Maya. ¬†The four main functions are:

  • stringOptionExists(name)
  • setStringOption(name, value)
  • getStringOption(name)
  • removeStringOption(name)

The usage is pretty simple.  stringOptionExists checks if a string option already exists (returning True or False), setStringOption will set a string option value, getStringOption will return a string option value, and removeStringOption will delete the string option.  setStringOption and getStringOption will match string option data types with python data types.

“string” -> Python’s str type

  • text, e.g. “hello world”

“boolean” -> Python’s bool type

  • True or False

“integer” -> Python’s¬†int type

  • any whole number, e.g. -5, 0, 1, 100, etc…

“scalar”‘ -> Python’s float type

  • any decimal number, e.g. -5.4, 0.0, 1.0, 104.23, etc…

“color” -> Python’s tuple type of length 4¬†(although you can set it using a list of length 4)

  • four scalars corresponding to RGBA, e.g. (1.0, 1.0, 1.0, 1.0)

“vector” -> Python’s tuple type of length 3 (although you can set it using a list of length 3)

  • three scalars corresponding to XYZ, e.g. (1.0, 1.0, 1.0)

undeclared -> Python’s None type

Here is an example usage of working with the script. ¬†First I check if the “unified sampling” string option exists, printing out it’s value if it does. ¬†Next I set all of the standard unified sampling string options, creating them if they do not already exist. ¬†Then I print the string option values that I just created right before I remove those string options:

from string_options import stringOptionExists, setStringOption, getStringOption, removeStringOption

# Check to see if the unified sampling string option exists.
if stringOptionExists("unified sampling"):
    value = getStringOption("unified sampling")
    print "The unified sampling string option already exists. It's value is", value
    print "The unified sampling string option does not exist. We will create it when we set it."

# Set unified sampling string options.
setStringOption("unified sampling", True)
setStringOption("samples quality", (0.5, 0.5, 0.5, 0.5))
setStringOption("samples min", 1.0)
setStringOption("samples max", 100.0)
setStringOption("samples error cutoff", (0.0, 0.0, 0.0, 0.0))

# Print unified sampling values
print getStringOption("unified sampling")
print getStringOption("samples quality")
print getStringOption("samples min")
print getStringOption("samples max")
print getStringOption("samples error cutoff")

# Remove unified sampling string options
removeStringOption("unified sampling")
removeStringOption("samples quality")
removeStringOption("samples min")
removeStringOption("samples max")
removeStringOption("samples error cutoff")

You can download the script here:


iray in Maya 2013

Recently Twitted on the mental ray Twitter feed:

iray in 3.10 with motion blur

We thought we’d try and make it happen in Maya 2013. With some digging and a license of Standalone; the end result is a complex menagerie: Spinning Buddha!

iray 2.0 in mental ray 3.10

For Progressive + IPR you need: A new Maya 2013 SP1 re-posted for download on Autodesk’s site:¬†Autodesk – Autodesk Maya Services and Support

So how do you make this happen? (Please note that the magic works for Windows right now. Linux can be found in the comments from Brenton. Haven’t gotten to OSX.)

Well, first you need the correct files. This means you need a licensed copy of either mental ray Standalone or 3ds Max (Or Design) separately or as part of your bundle. You will need these files:

  • libiray.dll
  • libiraymr.dll
  • cudart64_40_17.dll (Possibly slightly different, this is x64)

Place these into a single directory you create, name it whatever you need to make it recognizable. In our example we’ll simply call it: iray

On Windows we placed it here:  <My Documents>\maya\2013-x64\iray

You now need to alter the Maya.env file found in the correct folder for 2013. You can find it here: C:\Users\<your user name>\Documents\maya\2013-x64\Maya.env

Open with a plain text editor and add these lines:


Now open Maya and render using the information and hints found on the ARC forum here:

Maya and mental ray iray

Welcome to the World of iray

Some short tests confirmed that this works with Progressive IPR in Maya 2013 SP1.