[macOS] Rendering xgen procedurals in another app


Or: how to fix the node xgen_procedural” is not installed problem.

For example, suppose you want to render XGen hair in CINEMA 4D on macOS.

  • From MtoA, export your XGen hair to an ass file.
  • Set DYLD_LIBRARY_PATH before you start your application (for example, open a Terminal, set DYLD_LIBRARY_PATH there, and start CINEMA 4D the command line)
    export DYLD_LIBRARY_PATH=/Applications/Autodesk/maya2018/plug-ins/xgen/lib:/Applications/Autodesk/maya2018/Maya.app/Contents/MacOS
  • Load the ass file into CINEMA 4D with an Arnold Procedural.
  • Set the Plugin Search Path to the MtoA procedurals folder

[MAXtoA] Rendering XGen in 3ds Max


 

You can export an ASS file from Maya (with the XGen primitives) and then use an Arnold Procedural to load the ASS file into 3ds Max.

You need to add these two folders to the system environment variable Path:
  • C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\bin
  • C:\Program Files\Autodesk\Maya2018\bin

For example, you can copy this:

C:\Program Files\Autodesk\Maya2018\plug-ins\xgen\bin;C:\Program Files\Autodesk\Maya2018\bin;

and paste it at the beginning of the current Path:

windows_sys_env_var

Restart 3ds Max after you do this.

Then add the MtoA procedurals folder to the Plugin Search Path:

maxtoa_plugin_search_path

 

[MtoA] Exporting XGen archives


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.

UPDATE: In summary, to export XGen archives, you need to:

  • install Mayatomr (but you don’t need to load it)
  • load xgenMR.py and xgenToolkit.mll

[Linux] Missing .sog files?


Sometimes on Linux you may get “unable to load dynamic library” errors for .sog files. Like this:

00:00:00     0MB WARNING |  unable to load dynamic library: /home/stephen/solidangle/mtoa/2014/xgen_procedural.sog: cannot open shared object file: No such file or directory 

or this:

00:00:00     0MB WARNING |  unable to load dynamic library: /usr/apps/houdini/houdini-13.0.343/htoa/arnold_plugins/driver_houdini.sog: cannot open shared object file: No such file or directory 

Don’t worry about the “.sog” part. In most cases, Arnold isn’t actually looking for a .sog file. Arnold is trying to load a .so file, and either the .so itself or a dependency is missing. The “.sog” is printed by mistake in the log message (and this is fixed in the next Arnold version).

So (heh) focus your investigation on why Arnold couldn’t load the .so file (try running ldd on it).

In the two examples above:

  • xgen_procedural.so couldn’t be loaded because LD_LIBRARY_PATH didn’t include the Maya lib folder, so all the tbb-related libraries were missing.
  • driver_houdini.so was missing some Houdini dependencies, but in this case it was being loaded into MtoA, so driver_houdini wasn’t needed and the warning could be safely ignored.

What’s a .sog?
If a plugin has a .sog extension, AiLoadPlugins() will load the plugin with RTLD_GLOBAL, which means the symbols from the plugin will be globally exposed and available to other plugins.

.sog is a Maya naming convention for an .so to be dlopen’ed with RLD_GLOBAL

[Maya] The case of Xgen and [Error 6] The handle is invalid


This post is about a Maya issue on Window. It’s not an MtoA or Arnold issue.

Whenever I tried to export the selection as an XGen archive, I’d get [Error 6] The handle is invalid.

[Error 6] The handle is invalid
xgmArchiveExportBatchUI.py except block
xgmArchiveExportBatchUI.py call subprocess.Popen
mayapy "C:/Program Files/Autodesk/Maya2014/plug-ins/xgen/scripts/xgenm/xmaya/xgmArchiveExportBatch.py" 0 0 0 1.0 1.0 -destName ["'DragonArchive'"] -destDir ["'C:/Users/SOLIDANGLE/Documents/maya/projects/Support/xgen/archives/'"] -sourceFiles ["'C:/Users/SOLIDANGLE/Documents/maya/projects/Support/scenes/Dragon1.mb'"] -scriptPaths ["'C:/Program Files/Autodesk/Maya2014\\plug-ins\\xgen\\scripts'"] -loadPlugins ["'AbcExport'", "'Mayatomr'", "'xgenMR.py'"]
xgmArchiveExportBatchUI logging to C:/Users/SOLIDANGLE/Documents/maya/projects/Support/xgen/archives/DragonArchive.log

Googling [Error 6] The handle is invalid subprocess.Popen led me to the problem: I was starting Maya from the command line. When I started Maya from the Start menu, then the XGen Export Selection worked.

The reason I start Maya from the command line is because that’s the only way I can get the MtoA diagnostics in the Output Window. So something seems a little weird about how Maya handles STDOUT and STDERR 😉