maya py and batchrender, going insane.

804 views
Skip to first unread message

Johan Forsgren

unread,
Feb 17, 2014, 1:45:46 PM2/17/14
to python_in...@googlegroups.com
Hi list! im tinkering on a tool that basically applies a few imported shaders and then is supposed to bathrender out a jpg, all through mayapy.exe and some argvars. 
the import/apply shading bit went pretty well but I'm a bit stuck on the bathrendering out bit, it seems like its not as easy as just having cmds.BatchRender() i my .py , it doesnt throw any errors, but doesnt spawn mayabatch either.... am I missing something?

Ævar Guðmundsson

unread,
Feb 17, 2014, 2:45:15 PM2/17/14
to python_in...@googlegroups.com

  There is a way to do as you are attempting, however before getting into that have you looking into separating your processes.

  By your description, in pseudo code you are doing this procedure:

 

--[script.py

  01 - Import shaders

  02 - perform application

  03 - render

[bash-01]>./script.py

…Result: rendered images

 

By using the shipped in Render command you can find in your installation you already have granular control over your renders, so the procedure would be:

--[script.py

  01 - import shaders

  02 – perform application

  03 – save new version of scene

[bash-01]>./script.py

[bash-02]>./Render scene_version.mb

…Result: rendered images

 

  ////

  Same result but saves you a lot of code building if you do it like that and you have off the shelf distribution capabilities.  But if you still want to then each flag that the Render command uses is also accessible within python of course


http://download.autodesk.com/global/docs/maya2014/en_us/CommandsPython/render.html

  { If you use this one just batch and split your operations within your code and you have a batch renderer }


Johan Forsgren

unread,
Feb 18, 2014, 2:07:12 AM2/18/14
to python_in...@googlegroups.com
From the docs I take it that the render() command is just for maya software right? I need this to be v-ray/mentalray/Arnold.  But your first suggestion should work, I'll take a look at it In the morning. Thanks!



--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/21a707de-1082-4c51-85be-f2572b5b0bb5%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


--
Johan Forsgren
3D Artist
Phone + 46 31 752 20 07 johan.f...@edithouse.se

Follow us at facebook.com/edithousefilmworks
edithouse FILM WORKS www.edithouse.se
Lilla Bommen 4a, S-411 04 Göteborg, Swedenwww.facebook.com/edithousefilmworks

aevar.gu...@gmail.com

unread,
Feb 18, 2014, 2:12:46 AM2/18/14
to python_in...@googlegroups.com
haha, good point, in which case you definitely want the Render command;

Render -r mr myscene.mb
Render -r Arnold myscene.mb
Render -r vray myscene.mb

  lets you switch between renderers with quite the ease.  You can almost copy paste render command between them and render separate layers with separate renderers

{rendering a beauty pass in Arnold and occlusion in mental ray for example}
Render -r arnold -rl beauty myscene.mb
Render -r mr -rl occlusion myscene.mb

  The most notable thing between them they all have a -v (verbosity) flag but Arnold removed it for some reason, and there is weird syntax in getting multi channel exr files stated, you need to encapsulate the renderer definition in brackets.

Render -r vray -v 5 -rl diffuse -of “exr (multi)” myscene.mb

  Have fun, it gets really interesting even on a single machine, tip; keep an eye on your actual processing meter and determine how many you can start without stalling your machine, then look into mental ray satellite and the vray distributed renderer for a super easy setup to get additional render power from any free CPU around you, even an old £10 laptop if left unused will aid in your workspace renders by chipping in on processing a pixel or 2, if you are in a production environment that means every computer with the screensaver turned on could potentially be cutting half your render time down through an additional CPU pool. :)
 

Johan Forsgren

unread,
Feb 20, 2014, 6:00:48 PM2/20/14
to python_in...@googlegroups.com
So i finally got som time to get it set up, works like a charm.  
The actual process became pretty complex, I basically have this python tool executing the mayapy, in which I do some operation on my scene and call batchrender.  

The only thing though is that I had to do it via a .bat file containing the render command, calling "render -r vray" directly from subprocess in mayapy got me a "access denied" error.  Any idea why that would be the case?
Since this is all happening on the server I'm guessing it has something to do with file permissions or something pesky like that.   Either way thanks a lot :) 



--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.

For more options, visit https://groups.google.com/groups/opt_out.


--

Ævar Guðmundsson

unread,
Feb 20, 2014, 6:29:37 PM2/20/14
to python_in...@googlegroups.com
What does the output of import os;os.environ["RENDER_DESC_PATH"] return?

  Initial thing I can think of is access problems to the renderer description found in the output of that variable, if the output of that command is then a folder where you have full access paste the travelog and I'm sure it's something simple, permission errors on these are usually just a minimal tweak

 -sent from my iPhone
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/W6QbXBDl-HM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANSD_rqsbGn2iA6tGi7nK%3Dx3mDOucXO4KKcjSYhRfezLGXSSYA%40mail.gmail.com.

Johan Forsgren

unread,
Feb 22, 2014, 5:13:38 PM2/22/14
to python_in...@googlegroups.com
Key error! So no Wonder it doesnt work properly.  Shouldnt this be set by default? 
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/W6QbXBDl-HM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CANSD_rqsbGn2iA6tGi7nK%3Dx3mDOucXO4KKcjSYhRfezLGXSSYA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/078DA604-BEF9-4722-9C4E-B8AC373474BD%40gmail.com.

For more options, visit https://groups.google.com/groups/opt_out.

cfred...@alchemic.ltd

unread,
Feb 20, 2019, 3:28:35 PM2/20/19
to Python Programming for Autodesk Maya
On Monday, February 17, 2014 at 10:45:46 AM UTC-8, Johan Forsgren wrote:
> Hi list! im tinkering on a tool that basically applies a few imported shaders and then is supposed to bathrender out a jpg, all through mayapy.exe and some argvars. 
> the import/apply shading bit went pretty well but I'm a bit stuck on the bathrendering out bit, it seems like its not as easy as just having cmds.BatchRender() i my .py , it doesnt throw any errors, but doesnt spawn mayabatch either.... am I missing something?

I'm also running into issues rendering. I'd like to use maya.cmds.render() since it's simple and available in mayapy, and works. The layer option doesn't seem to work though. After creating a layer according to some docs I found if I try using the layer option to render() I always get:

Error: cannot find layer .....

Carl Frederick

unread,
Feb 20, 2019, 5:47:57 PM2/20/19
to python_in...@googlegroups.com
After looking at the list of renderLayer objects I found that the layer I generated was named differently than I had specified, it had a ‘rs_’ prepended to the name. When I specify that name in the render() command layer option the script works. Ugh.
> --
> You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/W6QbXBDl-HM/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c560dfb0-4681-4782-bdd6-500f458c8263%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages