[arnold] Getting RLM diagnostics from Arnold


If you want to double-check what license servers Arnold is trying to connect with, set the log verbosity level to the maximum, and you’ll get something like this:

' INFO : [arnold] 00:00:00  438mb   [rlm] checking connection to license servers ...
' INFO : [arnold] 00:00:05  438mb   [rlm]  5053@STEPHEN-PC ... DOWN
' INFO : [arnold] 00:00:05  438mb   [rlm]  5053@SOLIDANGLE-PC ... UP
' INFO : [arnold] 00:00:05  438mb   [rlm] found 1 license servers
' INFO : [arnold] 00:00:15  438mb   [rlm] checkout of arnold (version 400) from SOLIDANGLE-PC OK
' INFO : [arnold] 00:00:15  438mb   [rlm] expiration date: 31-dec-2013 (190 days left)
  • In Softimage, set the Verbosity to Debug.
  • In Maya, set the Verbosity Level to 6.
  • On the kick command line, specify -v 6.

[SItoA] Stopping procedural textures from swimming


The Noise shader can access the Pref coordinates to prevent swimming. But for other procedural textures, you’ll have to take a different approach (unless you whip up [a relatively simple] shader to get the Pref coordinates). Here’s one way, using ICE to store UVWs in a CAV, and then a Vertex Color node in the render tree.

First, create a Spatial projection and a Color at Vertices (CAV) property on your mesh.

Then build an ICE tree that gets the projection UVWs and stores them in the CAV.
stop_swimming2

In the render tree, use a Vertex Color to get the UVW information from the CAV, and feed that into the texture coordinates of the procedural texture.
stop_swimming1

[SItoA] Unlimited batch rendering with xsibatch -processing


Hat tip: Andy Jones on the Softimage mailing list

You can use xsibatch -processing to render scenes with Arnold. With -processing, xsibatch uses a Processing token instead of a Batch license, so you’re not limited by the number of Batch licenses you happen to have. Back in the days before third-party renderers, -processing for was for non-rendering tasks. Now it’s for non-mental ray tasks!

I was sure I tested this long ago, but obviously I must have made a mistake on my command line.


 xsibatch -processing -render //server/project/Scenes/example.scn

=======================================================
 Autodesk Softimage 11.1.57.0
=======================================================

License information: using [Processing]
# INFO : [sitoa] SItoA 2.7.1 win loaded.
# INFO : [sitoa] Arnold 4.0.12.1 detected.
 

Here’s actual proof in the form of a screenshot 🙂

xsibatch_processing_render

[SItoA] Expressions for standins of animated sequences


A standin can load an animation sequence, such as circling_cubes.[1..25].ass.
For example, if you open an Arnold_Standin property, click Browse, and select a sequence, Softimage automatically inserts a [Frame] token into the file name:

standin-path

By default, that [Frame] token resolved to the current frame, but you can override that and use an expression to drive the sequence.

For example, if you have a 25-frame sequence of ASS files, you may want to play the 25 frames and then stop. To do that, you could use this expression:

 
MIN(Fc,25)
 

If you wanted to continuously loop the 25 frame sequence, you could use an fmod (modulo) expression like this:

 
cond( fmod( Fc, 25 ) == 0, 25, fmod(Fc,25) )
 

And if you wanted to show just frames 10 to 25, you could use this expression:

 
cond( Fc<10 , 10 , MIN(Fc,25) )
 

If you’re not sure about these expressions, try playing with them in the Expression Editor. As you move through the timeline, watch the Current Value update in the Expression Editor.
fmod_expression

[SItoA] Adjusting camera exposure


Arnold added support for per-camera exposure awhile ago:

Camera exposure control: All cameras, even custom cameras, have an exposure parameter that scales the pixel samples by 2 ** exposure . Increasing the exposure by 1.0, or one stop, produces an image twice as bright, while reducing the exposure by one stop produces an image half as bright. The default value is 0 for backwards compatibility. You can also control this in in kick with the new -e option.

