Removing MtoA from Maya scenes


If you don’t use Arnold, but someone has saved your scene files with MtoA loaded, then you’ll get some errors and warnings when you open that scene without MtoA.

// Error: line 0: The camera 'perspShape' has no 'ai_translator' attribute. // 
// Error: line 0: Node "perspShape" has no attribute "ai_translator". // 
// Error: line 0: The camera 'topShape' has no 'ai_translator' attribute. // 
// Error: line 0: Node "topShape" has no attribute "ai_translator". // 
// Error: line 0: The camera 'frontShape' has no 'ai_translator' attribute. // 
// Error: line 0: Node "frontShape" has no attribute "ai_translator". // 
// Error: line 0: The camera 'sideShape' has no 'ai_translator' attribute. // 
// Error: line 0: Node "sideShape" has no attribute "ai_translator". // 
// Error: line 0: The mesh 'pPlaneShape1' has no 'ai_translator' attribute. // 
// Error: line 0: Node "pPlaneShape1" has no attribute "ai_translator". // 
// Error: line 0: The mesh 'pSphereShape1' has no 'ai_translator' attribute. // 
// Error: line 0: Node "pSphereShape1" has no attribute "ai_translator". // 
// Error: line 0: The mesh 'pCubeShape1' has no 'ai_translator' attribute. // 
// Error: line 0: Node "pCubeShape1" has no attribute "ai_translator". // 
// Warning: line 0: Unrecognized node type for node 'defaultArnoldRenderOptions'; preserving node information during this session. // 
// Warning: line 0: Unrecognized node type for node 'defaultArnoldFilter'; preserving node information during this session. // 
// Warning: line 0: Unrecognized node type for node 'defaultArnoldDriver'; preserving node information during this session. // 
// Warning: line 0: Unrecognized node type for node 'defaultArnoldDisplayDriver'; preserving node information during this session. //

Here’s how to remove all the MtoA (aka Arnold) attributes and nodes.

First, don’t load MtoA. Uninstall MtoA.

Now, just loading and saving your scene will get rid of the ai_translator attributes. All that’s left to do is get rid of the unknown nodes. There’s just four (assuming nobody created any Arnold shaders or lights or standins in the scene): the four defaultArnold nodes:

ls -typ "unknown";
// Result: defaultArnoldDisplayDriver defaultArnoldDriver defaultArnoldFilter defaultArnoldRenderOptions //

Here’s a MEL script to remove all unknown MtoA nodes from a scene:

string $mtoaNodes[] = `ls -typ "unknown"`;

for ($node in $mtoaNodes){
	if (`objExists $node` && `unknownNode -q -p $node` == "mtoa"){
		print("Deleting mtoa node " + $node + "\n");
		delete $node;
	}
}

Setting up Arnold render nodes


I’ve seen several variations of this question recently. Usually there’s some confusion about “Arnold standalone” and what’s actually required on a render node.

If you rendering scene files from Maya, or 3ds Max, or some other 3d application, then you do not need Arnold standalone.

You need the 3d application (Maya, 3ds Max) and the Arnold plugin for that application (MtoA, MAXtoA).

For example, let’s suppose you want to render Maya scene files.

  • You need to install Maya and MtoA on each render node.
  • You don’t need Maya licenses for batch rendering, and you don’t need licenses to install Maya on render nodes.
  • You need Arnold licenses, which are a separate purchase. MtoA is free and unlicensed. Arnold, however, does require a license to render without the watermark. You need one Arnold license for each render node (for you CINEMA 4D users, a TeamRender client is an Arnold render node and requires its own license).
  • You need an Autodesk network license server running somewhere (not on a render node).
  • You need to connect Arnold to the Autodesk network license manager, and you do that by setting ADSKFLEX_LICENSE_FILE.

It’s the same thing for 3ds Max and MAXtoA.

