[MtoA] What environment variables does MtoA use?


MtoA uses these environment variables:

  • ARNOLD_PLUGIN_PATH is for shaders.
    MtoA and kick use this environment variable. Arnold doesn’t (when you write Arnold code that loads an ASS file, Arnold doesn’t getenv ARNOLD_PLUGIN_PATH)
  • MTOA_TEMPLATES_PATH is for the Attribute Editor (AE) templates of Arnold shaders. For example, if you use the alShaders:
    set MTOA_TEMPLATES_PATH  C:\solidangle\alShaders\alShaders-win-1.0.0rc18-ai4.2.12.2\ae
  • MTOA_EXTENSIONS_PATH is for MtoA extensions like Yeti. By default, MTOA_EXTENSIONS_PATH points to the extensions folder in the MtoA installation.
  • MAYA_CUSTOM_TEMPLATE_PATH is for Node Editor templates for Arnold shaders. For example, if you use the alShaders:
    set MAYA_CUSTOM_TEMPLATE_PATH C:\solidangle\alShaders\alShaders-win-1.0.0rc18-ai4.2.12.2\aexml
  • My personal favorite, MTOA_STARTUP_LOG_VERBOSITY, sets the MtoA log verbosity during startup: 1 for Errors and Warnings, 2 for Errors, Warnings, and Info, and 3 for all. This can be handy for troubleshooting MtoA loading problems.
  • MTOA_LOG_PATH is the default location for Arnold log files.

These are not MtoA environment variables:

  • ARNOLD_PROCEDURAL_PATH is an HtoA environment variable. It’s not used by MtoA (or kick).
  • MTOA_PROCEDURAL_PATH doesn’t exist. No such environment variable is used or supported by MtoA.
  • [MtoA] Unable to dynamically load : mtoa.mll The specified module could not be found.


    I have another, more general, version of this post here. This one is for new Arnold users with Maya 2017.

    Here’s what to do if you get errors like this:

    // Error: file: C:/Program Files/Autodesk/Maya2017/scripts/startup/autoLoadPlugin.mel line 32: Unable to dynamically load : C:/solidangle/mtoadeploy/2017/plug-ins/mtoa.mll
    The specified module could not be found.
    //
    // Error: file: C:/Program Files/Autodesk/Maya2017/scripts/startup/autoLoadPlugin.mel line 32: The specified module could not be found.

    Check if your processor supports SSE4.2

    If this is the first time you’ve tried to use the Maya to Arnold (MtoA) plugin, then check whether your processor supports SSE4.2.

    Reinstall MtoA

    If MtoA used to load, but now it doesn’t, then something happened to the MtoA installation. I’ve seen several cases where DLLs were missing from the MtoA bin folder; most importantly, Arnold itself was missing (Arnold is ai.dll on Windows, or libai.so on Linux, or libai.dylib on OSX).

    If you make a backup copy of the MtoA install folder, we can investigate after you fix things by installing MtoA.

    Get a Process Monitor log

    If a clean install of MtoA doesn’t work (and the computer does support SSE4.2), then “The specified module could not be found.” usually means there’s a missing dependency. Dependency Walker is a decent, if aging, tool for checking out dependencies, but for leaving no stone unturned, I prefer Process Monitor.

    The MtoA plugin (mtoa.mll) depends on a handful of files only. Here’s the log of loaded DLLs for a working MtoA:

    process_monitor_mtoa

    Here’s a quick walkthrough (no audio) of how to get a Process Monitor log:

    [MtoA] The renderer ‘arnold’ used by this scene, is not currently available


    warning_renderer_not_currently_available

    // Warning: file: C:/Program Files/Autodesk/Maya2017/scripts/others/supportRenderers.mel line 64: The renderer "arnold" used by this scene, is not currently available. The "mayaSoftware" renderer will be used instead. //

    By itself, this warning doesn’t mean there’s a problem with MtoA or Arnold. The warning means that the MtoA plugin isn’t loaded, so all you have to do is load MtoA:

    1. Click Windows > Settings/Preferences > Plug-in Manager
    2. Scroll down until you see mtoa.mll
      plug-in_manager_mtoa
    3. Click the Loaded and Auto load check boxes.

    However, if you get a “Unable to dynamically load : ../mtoa.mll The specified module could not be found.” error, then that’s a different problem.

    [Arnold] [MtoA] How to check if your processor supports SSE4.2


    This blog post is for Google search to find; I’ve already blogged about the SSE4.2 requirement elsewhere.

    If your processor does not support SSE4.2, the Arnold won’t run on your computer. MtoA will either fail to load, or you’ll get a crash whenever you try to render.

    To check whether an older machine supports SSE4.2, here’s a few suggestions:

    • Google your processor and “SSE”
      cpu-world is pretty reliable, but I have seen one or two cases where the info was wrong, and SSE4.2 wasn’t really supported by a processor.
    • Windows: Download and run coreinfo -f
    • OSX: Run sysctl -a | grep machdep.cpu.features
    • Linux: Check /proc/cpuinfo

    A note about coreinfo:

    • If you see an asterisk (*), then SSE4.2 is supported.
      SSE4.2          *       Supports Streaming SIMD Extensions 4.2
    • If you see a dash (-), then SSE4.2 is not supported.
      SSE4.2          -       Supports Streaming SIMD Extensions 4.2

    [MtoA] The curse of pymel.log


    PyMEL is great. But…if pymel.log can’t be accessed, any plugin that uses PyMEL will fail to load.

    And MtoA uses PyMEL, so every now and again I see a case where MtoA doesn’t load, and you get something like this in the script history:

    import arnold
    // Successfully imported python module 'arnold'
    import mtoa
    // Successfully imported python module 'mtoa'
    import mtoa.cmds.registerArnoldRenderer;mtoa.cmds.registerArnoldRenderer.registerArnoldRenderer()
    # Error: line 1: IOError: file C:\Program Files\Autodesk\Maya2016\bin\python27.zip\logging\__init__.py line 926: 13 #
    // Error: Failed to register renderer 'arnold' //
    // Error: line 1: initializePlugin function failed (mtoa) //

    The important bit is this error:

    # Error: line 1: IOError: file C:\Program Files\Autodesk\Maya2016\bin\python27.zip\logging\__init__.py

    That error means that PyMELcannot create a log file in your user folder.

    By default, the PyMEL log file is created in your Documents folder. For example, if your Windows user account name is Stephen, then this would be the log file:

    C:\Users\Stephen\Documents\pymel.log

    You need to check the permissions on that log file, or delete it so that PyMel can create a new log file.

    Note that the pymel.log file may be a hidden file.

    [MtoA] Hiding the image file statistics in the Arnold log


    Here’s a good example of why you might use the User Options, and how it lets you set Arnold parameters that aren’t exposed by MtoA in Maya.

    If you set the verbosity level to Warnings + Info, you’ll get some detailed image statistics in the Arnold log:

    image_file_statistics

    But what if you’ve got thousands of image files (eg udims)? You might not want all that in your log. There used to be a check box in the Arnold Render Settings that allowed you to turn off the detailed image file statistics, but we removed that a few years ago.

    But the Arnold options.texture_per_file_stats parameter is still there, so you can use the User Options field to set that parameter to false. Just enter the parameter name “texture_per_file_stats” and the parameter value, like this:

    render_settings_user_options

    Force Translate Shading Engines?


    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.