Quantcast
Channel: ArnoldRenderer – Arnold Support Corner
Viewing all 140 articles
Browse latest View live

[Arnold] Minimum CPU requirements

$
0
0

The latest Arnold 4.2.13.0 raises the minimum CPU requirements from SSE3 to SSE4.2:

  • CPUs need to support the SSE4.2 instruction set

From the Arnold Release Notes:

SSE4.2 optimizations: We have raised our minimum CPU requirements from CPUs needing to support the SSSE3 instruction set to SSE4.2. This allows us to start taking advantage of the additional SSE4 instructions to further optimize Arnold. Already we are seeing a slight speedup in several areas. For instance, the Hosek Sky shader is now 5% faster.

If you want to check whether an older machine supports SSE4.2, here’s a few suggestions:

  • Google your CPU and “SSE”
  • Windows: Download and run coreinfo -f
  • OSX: Run sysctl -a | grep machdep.cpu
  • Linux: Check /proc/cpuinfo

[Arnold] Do the right thing: use tx

$
0
0

Use tx textures. Don’t use png, jpg, tif, psd, or any other format. Convert them to tx.

Why not use those other formats?

  • Slow to load
  • Memory hungry if not tiled and mipmapped
  • Slow to render if textures exceed the texture cache size

Why use tx?

  • Fast to load
  • Efficient memory usage
  • Faster to render because they make better use of the texture cache
  • Optimizations such as the detection of constant colors and duplicate files

 

 

[MtoA] Exporting XGen archives

$
0
0

Finally, I have XGen > Generate > Export Selection as Archive working with Maya 2016 Extension 1 + SP5 on Windows 7.

I recently updated to SP5 from SP4, but I don’t know if that’s part of why the export works now. But I do know that I had to install mental ray for Maya 2016. I didn’t need to load Mayatomr, I just needed it installed. And then Export Selection as Archive worked!

PS I did see that thread on cgtalk about modifying xgenMR.py and xgenMRExport.py, but that didn’t work on my Windows 7 machine.

[MtoA] Adding user data to standin instances

$
0
0

The standard way to add user data to an Arnold node is to add an mtoa_constant attribute to the shape node in Maya. MtoA translates the mtoa_constant attributes to user data, so you can use shaders like AiUserDataColor.

Instances in Maya, however, don’t have their own shape node: they all share the shape node of the original object. So you can’t use an mtoa_constant attribute on the shape to get different user data for each instance.

But you can use override sets to get user data on instances. Put the instances in a set, and then add the mtoa_constant as an override attribute.

set_overrides

Then each instance in the set will get that user data.

Another way to add user data to instances is with the particle instancer: you can add per-particle attributes, and then list them in the Arnold > Export Attributes text box. MtoA translates all those attributes to user data on the particle instances.

[Arnold] Getting component links to node parameters with the Python API

$
0
0

Let’s say you have something like this:

alRemapFloat
{
 name alRemapFloat1
 input alCombineColor1.r
}

where the R component of the alCombineColor node is linked to the alRemapFloat.input parameter.

To get the component that is linked to input, you use the comp parameter of AiNodeGetLink(), like so:

node = AiNodeLookUpByName( "alRemapFloat1" )
comp = c_int()
linked_node = AiNodeGetLink( node, "input", comp);

Since R is connected, comp will be 0.

comp is -1 if the entire output is linked, or a number between 0 and 3 to indicate a specific component (0 for r, 1 for g, 2 for b, and 3 for a)

Note that you can pass a c_int to AiNodeGetLink(). ctypes takes care of converting it to a byref() for you.

[Arnold] Setting core affinity aka pinning threads

$
0
0

Instead of setting the core affinity yourself, you should let Arnold do it. By default, Arnold pins threads (sets the affinity) if you use more than half the cores on the machine.

If you really must set affinity yourself, you can use the Override User Options to set options.pin_threads to off.

BUT you can also limit the number of threads Arnold uses: in the Render Settings, System tab, clear the Autodetect Threads check box and then set the number of threads. For example, you could limit Arnold to six threads, and limiting the threads is probably a better approach, since you won’t end up with multiple render threads running on the same core, which can be bad for performance. This way, you wouldn’t need to set the affinity at all.

