Force Translate Shading Engines?


You may have noticed the Force Translate Shading Engine option in the export dialog (or in the Feature Overrides section of the Render Settings).
force_translate_shading_engine

Force Translate Shading Engines forces MtoA to export shape nodes with a shader link, like this:

polymesh
{
 ...
 shader "aiStandard1SG"
 declare mtoa_shading_groups constant ARRAY NODE
 mtoa_shading_groups "aiStandard1SG"
}

where “aiStandard1SG” is the name of a MayaShadingEngine shader node.

This allows you to keep your shapes and shaders in separate ASS files. For example, you could have one standin that loads the shapes, and a second standin that loads the shaders. As long as the shape nodes include links to the shaders, Arnold will resolve the links and render the shapes with the right shaders.

Exporting ASS files to specific locations


For the render -rt 1 command, you can specify the output ASS name in
the defaultArnoldRenderOptions.output_ass_filename attribute. For example:

set PRE_RENDER_MEL="setAttr -type \"string\" 
defaultArnoldRenderOptions.output_ass_filename 
 \"c:/Users/StephenBlair/Documents/test\";"
 
 render -s 6 -e 8 -r arnold -rt 1 -preRender %PRE_RENDER_MEL% 
 C:\projects\Support\scenes\_2016\XSI_deformed_logo.mb 

The scene should have the Frame/Animation ext set to something like
“name.#.ext”. Otherwise, if it is “name.ext” you’ll get filenames like
“example.ass.0004.ass”

output_ass_filename can have environment variables, but you have to be
careful to use forward slashes. For example:

set PRE_RENDER_MEL="setAttr -type \"string\" defaultArnoldRenderOptions.output_ass_filename \"%OUTPUT_ASS_FILENAME%\";" 
set OUTPUT_ASS_FILENAME=C:/Users/StephenBlair/Documents/example 

render -s 6 -e 8 -r arnold -rt 1 -preRender %PRE_RENDER_MEL% C:\projects\Support\scenes\_2016\XSI_deformed_logo.mb

There’s also the arnoldExportASS command, if you want to script the export.

maya -batch -file scene.mb -command "arnoldExportAss 
-f "/home/blairs/Desktop/example.ass" -mask 255 -lightLinks 1 -compressed 
 -shadowLinks 2 -cam sideShape;"

[MtoA] Getting an Arnold log


The Arnold log is important, not just for troubleshooting and getting help from us at Solid Angle, but also for understanding what’s going on when Arnold renders your scene.

To get an Arnold log:

  1. In Maya, click Render > Render Settings
  2. In the Render Using list, click Arnold Renderer
  3. Click the Diagnostics tab.
    mtoa_render_settings_diagnostics
  4. Set the Verbosity level to at least Warnings + Info
  5. Click the File check box to enable file logging (by default, the log file will be saved in the last folder you browsed to with  Maya; see Finding your log file).
  6. If you want to be absolutely sure of where to find the log file, click the folder icon beside the Filename box, and select a location for the Arnold log file.
  7. Depending on what OS you use, and how you started Maya, the log is also output to the Output Window (Windows) or to the terminal (on OSX and Linux if you started Maya from a terminal)

For batch rendering, Arnold log messages go into mayaRenderLog.

  • [Windows] %USERPROFILE%\Documents\maya\mayaRenderLog.txt
  • [OSX] ~/Library/Logs/Maya/mayaRender.log
  • [Linux] ~/maya/mayaRenderLog.txt

[MtoA] Renderman performance warning


If you have both Renderman and MtoA installed, you may see a warning that says “Arnold for Maya degrades Renderman performance.” Unless you are running a version of MtoA from 20 months ago, this performance warning is false. MtoA does not degrade Renderman performance.

