PDA

View Full Version : Maya batch rendering


jogshy
06-11-2011, 08:46 PM
Hi, I'm developing a custom Maya renderer but I'm getting some problems with batch rendering.

1. When I press "Batch render" inside Maya an external process called "mayaBatch.exe" fires. Then... how I'm supposed to cancel the batch rendering for my renderer -cancelBatchRenderProcedure ? Using a file "exist" lock or commandPort? I tried to use renderer -cancelBatchRenderProcedure "batchRender" to call the standard cancel procedure but the mayaBatch.exe keeps rendering frames.

2. Should I iterate manually all the scene's frames inside my batch render procedure? I do this currently:


//Get width/height of the render target
string $res[] = `listConnections defaultRenderGlobals.resolution`;
int $width = `getAttr ($res[0]+".width")`;
int $height= `getAttr ($res[0]+".height")`;

//Get renderable camera name
string $camera;
string $cam[]= `listCameras`;
for( $c in $cam )
{
if ( `getAttr ($c+".renderable")` )
{
$camera = $c;
break;
}
}

//Get output image path
int $frameIndex = `currentTime -q`;
int $firstFrame = `getAttr defaultRenderGlobals.startFrame`;
int $lastFrame = `getAttr defaultRenderGlobals.endFrame`;
int $stepFrame = `getAttr defaultRenderGlobals.byFrame`;
int $f;
for ( $f=$firstFrame; $f<=$lastFrame; $f+=$stepFrame )
{
//TODO: How to test if mayBatch.exe rendering was aborted using Maya.exe's Cancel Batch?
//This script runs in different process!

currentTime $f;
string $imagesFullPath[] = `renderSettings -fullPath -genericFrameImageName $f`;

//Execute the render command
print ( "Batch-rendering frame " + $f + " to " + $imagesFullPath[0] + "\n" );
MyRendererCommand ( $width, $height, $camera, $imagesFullPath[0] );
}


Could you put a clear MEL example about how to setup multi-frame batch rendering and to cancel batch rendering, please?

Thanks.

CGTalk Moderation
06-11-2011, 08:46 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.