PDA

View Full Version : Automate multiple camera rendering?


kojala
12-04-2006, 10:59 AM
Im trying to automate my rendering task. I have six different cameras and three different settings to render with each camera so that makes like 18 renders. Ive managed to render with single camera in mentalrayBatchRender and the mel made the paths and file names from the camera, but with multiple cameras still no.

Ive tried to make an animation of the stages, but then there is the filename cuestion.
I cant make a scriptJob to rename the files cos there doesnt seem to be right event to
launch after the renderings.
And postRenderMel doesnt do anything with batchrender.

Any ideas?

What does "CBG command" do? How to use it?

braam
12-04-2006, 01:53 PM
Perhaps you can create three global renderlayers with settings overrided, and render via commandline.
For commandline render, create a text file:

render -r mr -cam closeup_cam horsemonkey.mb
render -r mr -cam faraway_cam horsemonkey.mb
render -r mr -cam medium_cam horsemonkey.mb
render -r mr -cam aerial_cam horsemonkey.mb
render -r mr -cam fromBottom_cam horsemonkey.mb
render -r mr -cam whatever_cam horsemonkey.mb

Save the file as .bat (ie. horsemonkey_render.bat)

Don't worry about the render range, resolution, etc. as they are derived from the settings in Render Globals.

Make sure that the file is saved in the same directory as Maya scene - (ie.horsemonkey.mb) and hit the .bat file.

MEL command for creating a global render layer:
createRenderLayer -name "setting_1" -number 1 -global;Cheers,
-B

kojala
12-05-2006, 09:46 AM
Good idea thanks.

but Im solving it this way:

Im using "renderWindowRenderCamera render renderView $cameras[0];" command
and renderview rendering is supported by postRenderMel so Im hoping that Im able to chain up my renderings that way. Im not yet finished.

kojala
12-08-2006, 01:03 PM
global proc do_things_stop()
{
setAttr -type "string" mentalrayGlobals.postRenderMel "";
print "jauzaa!!\n";
renderWindowRenderCamera render renderView persp;
}

global proc do_things()
{
setAttr -type "string" mentalrayGlobals.postRenderMel "source test_post_render_2; do_things_stop();";
renderWindowRenderCamera render renderView persp;
}
to make this work >

save code as: "test_post_render_2.mel"
paste to button: source test_post_render_2; do_things();

well... it wasnt as easy I thought it would be. This crashes maya , but if you add // in the ...proc do_things_stop()... //renderWindow... then it works ok, but without the second render. why doesnt it work with two? why cant I call rendering in postRenderMel?

PLEASE help...

kojala
12-08-2006, 02:07 PM
Am I the onlyone who has been thinking about this problem?

heelp!

If postRenderMel returns too quickly and maya isnt ready yet...would there be
some wait function for maya to wait like a second?

braam
12-08-2006, 03:05 PM
Perhaps you should try other attribute "defaultRenderGlobals.postMel" instead of "mentalrayGlobals.postRenderMel" as they are not the same.

You can set mentalray as renderer in defaultRenderGlobals...

It is far easier to use this way as you have better and visual control over the render settings:
Create three global renderlayers with settings overrided, and render via commandline.
For commandline render, create a text file:

render -r mr -cam closeup_cam horsemonkey.mb
render -r mr -cam faraway_cam horsemonkey.mb
render -r mr -cam medium_cam horsemonkey.mb
render -r mr -cam aerial_cam horsemonkey.mb
render -r mr -cam fromBottom_cam horsemonkey.mb
render -r mr -cam whatever_cam horsemonkey.mb

Save the file as .bat (ie. horsemonkey_render.bat)

Don't worry about the render range, resolution, etc. as they are derived from the settings in Render Globals.

Make sure that the file is saved in the same directory as Maya scene - (ie.horsemonkey.mb) and hit the .bat file.
Cheers,
-B

kojala
12-08-2006, 03:20 PM
Is it possible to set the path for image saving and the filename if I use that bat metod?

My mel is working now for one camera and its saving the path that I have defined and it takes the name from the camera.

I know that it might be easier but still... I cant stop thinking about this maya possibility. It would be so great if it would work.

thanks for answering.

kojala
12-08-2006, 03:43 PM
DAMM!!

IT WAS SO SIMPLE!!


renderWindowRenderCamera render renderView camera_1;
print "RENDERED_1\n";
renderWindowRenderCamera render renderView camera_2;
print "RENDERED_2\n";

When I started to think this mel I first tested batchRender command. It wasnt possible to cue that command because it turned the rendering off after the second call. I thought that this "renderWindowRenderCamera" was similar but no. IT WAS CUEABLE!

kojala
12-08-2006, 04:32 PM
So Im using

renderWindowEditor -edit -writeImage $tex_path "renderView";

this code for saving the image.
And there was a problem if image existed already. I fixed that by deleting the file before
the rendering with:

int $exist = `filetest -f ($tex_path + ".tga")`;
int $deleted;
if ($exist == 1)
{
$deleted = `sysFile -delete ($tex_path + ".tga")`;
}
if ($deleted == 1)
{
print ("Deleted old image. Path: " + $tex_path + ".tga\n");
}

mel rules!

CGTalk Moderation
12-08-2006, 04:32 PM
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.