This was fixed in Arnold 4.2.3.1 (fix #4393 main thread was pinned to a single core) back in January 2015.

Updating MtoA 1.2.7.3 with Arnold 4.2.14.0


MtoA 1.2.7.3 ships with Arnold 4.2.13.

If you want to take advantage of the improvements in Arnold 4.2.14.0 (like the increase  in the maximum number of threads from 128 to 256), here’s what you need to do:

  • Download  Arnold 4.2.14.0 and extract the archive
  • Replace Arnold (libai.so, ai.dll, libai.dylib), kick, and maketx in the MtoA bin folder with the versions from the Arnold 4.2.14.0 download
  • Replace the Arnold Python bindings in  the MtoA scripts/arnold folder with the Python bindings from the Arnold python/arnold folder. For example, replace this folder:
       C:\solidangle\mtoadeploy\2016-1.2.7.3\scripts\arnold

    with the python\arnold folder from the Arnold 4.2.14.0 download. For example:

       C:\solidangle\arnold\Arnold-4.2.14.0-windows\python\arnold

You must update the Arnold Python bindings, otherwise MtoA won’t load. That’s because Arnold 4.2.14.0 included a number of API changes, including the removal of some API (like AiLicenseSetServer). The older Python bindings still refer to the removed API, so there will be Python errors that prevent MtoA from loading.

[Arnold] Understanding the texture cache


Arnold uses the OpenImageIO texture cache. From the OIIO Programmer Documentation:

In short, if you have an application that will need to read pixels from many large image files, you can rely on ImageCache to manage all the resources for you. It is reasonable to access thousands of image files totalling hundreds of GB of pixels, efficiently and using a memory footprint on the order of 50 MB.

So, if you’re using tx files (tiled and mipmapped textures), then Arnold can read tiles as required, and use the texture cache to keep memory usage under control.

The reason we don’t read all the textures at once is that many of our customers have (literally) 100+GB of textures, so we use a texture cache that constantly loads small bits of texture data as required, and unloads old data.

By default, the size of the texture cache is 2048KB (as of Arnold 4.2.13.0). The size of the texture cache is set in the Arnold Render Settings.

Max Cache Size
The maximum amount of memory to be used for texture caching. Arnold uses a tile-based cache with a LRU (Least Recently Used) type algorithm, where the least recently used tiles are discarded when the texture caches is full.

Note If we get an error reading a texture, we mark that texture as bad and we never try to read it again. This makes the renderer a lot faster when you have a missing texture, since we won’t ask the file server millions of times to read from a nonexistent file. But in a transient network error case, one bad experience and the rest of your render has the texture missing.

[MtoA] Switching between multiple versions of MtoA


start_menu_mtoa

If, like me, you need to switch between different versions of MtoA, here’s a recipe for setting that up.

First, you have to install multiple versions. As you probably already know, the MtoA installer always wants to uninstall first. I take care of that by zapping the Uninstall registry entry with this command:

reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\MtoA2016" /f

Then I run the MtoA installer and install in a folder with the version name, like this:
C:\solidangle\mtoadeploy\2016-1.2.7.3

I start Maya with a batch file that creates a symbolic link named “C:\solidangle\mtoadeploy\2016” that links to the version of MtoA I want to use:

rmdir C:\solidangle\mtoadeploy\2016
mklink /D C:\solidangle\mtoadeploy\2016 C:\solidangle\mtoadeploy\2016-1.2.7.3
rem mklink /D C:\solidangle\mtoadeploy\2016 C:\solidangle\mtoadeploy\2016-1.2.2.0

set RLM_DEBUG=arnold
start "" "C:\Program Files\Autodesk\Maya2016\bin\maya.exe" %* -log %TEMP%\maya.log

My batch file also adds the location of my custom mtoa.mod to MAYA_MODULE_PATH. My custom mtoa.mod points to “C:\solidangle\mtoadeploy\2016”, and handles all versions of Maya:

+ MAYAVERSION:2016 mtoa any C:\solidangle\mtoadeploy\2016
PATH +:= bin
+ MAYAVERSION:2015 mtoa any C:\solidangle\mtoadeploy\2015
PATH +:= bin
+ MAYAVERSION:2014 mtoa any C:\solidangle\mtoadeploy\2014
PATH +:= bin
+ MAYAVERSION:2013 mtoa any C:\solidangle\mtoadeploy\2013
PATH +:= bin