In Softimage, you can access the exposure parameter though the User Options.

user-options-camera-exposure

Just for kicks: Printing out shading trees


kick -tree prints the shading network for a shader node. For example, given this:

polymesh
{
 ...
 shader "Sources.Materials.DefaultLib.Material.standard.SItoA.41000.1" 
 ...
}

standard
{
 name Sources.Materials.DefaultLib.Material.standard.SItoA.41000.1
 
}

You can print out the shader tree for the standard shader like this:

set ASS_FILE=//Projects/Support/Arnold_Scenes/example.ass
set NODE=Sources.Materials.DefaultLib.Material.standard.SItoA.41000.1
set SHADER_PATH=%SITOA_BIN%
%KICK_PATH%\kick.exe -tree %NODE%  -i %ASS_FILE% -l %SHADER_PATH%

For a [simple] shading tree that looks like this:
SimpleTree
You would get this:

standard:Sources.Materials.DefaultLib.Material.standard.SItoA.41000.1
  |
  +-Kd_color = txt2d_image_explicit:Sources.Materials.DefaultLib.Material.Image.SItoA.41000.2
  |   |
  |   +-tex = sib_image_clip:Sources.Materials.DefaultLib.Material.noIcon_pic.SItoA.41000.3
  |
  +-opacity = txt2d_image_explicit:Sources.Materials.DefaultLib.Material.Image.SItoA.41000.2
      |
      +-tex = sib_image_clip:Sources.Materials.DefaultLib.Material.noIcon_pic.SItoA.41000.3

max depth:       2
total shaders:   5
cycles detected: 0

shader counts:
  2 txt2d_image_explicit
  2 sib_image_clip
  1 standard

one-to-many connections:
  2 txt2d_image_explicit:Sources.Materials.DefaultLib.Material.Image.SItoA.41000.2
  2 sib_image_clip:Sources.Materials.DefaultLib.Material.noIcon_pic.SItoA.41000.3

Notice that txt2d_image_explicit and sib_image_clip are counted twice, because those branches are plugged into two different ports on the standard shader.

[SItoA] Applying materials to standins


In Softimage, a standin object is the polygon mesh, hair, or point cloud with the Arnold_Standin property.

If you apply a material to a standin, that material will override any materials specified in the ASS file referenced by the standin. If you don’t want that to happen, give your material a name that starts with “Scene_Material” or “Standin_Material” (it doesn’t matter if you use uppercase or lowercase for the names).

If you do that, the standin object will use that material, but the objects in the ASS file will use the materials saved in the ASS file.

Here’s what you get in an exported ASS file. If SItoA finds a standin with a material name that starts with “scene_material” or “standin_material”, it exports a procedural node with no material.

procedural
{
 name standin-cube.SItoA.41000
 dso "\\server\project\Arnold_Scenes\XSI_Man.ass"
 min -4 0 -4
 max 4 0 4
 matrix 
  1 0 0 0
  0 1 0 0
  0 0 1 0
  0 0 0 1 
}

Otherwise, if you name the standin material something else, the procedural node will include a shader node for that material:

procedural
{
 name standin-cube.SItoA.41000
 dso "\\server\project\Arnold_Scenes\XSI_Man.ass"
 min -4 0 -4
 max 4 0 4
 matrix 
  1 0 0 0
  0 1 0 0
  0 0 1 0
  0 0 0 1 
 shader "Sources.Materials.DefaultLib.Test.standard.SItoA.40000.1" 
 declare procedural_shader constant ARRAY NODE
 procedural_shader "Sources.Materials.DefaultLib.Test.standard.SItoA.40000.1" 
}

[SItoA] Doing a license check in Softimage


Setting up the environment right is what often goes wrong. Running kick -licensecheck from inside Softimage is a quick way to check that you set up the environment variables correctly.

Here’s two lines of Python that will open a command prompt and run kick -licensecheck (on Windows).

#Python
from subprocess import Popen
Popen(["cmd", "/K", XSIUtils.BuildPath( Application.Plugins('Arnold Render').OriginPath, 'kick.exe' ), "-licensecheck"])

