Blog Archives

String Options

String options are currently Autodesk’s main method for integrating new mental ray features.  While very few people would say they “like” using string options, you don’t really have a choice if you want to use anything new in mental ray.

What are string options?

String Options are essential a tool for you to declare a variable to the mental ray renderer that is not directly built into the Maya/mentalray translator.  You can use string options to tell mental ray to turn on/off a feature and what settings to use.

You can read more about possible string options in the mental ray documentation that comes with Maya.

Where do string options hide?

The miDefaultOptions node

String options are located on the miDefaultOptions node.  There are several ways to get to the this node.  I generally use this MEL command:

select miDefaultOptions;

If you are currently screaming with horror, you should consider creating a custom button on the shelf editor with this command.  You can also select miDefaultOptions from the outliner if you have don’t have “Dag Objects Only” checked (Outliner > Display > DAG Objects Only).  Fun stuff.

If you get a “No object matches name: miDefaultOptions” error, make sure that the mental ray plugin has been loaded and that the default mental ray nodes have been created (if they have not been created, setting the renderer to mental ray in render settings should do the trick).

How to set string options

To create a new string options, click “Add New Item”.  For each string option that you create, you need to know three things: Name, Value, and Type.

Name: The name of the mental ray setting which you are adjusting.  If you don’t know this you don’t know anything.  Make sure you spell the name correctly or mental ray will ignore the setting.

Value: The value that you wish to give that setting.  Values must be of the correct Type.

Type: The data type of the specific setting:

  • “boolean” – The most basic data type representing True or False.
    • Possible Values: “true” or “false”, “on” or “off”, 1 or 0, etc.
  • “integer” – A whole number.
    • Possible Values: -2, 0, 45, 23053, etc.
  • “scalar” – A decimal number.
    • Possible Values: -23.567, 0.0, 0.00005, 3.14159, 1000000000000000000000.0, etc.
  • “string” – Any text.
    • Possible Values: “hello world”, “automatic”, “off”, “0.0”, etc.
  • “color” – A color usually represented by 3 scalars for RGB.
    • Possible Values: 1.0 1.0 1.0. (for white), 0.0 0.0 0.0 (for black), 0.5 0.234 0.0, etc.

Note: mental ray will also recognize “bool” for “boolean”, “float” for “scalar”, “int” for “integer”, or “vector” for “color”.