See Also:

  • As of Arnold 4.2.3.0, options.pin_threads works on Windows too.
  • Thread affinity was added in Arnold 4.0.8.0.
    From the Arnold release notes:
    Threads can now be pinned to cores on Linux. This can improve scalability in modern machines with 16 or 24+ threads and, in the case of ray acceleration structure builds, it can occasionally result in as much as a 3x speedup when all the cores are being used (which is the default in Arnold, options.threads = 0 or -t 0 in kick). The default setting is auto where thread pinning is only enabled if more than half the logical cores are being used.
    This can also be manually set to always on or off by setting the new global option options.pin_threads to on, off, or auto. Note that, if client code, for instance a custom shader, spawns their own threads manually (with pthread_create or similar), these threads will inherit the same thread affinity, which totally breaks the point of spawning threads; in these situations they can either set options.pin_threads to off or they can create their threads with the Arnold API AiThreadCreate() which will un-pin the created thread. (#2733)
  • pin_threads
    Arnold can pin threads on linux and Windows so they don’t jump between multiple processors. This can improve scalability in modern machines multiple processors. It can be set to off, on or auto. By default is set to auto, meaning that if the number of threads is more than half the number of logical cores on the machine, arnold will pin the threads.
  • Adjustable thread priority in OS X: OS X now allows for options.thread_priority to adjust the priority of the render threads. It defaults to lowest, which is lower than the system default that was previously being used. Previously this option only existed in Windows.

[MtoA] Use any mesh for a standin

$
0
0

MtoA 1.2.7.0 includes an enhancement (“standin as attribute group”) that allows you to use any mesh as a standin. So instead of the aiStandin node, you can have a proxy geometry to represent your standin.

For example, here’s a mesh shape that loads an animated ASS sequence exported from Softimage:

procedural_mesh_transslator
Note that in the shape Attribute Editor, the Arnold Translator is set to procedural.

This feature uses the mesh bounding from Maya, so it’s possible your standin maybe clipped. You can work around this either by disabling Defer Procedural Load, or by using the User Options to set the procedural min and max (for example: min -1 -1 -1 max 1 1 1).

Hat tip: Alf

[C4DtoA] Understanding shaders and AOVs

$
0
0

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


[MtoA] Running a silent install on Windows

$
0
0

On Windows, if MtoA isn’t already installed, then the /S flag will do a silent install:

MtoA-1.2.7.3-2016.exe /S

You can also specify an install location with the /D flag:

MtoA-1.2.7.1-2016.exe /S /D=C:\solidangle\mtoadeploy\2016-1.2.7.1
There’s no help, but I found the /S and /D via Google:

There is no silent install on OSX or Linux.

If another version of MtoA is installed, there will be some pop-up dialogs. You can get around that by doing a silent uninstall, like this:
C:\solidangle\mtoadeploy\2016-1.2.7.1\uninstall.exe /S

or, if you want to keep the existing install around, you could do this:

reg DELETE HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\MtoA2016 /f

After you delete that registry key, an MtoA install won’t detect an existing installation, so you get to keep the old install, and install a new version.

 

[MtoA] The case of the missing mtoa.mll

$
0
0

I woke up this morning and my MtoA was gone😉

2016-04-06_06-20-40.png

It turned out that mtoa.mll, ai.dll, and all the other DLLs were gone from the MtoA installation directory. How’d that happen? Probably when my computer had a critical Kernel Power error at 4:30am and crashed.

 

Setting the procedural’s load_at_init parameter to true would also fix this.

$
0
0

There’s an Arnold error that recommends setting the load_at_init parameter, but people don’t always know where to find that in their favorite Arnold plugin.

ERROR| [proc] c4d|Arnold_Procedural: bounds supplied to procedural node are not large enough to contain the actual underlying geometry.
Replace given bounds: (-1, -1, -1) X (1, 1, 1), with: (-9.4028616, -9.43616867, -9.21633244) X (9.3304739, 9.43616867, 9.21633244).
Setting the procedural's load_at_init parameter to true would also fix this.

The load_at_init parameter controls whether the procedural (standin) is loaded during scene intialization (before rendering starts), or during rendering (when a ray hits the procedural bounding box).

By default, load_at_init is false, which means that procedural loading is deferred until render time.

And so, in MtoA, C4DtoA, and SItoA, the load_at_init parameter is exposed as Defer Standin Load, which is enabled by default. In HtoA, you have a Load At Init parameter on for the Arnold Procedural node.

load_at_init_htoa load_at_init_sitoa load_at_init_c4dtoa load_at_init_mtoa

[Arnold] Setting up the Standard shader to be energy conserving

$
0
0

For energy conservation with Diffuse and SSS, you must have Diffuse + SSS <= 1

With Specular, it depends on whether or not Fresnel is enabled:

  • If Fresnel is off, then you must have SSS + specular + diffuse <= 1
  • If Fresnel is on, then you must only have diffuse + SSS <= 1. The shader will mix specular with diffuse and SSS in a way that’s energy conserving.

Ok, that’s the simple case (without diffuse backlighting and refraction). Now let’s add diffuse backlighting and refraction:

For energy conservation with Diffuse and SSS, you must have Diffuse + SSS + backlighting <= 1

With Specular, it depends on whether or not Fresnel is enabled:

  • If Fresnel is off, then you must have specular + (SSS + diffuse + backlighting) <= 1
  • If Fresnel is on, then you must only have diffuse + SSS + backlighting<= 1. The specular and refraction weights can be anywhere between 0 and 1, and the shader will mix everything in a way that’s energy conserving.

[MtoA] Unable to dynamically load mtoa.mll …The specified procedure could not be found.

$
0
0

If the MtoA plug-in  does not load and you get a “The specified procedure could not be found” error like this:

// Error: line 1: Unable to dynamically load : C:/solidangle/mtoadeploy/2016/plug-ins/mtoa.mll
The specified procedure could not be found.
 //
// Error: line 1: The specified procedure could not be found.
 (mtoa) //

then there’s a few basic things you need to check first:

  • Does your processor support SSE4.2? As of Arnold 4.2.13.0 (MtoA 1.2.7.0), support for SSE4.2 is required. You won’t be able to load MtoA or use Arnold if your processor doesn’t support SSE4.2.
  • Do you have the right MtoA version for your version of Maya? Major versions of Maya are not binary compatible, so for Maya 2016 you need “MtoA for Maya 2016”.
    And Maya 2016 Extension 2 is not binary compatible with Maya 2016 Extension 1, so if you have Extension 2, you need “MtoA for Maya 2016.5”

If your processor is good and you have the right version of MtoA, then it’s on to basic troubleshooting:

  • Check the environment in Maya. For example, does the PATH include any older versions of MtoA? If you’re on Windows, run the MEL command system(“set”) to get the environment. On OSX or Linux, run system(“printenv”).
  • Check for missing or conflicting libraries. On Windows, you can use Dependency Walker to  check for any conflicts or missing DLLs.

    Download and extract Dependency Walker. Then start it from inside Maya (to inherit the Maya environment). For example, I do something like this:
    system( “start C:/Users/stephen/Downloads//depends22_x64/depends.exe” );

    Then load mtoa.mll.

[Arnold] Overriding parameters of nodes created by a standin

$
0
0

A common question is “how can I override the subdivision/displacement of the nodes in a standin?”

The standard answer is: “you can’t”. A standin is an Arnold procedural node, and you can override only the parameters supported by the procedural node, which do not include subdivision or displacement.

But…here’s how to do with the [deprecated] override back door. The override node allows you set a parameter value on a specific node. So if a standin loads an ASS file with a polymesh named “tRexShape”, then you can override tRexShape.subdiv_iterations like this:

override
{
 tRexShape subdiv_iterations 2
}

So, in Maya, do this:

  • Create a standin that loads an ASS file with the polymesh nodes (in this example, a tRexShape with subdiv_iterations=1).
    trex
  • Create a second standin that loads an ASS file with the override node. Clear the Defer Standin Load check box for this second standin, and your standin will render with the override value for subdiv_iterations.
    trex_override

 

NOTE
override
nodes aren’t supported by the Arnold API, and there’s no guarantee that support for override nodes won’t be removed at some point in the future.

[MtoA] Switching between multiple versions of MtoA

$
0
0

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

 


[Arnold] Understanding the texture cache

$
0
0

Arnold uses the OpenImageIO texture cache. From the OIIO Programmer Documentation:

In short, if you have an application that will need to read pixels from many large image files, you can rely on ImageCache to manage all the resources for you. It is reasonable to access thousands of image files totalling hundreds of GB of pixels, efficiently and using a memory footprint on the order of 50 MB.

So, if you’re using tx files (tiled and mipmapped textures), then Arnold can read tiles as required, and use the texture cache to keep memory usage under control.

The reason we don’t read all the textures at once is that many of our customers have (literally) 100+GB of textures, so we use a texture cache that constantly loads small bits of texture data as required, and unloads old data.

By default, the size of the texture cache is 2048KB (as of Arnold 4.2.13.0). The size of the texture cache is set in the Arnold Render Settings.

Max Cache Size
The maximum amount of memory to be used for texture caching. Arnold uses a tile-based cache with a LRU (Least Recently Used) type algorithm, where the least recently used tiles are discarded when the texture caches is full.

Note If we get an error reading a texture, we mark that texture as bad and we never try to read it again. This makes the renderer a lot faster when you have a missing texture, since we won’t ask the file server millions of times to read from a nonexistent file. But in a transient network error case, one bad experience and the rest of your render has the texture missing.

Updating MtoA 1.2.7.3 with Arnold 4.2.14.0

$
0
0

MtoA 1.2.7.3 ships with Arnold 4.2.13.

If you want to take advantage of the improvements in Arnold 4.2.14.0 (like the increase  in the maximum number of threads from 128 to 256), here’s what you need to do:

  • Download  Arnold 4.2.14.0 and extract the archive
  • Replace Arnold (libai.so, ai.dll, libai.dylib), kick, and maketx in the MtoA bin folder with the versions from the Arnold 4.2.14.0 download
  • Replace the Arnold Python bindings in  the MtoA scripts/arnold folder with the Python bindings from the Arnold python/arnold folder. For example, replace this folder:
       C:\solidangle\mtoadeploy\2016-1.2.7.3\scripts\arnold

    with the python\arnold folder from the Arnold 4.2.14.0 download. For example:

       C:\solidangle\arnold\Arnold-4.2.14.0-windows\python\arnold

You must update the Arnold Python bindings, otherwise MtoA won’t load. That’s because Arnold 4.2.14.0 included a number of API changes, including the removal of some API (like AiLicenseSetServer). The older Python bindings still refer to the removed API, so there will be Python errors that prevent MtoA from loading.

[MtoA] Renderman performance warning

$
0
0

If you have both Renderman and MtoA installed, you may see a warning that says “Arnold for Maya degrades Renderman performance.” Unless you are running a version of MtoA from 20 months ago, this performance warning is false. MtoA does not degrade Renderman performance.

This was fixed in Arnold 4.2.3.1 (fix #4393 main thread was pinned to a single core) back in January 2015.

Exporting ASS files to specific locations

$
0
0

For the render -rt 1 command, you can specify the output ASS name in
the defaultArnoldRenderOptions.output_ass_filename attribute. For example:

set PRE_RENDER_MEL="setAttr -type \"string\"
defaultArnoldRenderOptions.output_ass_filename
 \"c:/Users/StephenBlair/Documents/test\";"

 render -s 6 -e 8 -r arnold -rt 1 -preRender %PRE_RENDER_MEL%
 C:\projects\Support\scenes\_2016\XSI_deformed_logo.mb

The scene should have the Frame/Animation ext set to something like
“name.#.ext”. Otherwise, if it is “name.ext” you’ll get filenames like
“example.ass.0004.ass”

output_ass_filename can have environment variables, but you have to be
careful to use forward slashes. For example:

set PRE_RENDER_MEL="setAttr -type \"string\" defaultArnoldRenderOptions.output_ass_filename \"%OUTPUT_ASS_FILENAME%\";"
set OUTPUT_ASS_FILENAME=C:/Users/StephenBlair/Documents/example

render -s 6 -e 8 -r arnold -rt 1 -preRender %PRE_RENDER_MEL% C:\projects\Support\scenes\_2016\XSI_deformed_logo.mb

There’s also the arnoldExportASS command, if you want to script the export.

maya -batch -file scene.mb -command "arnoldExportAss
-f "/home/blairs/Desktop/example.ass" -mask 255 -lightLinks 1 -compressed
 -shadowLinks 2 -cam sideShape;"

Force Translate Shading Engines?

$
0
0

You may have noticed the Force Translate Shading Engine option in the export dialog (or in the Feature Overrides section of the Render Settings).
force_translate_shading_engine

Force Translate Shading Engines forces MtoA to export shape nodes with a shader link, like this:

polymesh
{
 ...
 shader "aiStandard1SG"
 declare mtoa_shading_groups constant ARRAY NODE
 mtoa_shading_groups "aiStandard1SG"
}

where “aiStandard1SG” is the name of a MayaShadingEngine shader node.

This allows you to keep your shapes and shaders in separate ASS files. For example, you could have one standin that loads the shapes, and a second standin that loads the shaders. As long as the shape nodes include links to the shaders, Arnold will resolve the links and render the shapes with the right shaders.

Viewing all 140 articles
Browse latest View live