Auto-instancing in Arnold 6.0.2


Controllable auto-instancing on ASS procedurals: You can now disable the default automatic instantiation of procedurals pointing at the same ASS file with the auto_instancing parameter on each procedural or by the procedural_auto_instancing option. This workaround is sometimes useful when overriding procedural parameters with operators.

Arnold 6.0.2 release notes https://docs.arnoldrenderer.com/x/1gGvBg

So, what’s all that mean?

It means that if you load the same ass file many times, Arnold will load the ass file just one time, and then automatically create instances of that. For example, if I load an ass file three times, I will get two instances.

In previous versions, this was known as the procedural cache, and it was a global option. Now it’s called auto_instancing and you can set it on each procedural node (aka aiStandin in Maya).

In general, you want auto instancing, because instancing is more efficient than loading the same ass file over and over. But if you’re using operators to apply different looks to the same procedural, you need to turn off auto instancing. Otherwise all the procedurals will have the same look (because they all be instances of the same one procedural).

For example, with auto instancing on, I get this, even though I’ve assigned different looks to each procedural (standin):

Everything has the same look with auto instancing on

I can also tell from the Arnold log that I’m getting instances. Note that 2 are reused

| ---------------------------------------------------------
| ass file cache           
|   unique (loaded from disk)              1 (33.33%) 
|   reused (found in cache)                2 (66.67%) 
|   total referenced .ass files            3 (100.00%) 
| ---------------------------------------------------------

If I turn off auto instancing (in the procedural parameters)

then I get three different looks

In the Arnold log, that looks like this (0 reused means 0 instances)

| ---------------------------------------------------------
| ass file cache
| unique (loaded from disk) 1 (100.00%)
| reused (found in cache) 0 (0.00%)
| total referenced .ass files 1 (100.00%)
| ---------------------------------------------------------

[MAXtoA] Rendering XGen in 3ds Max


 

You can export an ASS file from Maya (with the XGen primitives) and then use an Arnold Procedural to load the ASS file into 3ds Max.

You need to add these two folders to the system environment variable Path:
  • C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\bin
  • C:\Program Files\Autodesk\Maya2018\bin

For example, you can copy this:

C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\bin;C:\Program Files\Autodesk\Maya2018\bin;

and paste it at the beginning of the current Path:

windows_sys_env_var

Restart 3ds Max after you do this.

Then add the MtoA procedurals folder to the Plugin Search Path:

maxtoa_plugin_search_path

 

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/example\";"
 
 render -s 6 -e 8 -r arnold -rt 1 -preRender %PRE_RENDER_MEL% 
 C:\projects\Support\scenes\_2016\XSI_deformed_logo.mb 

This will export ASS files named “example.ass”.

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;"

[Arnold] Loading plugins when you edit ASS files


If you’re using the Arnold API to update ASS files (for example, to change paths), you need to load all the plugins (aka shaders) that are referenced by the ASS file. Otherwise, the unknown nodes are skipped on load, and therefore won’t be in any ASS file you write.

For example, if you set ARNOLD_PLUGIN_PATH to point to the locations of the MtoA shaders and any custom shaders you use, then you could do something like this:

from arnold import *
import os

AiBegin()
AiMsgSetConsoleFlags(AI_LOG_ALL)
AiLoadPlugins( os.getenv( 'ARNOLD_PLUGIN_PATH' ) )
AiASSLoad("original.1001.ass", AI_NODE_ALL)

#
# Do your edits here
#

AiASSWrite("edited.1001.ass", AI_NODE_ALL, False)
AiEnd()

Upgrading to Arnold 4.1.x


Arnold 4.1.x has plenty of new features and improvements, and you can read about those in the release notes.

Here’s a few other little things to know about Arnold 4.1.x:

  • All shaders, procedurals, and plug-ins like SItoA and MtoA need to be recompiled to work with Arnold 4.1.x.
  • You need a new license to render with Arnold 4.1.x. An Arnold 400 license won’t work with Arnold 4.1.x.
  • Ass files written by Arnold 4.1.x cannot be loaded by older versions of Arnold.
  • Cross posted here

Texture search paths


With Arnold there are two things in an ASS file that specify the location of a texture file:

  • The texture filename, which can be an absolute or relative path.
  • The texture_searchpath in the render options. The texture_searchpath is used only if the texture filename is a relative path (for example: “sourceimages/example.tiff”.
  • For example, if the texture filename was a relative path, you might have something like this in an ASS file:

    options
    {
     ...
     texture_searchpath "//server/projects/test"
     ...
    }
    
    MayaFile
    {
     ...
     filename "sourceimages/noicon.png"
     ...
    }