Here’s the same thing, but broken down a bit for legibility:

#Python
si = Application

p = si.Plugins('Arnold Render')
sKick = XSIUtils.BuildPath( p.OriginPath, 'kick.exe' )

from subprocess import Popen
Popen(["cmd", "/K", sKick, "-licensecheck"])

AOV Composition and opacity


AOV Composition allows opacity and transparency to carry forward into AOVs. It works only for RGB AOVs, so you won’t see it in the render region (because the xsi display driver always outputs RGBA AOVs).
aov_composition

For example, suppose you have a textured grid with an opacity map:
noicon_grid_w_opacity_map
In the render region, the Main AOV is fine, but the Arnold Direct Diffuse doesn’t have the opacity, even if you enable AOV Composition:
main_vs_direct_diffuse1
However, if you render out the image (with AOV Composition enabled and the Direct Diffuse format set to RGB), you’ll get what you expected:
arnold_direct_diffuse_aov_composition

SITOA: Adding Arnold materials through scripting


If you want to apply Arnold materials through scripting, there are a couple of undocumented commands you can use:

  • SITOA_AddMaterial takes the shader family (for example, Material or Texture) and the name of a shader, and connects that shader to the surface port on the Material node.
    # Add a standard material to the selected object
    SITOA_AddMaterial( "Material", "standard" )
    
    # Add ambient_occlusion to the selected object
    SITOA_AddMaterial( "Texture", "ambient_occlusion" )
    
  • SITOA_AddShader is similar, but it also takes a connection point as an argument, so you can connect to a specific port, such as the Environment or Displacement port.
    # Add a vector displacement shader
    SITOA_AddShader("Texture", "sta_vector_displacement", "displacement" )
    

However, neither of these commands return anything. So if you wanted to name the material, it’s not so easy. SITOA_AddMaterial does apply to the selection, so you could go through the selection to get the new material:

# Python
Application.SITOA_AddMaterial("Material", "standard")
sel = Application.Selection
mat = sel(0).Material
mat.Name = "MyStandardMaterial77"

You could write your own function with X3DObject.AddMaterial.

Here’s the simplest possible version. I don’t specify the path to a preset, just the name of the shader. That’s not terribly efficient, because Softimage now has to search for the preset (and that took about 0.2 seconds on my machine).

si = Application

def add_material( o, shader_name ):
	return o.AddMaterial( shader_name )

mat = add_material( si.Selection(0), 'Material', 'Standard' )
mat.Name = 'My_Standard_Mat'

Here’s a version that builds the path to the preset (just like the SITOA commands do), but that doesn’t require the shader family, just the name of the shader.

# dictionary of shader families, keyed by shader name
shader_types = {
  'ray_switch' : 'Material' , 
  'sta_vector_displacement' : 'Texture' , 
  'wireframe' : 'Material' , 
  'sta_displacement' : 'Texture' , 
  'ambient_occlusion' : 'Texture' , 
  'skin_sss' : 'Material' , 
  'sta_camera_projection' : 'Texture' , 
  'utility' : 'Texture' , 
  'bump3d' : 'Texture' , 
  'standard' : 'Material' , 
  'complex_fresnel' : 'Texture' , 
  'bump2d' : 'Texture' , 
  'motion_vector' : 'Material' , 
  'hair' : 'Material' , 
  'noise' : 'Texture' , 
  }


si = Application

def add_material( o, shader_name ):
	arnoldPlugin = si.plugins("Arnold Shaders");
	dspresets = XSIUtils.BuildPath( arnoldPlugin.OriginPath, '..', '..', 'Data', 'DSPresets' )
	mat = None
	if shader_name in shader_types:
		preset = XSIUtils.BuildPath( dspresets, 'Shaders', shader_types[shader_name], '%s.Preset' % shader_name )
		mat = o.AddMaterial( preset )
	return mat


mat = add_material( si.Selection(0), 'noise' )

mat.Name = 'My_Noise'