Wednesday, January 30, 2013

meTools for Afanasy

Recently, I've updated a bit Maya's Python scripts for Afanasy.
meMentalRayRender.py ver. 0.4.5
meVRayRender.py ver. 0.3.5
 
Sources are located at:
https://github.com/CGRU/cgru/tree/master/afanasy/plugins/maya/python/meTools

Now, both scripts have similar set of features and functionality:
- Maya's render layers support
- export compressed .mi (.vrscene) files
- deferred .mi (.vrscene) generation
- distributed rendering on render farm using Afanasy render manager


Render Layers


Now it's possible to render active render layer (even non renderable) or export separate .mi (.vrscene) files for all renderable render layers





















Export compressed .mi files


Due to unknown reason, Maya's documentation for Mayatomr MEL command does not mention any descriptions for -compressed option. But Maya's file exporter to mentalray format has a corresponding OptionMenu control with ability to choose compression level: 'Off', 'GzipBestSpeed', 'GzipDefault', 'GzipBest'.
So, this flag realy exists and works within Maya GUI.
But in case when someone tries to genereate compressed .mi files from command line e.g.:
Render -r mi -compressed 6 -binary 1 -file outfile.mi mayascene.ma
Maya will report the error  ' -compressed is invalid flag '... Maya 2012, 2013 -- still are treating this flag as unsupported. It's very strange...
Fortunately I've found a nice tip at http://mayastation.typepad.com
You have to edit the file $MAYA_LOCATION/bin/rendererDesc/miRenderer.xml.
Inside section,
<sep desc="Export:"></sep&gt
add the follwing line:
<mel h="Compression level: 0='Off', 1='GzipBestSpeed', 6='GzipDefault', 9='GzipBest' 
" n="compression" p="1" s="$opt +=" -compression %1"" t="int"&gt </mel&gt

Deferred .mi (.vrscene) generation


If you have $MAYA_LOCATION/bin/Render  available in $PATH system environment variable on  computers in your farm with 'mayatomr' or 'mayatovray' service enabled, now it's possible to generate .mi (.vrscene) on remote hosts. You can split sequence by tasks size parameter (e.g. 5 per host), and after each portion of files is finished, other hosts (with 'mentalray' or 'vray' service) will start to render them.













 Here is example for mentalray afanasy job with deferred scene generation:





















 And VRay afanasy job with deferred scene generation:


Distributed rendering


If Remote Hosts parameter is not empty (you can place here 'hardcoded' space separated list of desired hosts), the script will insert these hosts to command line for distributed render. But in this case Afanasy will know nothing about usage of these hosts.
Otherwise (with empty string), special keyword @AF_HOSTS@ will be added to command line, and hosts list will be dynamicaly replaced by Afanasy during rendering depending of available free hosts with corresponding service ('mentalray' or 'vray')











Mentalray distributed rendering job example:





















VRay distributed rendering job example:

3 comments:

  1. Replies
    1. Yes.
      I have some plans to add similar script for render by Arnold, as soon as will have a spare time ;)

      Delete
    2. BTW. While I've tried to find a free time, Timur already has converted meVrayRender to meArnoldRender!
      Now all scripts are moved to "cgru\plugins\maya" in GitHub repository

      Delete