Saving composited image sequence out of Maya

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  06 June 2013
Saving composited image sequence out of Maya

I have very simple compositing needs: a normal colour pass, and an occlusion layer multiplied on top. If I do a preview render with "render all layers" turned on it will render both layers and composite them into a final image that is exactly what I need. Unfortunately, when I batch render the scene I get two separate image sequences that I now have to got through the trouble of opening up in another program, compositing together, and then spitting out a third image sequence. It's not hard, but it's a waste of time when I have dozens of scenes to do, and Maya is clearly capable of doing it for me - it just isn't saving it for me. I suppose I can render a frame, and then save the image out of the Render View, and do it over and over again for every frame (!) but obviously that's even more time consuming. Isn't there just a way to have Maya spit out the composited layers into a single image sequence?
If you're just coasting, you must be going downhill.
  06 June 2013
I don't know if you can use the normal batch render but there is a script around that let you save a range of frames rendering them directly in the render view.
I am sorry but I have never used it so I can't tell you the name of it

This little snippet should let you render the sequence, just change the start and end variables.
You will find the renders in the tmp folder
import maya.cmds as mc
import maya.mel

pStart = 1
pEnd = 11

for oFrame in range(pStart, pEnd):
    mc.currentTime(oFrame, e=True)
    maya.mel.eval('renderWindowRender redoPreviousRender renderView;')

Last edited by nookie : 06 June 2013 at 02:29 PM.
  06 June 2013
First, I'd say if you're doing this with MR shaders (like mia_material_x and the ambient occlusion shader), you can get the output directly from a batch render really easily. Just plug the "result" of the mia shader and the outcolor (or whatever the output) of the occlusion shader is called into a layered texture, and put the occlusion shader on top and set to multiply. Plug the output into the surface shader, and you should be good to go.

Anyway, for a more general automatic compositing, you can do the following:
Assuming you have 1 layer for the color etc, and the other for occlusion, this would be the process to composite them accordingly.

In the hypershade, under the rendering tab, you'll see your two layers (you could see render passes here as well, if you had any). One of the nodes will be the color, the other will be the occlusion, plug these into a layered texture node, the same way as above (instead of plugging in shaders, plug in the nodes in the rendering tab), set the occlusion to multiply.

Next, create a render target node. Plug the output of the layered texture into that (default connections should work fine).

Finally, open the batch render options (the window that pops up when you hit the box next to batch render). Under Rendered Output, set the render nodes to All Renderable. Go ahead and batch render. It will render the first layer, then the second layer, and then do a third run for the compositing (which is very quick in this case).

To figure this out I watched this video:
And I read this page

Should give you a pretty good idea of what's going on if I wasn't clear. I believe this workflow only works for MR.
  06 June 2013

Thanks for the quick reply, nookie, but I couldn't get it to work due to a syntax error. I'm not to familiar with debugging MEL, but the problem could very well be because I'm using Maya 2012 - more on that later.

VERY informative idea and links, VB2341, but since nookie mentioned a script I thought: duh why haven't I checked Creative Crash for this?

I found a handful of scripts there for rendering a sequence out of the Render View window, but I couldn't get any of them to work. I noticed that they all failed because of the same "object ‘renderView’ not found" error. A quick searched turned up what seems to be a bug in Maya 2012, that can be easily fixed with a bit of MEL.

Now back to the scripts from Creative Crash, I used the most recent one, IK Render View Renderer and after running the fix it worked like a charm. Hopefully I don't have to run the fix every single time, but I saved it as a shelf button so it'll only take a moment if I do.

If you're running and older Maya like 2009 (and probably any pre-2012) you've already set your settings in the Render Settings and you want a simpler batch Render View script that won't ask you to re-fill all of the same fields about camera, resolution, etc. there's SmaRender.
If you're just coasting, you must be going downhill.
  06 June 2013
Sorry, I forgot to point out that it was a python snippet
Happy to know that you sorted it out though
  06 June 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:50 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.