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 *
AiLoadPlugins( os.getenv( 'ARNOLD_PLUGIN_PATH' ) )
# Do your edits here
AiASSWrite("edited.1001.ass", AI_NODE_ALL, False)
Settings like the image format and compression come from the defaultArnoldDriver node, so to set them through scripting, you need to set defaultArnoldDriver attributes.
The image format corresponds to the ai_translator attribute.
import maya.cmds as cmds
cmds.setAttr( 'defaultArnoldDriver.ai_translator', 'exr', type='string' )
import pymel.core as pm
d = pm.PyNode( 'defaultArnoldDriver' )
d.ai_translator.set( 'exr )
setAttr "defaultArnoldDriver.ai_translator" -type "string" "jpeg";
The rest of the attributes are named a little… better 😉 Here’s a Python snippet to list the driver attributes and their values:
from maya.cmds import *
sn = cmds.attributeInfo( inherited=False, short=True, type="aiAOVDriver" )
for s in sn:
print "defaultArnoldDriver.%s = %s" %( s, cmds.getAttr( "defaultArnoldDriver.%s" % s ) )
Arnold nodes can have user-defined parameters, like MyColor in this ASS snippet:
declare MyColor constant RGBA
MyColor 0.703999996 0 0.526000023 1
In Softimage, there are a number of ways you can assign data like MyColor to a polygon mesh. You could use ICE:
Or you could use the Arnold User Options property:
To access MyColor in the render tree, use the Color Attribute shader:
If you used ICE, MyColor will appear automatically in the Attribute list. But if you used the User Options property, you’ll have to use a script one-liner to set the Attribute value. That’s because Softimage doesn’t know about the user parameters on Arnold nodes: those come into existence only when SItoA translates the scene to Arnold.
Application.SetValue("Sources.Materials.DefaultLib.Material.Color_Attribute.attribute", "MyColor", "")
On a related note, the MtoA shader userDataColor does the same thing as the SItoA Color Attribute shader: it uses AiUDataGetRGBA() to get a color from a user parameter on the object being shaded. With SItoA 3.0, the Arnold > DLL Shaders menu makes it pretty easy to use an MtoA shader in Softimage.
By default, the Abort on License Fail option is off, so you could end up with water-marked renders if for some reason a render node can’t get a license.
Here’s one way to prevent that, with the -set flag:
kick -dp -dw -set options.abort_on_license_fail on some.ass
For the Point, and Sphere particles shapes, you get a single Arnold points node. For example, for the Sphere shape, you’d get a points node that looked something like this:
points 54 1 b85POINT
radius 54 1 b85FLOAT
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
This particular node is for 54 points in sphere mode. For each point, you get the center position (the points.points parameter) and a radius (the points.radius parameter). If there’s any scaling applied to the particle in ICE, the radius is multiplied by the X scaling of the particle.
For the Point shape, you get an Arnold points node in “disk” mode, with radius = size * X scaling.
For the other supported shapes, you get the corresponding Arnold shape.
SItoA translates ICE particle shapes to native Arnold shapes. The supported particle shapes are already documented here, but here’s a little more information about how they are translated.
||points (mode “disk”)
||box (with 0 height)
||points (mode “sphere”)
The Segment, Capsule, and Blob shapes are not supported. SItoA skips them and they are not translated into the Arnold scene source.
One way to avoid exporting the same static geometry for every frame is to export it just once, and then export the rest of the scene (the cameras, lights, and any animated objects) as a regular sequence. kick can combine multiple ASS files and then render the result. For example:
kick environment.ass lights.ass character.0001.ass camera.0001.ass -o scene.0001.exr
- environment.ass is all the static geometry and the applied shaders.
- camera.####.ass is the camera, driver, filter, and options.
- character.####.ass is an animated character with its shaders.