Category Archives: scripts

New GI Prototype Quick Start

As previously posted, a prototype of the new GI scheme for mental ray was included with Maya 2015.

To be clear what a prototype is, this section from Wikipedia best describes this phase of the feature:

Prototype software is often referred to as alpha grade, meaning it is the first version to run. Often only a few functions are implemented, the primary focus of the alpha is to have a functional base code on to which features may be added. Once alpha grade software has most of the required features integrated into it, it becomes beta software for testing of the entire software and to adjust the program to respond correctly during situations unforeseen during development.

Often the end users may not be able to provide a complete set of application objectives, detailed input, processing, or output requirements in the initial stage. After the user evaluation, another prototype will be built based on feedback from users, and again the cycle returns to customer evaluation. The cycle starts by listening to the user, followed by building or revising a mock-up, and letting the user test the mock-up, then back.

As such there are some limitations to know about in this prototype:

  • Motion blur not supported
  • Lens shaders not supported
  • Hair is tessellated
  • Visibility (cutout opacity) not supported
  • Specular interaction currently handled by Final Gather

Since the completed feature is expected to become the replacement solution I suspect these limitations will be removed over time.

Below is an example image rendered with the new GI. The main interior is taken from the Architecture Classroom found at IDST [site appears to be gone]. Other modern mental ray features being used are:

  • Layering Library Shaders
  • Object Lights (2015 Service Pack 2 or later) 8 in total
  • Light Importance Sampling (improving the result of the lighting and simplifying tuning of the scene to a single slider/value)

Also, I am not using portal lights or the Environment Light (Native IBL). Instead I am allowing the new GI to sample the environment without casting more shadow rays and speeding up the render. This also means simplified setup for interiors where you can use the new technique (and a GPU) to power through a scene and render quickly. The brute force nature of the technique will provide you with crisp indirect shadows.

The image below renders in 18 minutes at 1080HD using a K6000. (All of the following renders and time were rendered at 1080HD before resizing to better fit the webpage at 720HD)

18 minutes at 1080 HD resolution using GI on the GPU

18 minutes at 1080 HD resolution using GI on the GPU

Provided by NVIDIA ARC is a simple mel script to enable the GI features in Maya 2015. After loading the script simply run: GI_GPU

GI Testing UI

GI Testing UI

The controls are pretty self-explanatory and only expose the main controls for quality. The controls may change in the future:

  • Enable – override using the new GI instead of Final Gather (Be sure other features are off, like IP or Photons or they may run unnecessarily)
  • Use GPU – this uses the GPU to accelerate the process. The result is identical regardless of mode but the CPU is much slower. Currently CPU usage is less than 100% Also note that CPU usage might be less than 100% using the GPU if using a slow card or high settings. This is because the CPU is waiting on the tile from the GPU. This requires recent graphics drivers and an NVIDIA graphics card (GTX or Quadro)
  • Diffuse only – only calculate diffuse rays. In a lot of applications this is all you’re interested in. But scenes with glass walls and similar effects may need more. In the Prototype, Final Gather rays are used for this effect. This will change as the feature adds more abilities and takes over for old techniques
  • Override FG (Final gather) Globals – The new GI can take its settings from legacy FG settings including ray depth (bounces) which is still set in Final Gather trace depth.
  • Samples Per Pixel – this is the number of samples per pixel (Anti-aliasing) taken per pixel. This also acts as a multiplier of Rays. This number should be a square of another number: 1, 4, 9, 16, 25, 36, etc.
  • RaysYour primary control for quality. This is a brute force technique (at filter 0) where this number of rays is shot per pixel multiplied by samples per pixel above.

Below are some examples of altering the settings.

Increasing the samples per pixel, keeping everything else the same (filter set to 0):

Increase the passes parameter (as a square of an integer)

Increasing the passes parameter (as a square of an integer)

Increasing the rays parameter, all else is the same (filter is set to 0):

Increasing the rays parameter only (passes set to 16)

Increasing the rays parameter only (passes set to 16)

The filter parameter is improved from previous ways of filtering/interpolating GI results. As a convenience the measurement is in pixels. You should find this easier to smooth more quickly and easily than other methods. It also has a negligible impact on render time unlike increasing interpolation with Final Gather. In fact, less variance should improve render times since Unified Sampling works less to solve the image. Keep in mind that increasing values will blur indirect shadowing details.

Open this in a new window to see the changes as they are subtle, blending away the noise. Please pardon the gif compression.

Increasing the filter parameter only in small chunks, for example, 4, 8, 12, etc

Increasing the filter parameter only in small chunks, for example, 4, 8, 12, etc

Another example of the improved smoothing filter:

Increasing the filter setting (all others the same)

Increasing the filter setting (all others the same)

Expect this feature to evolve dramatically over the next year as well as improve performance of both the GPU and CPU modes.

Public render settings updated for Maya 2014

I’ve released a new public render setting user interface for Maya 2014:


  • Native environment lighting mode integration.
  • Exposed trapezoidal shutter shape function for more realistic motion blur.  I’ll explain these settings in another post.
  • Renamed “Contrast As Color” UI option to “Quaily As Color”.  This is more consistent with current naming and is also more intuitive.
  • Slight layout rearrangement to improve workflow.
  • Moved Adsk specific shader options to legacy.

Feedback and comments are welcome.  Please report bugs on on the google code page.

Download here.


New Maya Rendering UI Testing!

After some careful thought and a lot of tedious work by developers Brenton and Corey (mental core), you can find a Maya Render Settings UI for testing. Barton Gawboy is project management. The purpose of this UI is to provide a more official/intended workflow for mental ray. This also means makers of UIs for other packages can use this as a template for features on modern mental ray (3.10 and future).

This UI is in an early phase and should not be used for production. Currently the Quality settings have been re-worked to provide a simpler interface and a modern workflow for using mental ray in Maya. Over time we will be improving on this (light and passes tabs to be re-worked) and adding documentation. We recommend Maya 2013 SP1.

You can find the scripts on the Google Code page: Maya Render Settings UI

A further discussion can be found on the ARC forum (must be a member): Maya Options UI

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: