[MAXtoA] Setting up an Object ID AOV


Here’s how to use the 3ds Max object ids for a simple Object ID AOV.

And here’s the material (aka shader tree) that writes the AOV. Use a text editor to save this as Arnold Scene Source (.ass) file, and then import it into 3ds Max (like I did in the video).

An ASS file is a plain-text file.

### exported: Thu May 21 07:53:19 2020
### from:     Arnold 6.0.3.0 [991b08e9] windows icc-17.0.2 oiio-2.2.1 osl-1.11.0 vdb-4.0.0 clm-1.1.1.118 rlm-12.4.2 optix-6.7.0 2020/04/17 09:11:12
### host app: MAXtoA 4.0.4.36 (2021) 3ds Max 23.0.915.2021 

aov_write_rgb
{
 name /Write_Object_ID_AOV
 aov_input /gBufID_Switch
 aov_name "object_id"
 declare nodeName constant STRING
 nodeName "Material #43"
}

switch_rgba
{
 name /gBufID_Switch
 index /gBufID
 input1 1 0 0 1
 input2 0 1 0 1
 input3 0 0 1 1
}

user_data_int
{
 name /gBufID
 attribute "gBufID"
}

[C4DtoA] Understanding shaders and AOVs


Arnold takes care of writing the built-in AOVs like N, P, Pref, A, and the all-important beauty. But it’s shaders that write to AOVs like direct_diffuse. That’s why something like this is not going to give you what you might expect in the AOVs:

layer_colors

layer_color doesn’t write to AOVs, so you won’t see the layered result in an AOV like direct_diffuse. standard does write to the direct_diffuse AOV (and others), but in this setup, you have multiple standards and they end up overwriting each other, so you get just the last standard output in the AOVs.

It’s better practice to avoid having multiple standard nodes in a single material; instead, layer the maps that go into the standard parameters like the diffuse and specular colors.

Or you could use a node like mix, or the third-party alLayer, which support AOVs. You can tell if a node writes AOVs by looking at its Attribute Editor: there’s usually a tab or list where you can change the names of the AOV outputs.

mix_aovs

[Arnold] Standard shader AOVs and shading trees


Here’s a question asked recently. Given a shading tree like the one below, why don’t AOVs like diffuse_direct include the blended color from the Blend Color node?

aovs_blend_color

The answer: because it is the Standard shader that writes the AOV, not the Blend Color shader. The diffuse_direct AOV gets the diffuse layer calculated by the Standard shader, and that’s it.

The MtoA AOV browser shows you what AOVs are implemented by which shaders:
aovs_mtoa_browser

Creating object mask AOVs that include opacity


  • Create a custom RGB AOV.
  • Use aiWriteColor to write the object mask to the custom AOV. The Input color of the aiWriteColor is the mask color, and you have to enable Blend to get the opacity blended into the Input.
    mask_opacity_aiWriteColor
  • Connect the Out Color of the aiWriteColor to the Color of a Standard shader. That sends the aiWriteColor beauty to the Standard.
    mask_opacity_Nodes
  • Make sure Enable AOV Composition is turned on in the Render Settings.
    EnableAOVComposition

I don’t think this set up works if you plug a Standard into the beauty of the aiWriteColor (eg Standard > aiWriteColor > Standard). With that set of connections, I could never get the opacity right in both the Beauty and the Mask AOVs.

[MtoA] Creating color masks with a custom AOV and the Utility shader


In this video, I show how to a color mask AOV using a custom AOV and the Utility shader. Topics covered include:
– Creating a custom AOV
– Setting the default shader for a custom AOV
– Setting up the Utility shader to output a color for each shape
– Understanding the difference between the Color and Color ID color modes

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

Rendering a Z-depth AOV with Arnold


To get z-depth data out of Softimage with Arnold, you can use the built-in Softimage Depth render channel. Depth outputs a floating point image, so you need to use a format like EXR.

Depth

The Depth channel will give you non-antialised, non-normalized depth data in the alpha channel. In the DCC, it will appear solid white, but that’s because the data is non-normalized.
Depth-RR

Non-normalized means that the Z depth values are not between 0 and 1, but between the near and far camera clipping planes, so you need to divide the Z values by the far clipping plane value to get 0..1 values. You can use a compositing package like Nuke for this. Myself, I don’t have Nuke, so I used Composite to normalize the Z depth AOV:
Depth-composite

In Maya, you’d use the Z AOV to render out the Z-depth information. In Softimage, Depth is mapped to the Z AOV, and if you export a .ass, you’ll see the “Z” AOV listed in the options node.

 outputs 2 1 STRING 
  "RGBA RGBA sitoa_output_filter Passes.Default_Pass.Main" 
  "Z FLOAT sitoa_closest_filter Passes.Default_Pass.Depth"