The C4DtoA installer puts the C4DtoA plugin in the default location: the plugins folder of the Cinema 4D install.
If you want to put C4DtoA somewhere else, like a shared network location, you can use the C4D_PLUGINS_DIR environment variable to point to your custom plugin location.
For example, on Windows I moved C4DtoA to a different drive and then set my environment like this:
Note that I had to set PATH so C4D could find ai.dll, and that I had to use forward slashes (on Windows, C4D doesn’t like backslashes in the PATH and drops them).
On Windows, the C4DtoA installer puts a second copy of ai.dll in the C:\Program Files\MAXON\CINEMA 4D R17, so you’ll have to remove that ai.dll, and use PATH to point to the ai.dll in the C4DtoA arnold/bin folder.
You can make your ASS files portable across different platforms by using relative paths and the texture search path. For example, if all textures are specified by relative paths like “textures/noicon.tx”, then you just have to set options.texture_searchpath to specify the location of the textures folder.
kick -set options.texture_searchpath //server/project/ -dp -dw example.ass
Or if the texture search path is set to an environment variable
To use relative paths for texture file names in nodes like MayaFile, aiImage, aiPhotometricLight, and aiSkydomeLight, you just need to do the following:
- Put a relative path in the file name box (for example, in Photometry File box of an aiPhotometricLight node, or the Image Name box of an aiImage node)
- Set the Texture Search Path (Render Settings > System > Search Paths)
- Clear the Absolute Texture Paths check box
You can put multiple locations, using either : or ; to separate the paths (Arnold supports both separators on all platforms: OSX, Linux, and Windows)
You can use environment variables by putting the environment variable name in square brackets. For example:
Forward slashes work on all platforms.
MtoA appends the current project’s sourceimages folder to the texture search path.
You may wonder: why can’t I use kick -set options.shader_searchpath to tell Arnold where to find shaders?
Well, it’s because kick loads the ASS file first, then applies the kick -set parameter overrides. And also, Arnold when loads an ASS file, Arnold automatically loads shaders from the shader_searchpath as soon as Arnold loads the options node.
Here’s the sequence of events:
- kick loads all plugins specified by -l or by ARNOLD_PLUGIN_PATH before it loads the ASS file
- kick loads the ASS file. When Arnold loads the options node, Arnold automatically loads all plugins specified by options.shader_searchpath.That’s why the options node is at the top of an ASS file: so Arnold can load any required shaders before loading the shader nodes. It you move the options to bottom of the ASS file, the shader nodes in the ASS file won’t be loaded.
- Finally, after all the nodes are loaded, the -set parameter overrides are applied. At this point, it’s too late for any shaders from the -set options.shader_searchpath loacation. The corresponding nodes were already discarded during the loading of the ASS file.
Arnold 126.96.36.199 added support for per-light AOVs for volumetrics.
Here’s how to set up per-light AOVs in MtoA 188.8.131.52:
- In the light Attribute Editor, enter a name for the light group.
- Create a custom AOV for the light group. Give the AOV a name that starts with “volume_”. For example, if the light group name is “red”, then the AOV name is “volume_red”.
Loading MtoA isn’t enough to create the defaultArnoldRenderOptions node. The defaultArnoldRenderOptions node isn’t created until a user opens the Arnold Render Settings for the first time.
In code, you can do it like this:
from mtoa.core import createOptions
# Set default render options
setAttr( "defaultArnoldRenderOptions.motion_blur_enable", 1 )
When createOptions() creates the defaultArnoldRenderOptions node, it also creates the defaultArnoldDisplayDriver, defaultArnoldDriver, defaultArnoldFilter nodes and hooks them up to the defaultArnoldRenderOptions node.
Note that for setting defaults like this, you can also user a userSetup.py file. createOptions() calls hook functions that you can implement in your userSetup.py.
Here’s something important to remember when you’re debugging a scene…
By default, the MayaFile node uses a default color if a texture is missing.
This means the render won’t abort because of missing textures, and you won’t see ERRORs like these in the Arnold log for missing texture files:
ERROR | [texturesys] OpenImageIO could not open "sourceimages/noicon.tx" as tx: Could not open file "sourceimages/noicon.tx"
ERROR | [texturesys] Invalid image file "sourceimages/noicon.tx"
So missing textures can easily go unnoticed.
If you need to disable Use Default Color for testing, an easy way is to export an ASS file and then render it with kick -set MayaFile.useDefaultColor false.
I suppose you could also modify the Maya scene file directly:
import maya.cmds as cmds
for item in filenodes:
cmds.setAttr( "%s.aiUseDefaultColor" % item, b )
set_useDefaultColor( False )
And finally, you can change the default value of the Use Default Color parameter by adding this to shaders/mtoa_shaders.mtd:
default BOOL false
mayaBump2D has an RGB parameter for normal maps, and it’s named “normal_map”:
C:\solidangle\mtoadeploy\2015\bin>kick -l ..\shaders -info mayaBump2D
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
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
and then change bump2d > 2d Bump Attributes > Use As to Object Space Normals or Tangent Space Normals.
The Use As parameter controls how MtoA translates the shaders to Arnold. For example, if Use As is Object Space Normals, you get this:
Notice that file1 (the MayaFile node) is linked to mayaBump2D.normal_map.