[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

 

[MtoA] mtoa missing from Plug-in Manager


If mtoa.mll is not listed in the Plug-in Manager, that means that Maya did not find the MtoA module file (mtoa.mod). And if you try to manually load mtoa.mll, you’ll get errors like this:

// Error: file: C:/Program Files/Autodesk/Maya2016/scripts/others/pluginWin.mel line 781: Unable to dynamically load : C:/solidangle/mtoadeploy/2016/plug-ins/mtoa.mll
The specified module could not be found. // 
// Error: file: C:/Program Files/Autodesk/Maya2016/scripts/others/pluginWin.mel line 781: The specified module could not be found. (mtoa) //

To load MtoA, you need to make sure that Maya finds the MtoA module file.

By default, the MtoA installer puts the mtoa.mod file in the user’s modules folder. For example:

C:\Users\StephenBlair\Documents\maya\2016\modules

If you installed MtoA using one user account, and try to run Maya with a different user account, Maya will not find the module file.

The module file has to be in the MAYA_MODULE_PATH. For example, for the user account “StephenBlair”, here are the default places where Maya looks for modules:

  • C:/Program Files/Autodesk/Maya2016/modules
  • C:/Users/StephenBlair/Documents/maya/2016/modules
  • C:/Users/StephenBlair/Documents/maya/modules
  • C:/Program Files/Common Files/Alias Shared/Modules/maya/2016
  • C:/Program Files/Common Files/Alias Shared/Modules/maya
  • C:/Program Files/Common Files/Autodesk Shared/Modules/maya/2016

If you want MtoA to available to all users, then you could copy mtoa.mod to one of the common locations.

[MtoA] Normal mapping with mayaBump2d


mayaBump2D has an RGB parameter for normal maps, and it’s named “normal_map”:

C:\solidangle\mtoadeploy\2015\bin>kick -l ..\shaders -info mayaBump2D
node:         mayaBump2D
type:         shader
output:       RGBA
parameters:   11
filename:     ..\shaders/mtoa_shaders.dll
version:      4.2.4.1

Type          Name                              Default
------------  --------------------------------  --------------------------------

FLOAT         bump_map                          0
FLOAT         bump_height                       1
RGB           normal_map                        0, 0, 1
BOOL          flip_r                            true
BOOL          flip_g                            true
BOOL          swap_tangents                     false
BOOL          use_derivatives                   true
BOOL          gamma_correct                     true
ENUM          use_as                            bump
RGBA          shader                            0, 0, 0, 1
STRING        name

In Maya, you don’t connect your normal map directly to mayaBump2D.normal_map. Instead, just connect the normal map alpha to the Bump Value
normal_map_mayaBump2D
and then change bump2d > 2d Bump Attributes > Use As to Object Space Normals or Tangent Space Normals.
mayaBump2D_Use_As
The Use As parameter controls how MtoA translates the shaders to Arnold. For example, if Use As is Object Space Normals, you get this:

mayaBump2D
{
 name bump2d1
 bump_map file1.a
 bump_height 1
 normal_map file1
 flip_r on
 flip_g on
 swap_tangents off
 use_derivatives on
 gamma_correct on
 use_as "object_normal"
 shader aiStandard1
}

MayaFile
{
 name file1
 ...
 filename "shaders_offest_normalmap.jpg"
 ...

Notice that file1 (the MayaFile node) is linked to mayaBump2D.normal_map.

The case of the disappearing particles


In this case, nParticles (render type = point) weren’t visible behind a refractive plane:
particles_not_visible

For the points render type, you get an Arnold points shape (with mode “disk”), so I exported an ASS file to see the parameter settings on the points node. I noticed the visibility 243 right away (the default visibility is 255, which is visible to all rays). And sure enough, in the Render Stats for the particle shape, some rays were turned off (and the check boxes were disabled too).
particles_render_stats

I used the User Options to force the visibility to 255
particles_useroptions
and the particles behind the refractive surface appeared:
particles_visible

This is a Maya thing. For most particle render types, the particles are not visible in reflections or refractions. It says so in the docs:

You can turn on reflections, refractions, and shadows when you software render Clouds, Tubes, and Blobby Surfaces

I’m not sure where the default values are set, but I did find the AEtemplate code that disables the render stats for all particle render types except the “s/w” type:

// C:\Program Files\Autodesk\Maya2015\scripts\AETemplates\AEparticleLayout.mel
		if( $value == 7 || $value == 8 || $value == 9 ) {
			// software particle type
			editorTemplate -dimControl $nodeName "visibleInReflections" false;
			editorTemplate -dimControl $nodeName "visibleInRefractions" false;
			editorTemplate -dimControl $nodeName "castsShadows"    		false;
			editorTemplate -dimControl $nodeName "receiveShadows" 		false;
			editorTemplate -dimControl $nodeName "primaryVisibility" 	false;
		} else {
			// hardware particle type
			editorTemplate -dimControl $nodeName "visibleInReflections" true;
			editorTemplate -dimControl $nodeName "visibleInRefractions" true;
			editorTemplate -dimControl $nodeName "castsShadows"			true;
			editorTemplate -dimControl $nodeName "receiveShadows" 		true;
			editorTemplate -dimControl $nodeName "primaryVisibility" 	true;
		}

So, since that AE template code just enables and disables UI controls, but doesn’t change the actual values, another way to enable Visible in Refractions (or Visible in Reflections) is to do this:

  1. Change the Particle Render Type to one of the “s/w” types, like Blobby Surface.
  2. Now the Visible in Refractions check box is enabled.
  3. Select the check box.
  4. Go back and change the Particle Render Type to points.

Now when you render, the points are visible to refraction rays, so they show up behind the glass.