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:

9 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
  2. Hello,

    I'm trying to make Afanasy work with Vray for Maya.
    Using the CGRU plugin and launching the job with Maya Batch it works perfect but when I try to render with meVRayRender (after generating the .vrscene) I think there is a problem with my environnement variable because the logout from Afanasy tells me that Vray is not recognised as a renderer... So my question is what did you do to make it work ? :D

    I've already asked Timur about my problem but he doesn't work with VRay.

    By the way I have created a little blog about how to setup a renderfarm and use it with open source software like Afanasy and Natron : http://ramellij.blogspot.fr/
    And of course I'm using Afanasy that's why I need to make it work with Vray !

    Here is my mail if you need :
    ramelli.jonathan@gmail.com

    Thanks for your help
    JR

    ReplyDelete
    Replies
    1. Nice blog, Jonathan!
      Most problems are with environment variables...
      "afrender" keeps its own copy of environment, hence you need restart it everytime,
      when you edit environment variables.

      Delete
  3. Im making something with Maya 2017 testing

    ReplyDelete
  4. hellow, how to lunch scripts from maya ?

    ReplyDelete
  5. Short description about launching the script is located inside python file header.
    You have to add $CGRU_LOCATION/plugins/maya to $PYTHONPATH environment variable first.

    ReplyDelete