Difference between revisions of "Maya Batch Render"

From Antoine Vienne | Wiki
Jump to navigation Jump to search
(Maxwell Batch Render - Windows)
Line 25: Line 25:
 
"C:\Program Files\Autodesk\Maya2018\bin\Render.exe" -r arnold -s 1 -e 100 -rl RENDER_LAYER K:\YOUR_PROJECT\YOUR_FILE.ma
 
"C:\Program Files\Autodesk\Maya2018\bin\Render.exe" -r arnold -s 1 -e 100 -rl RENDER_LAYER K:\YOUR_PROJECT\YOUR_FILE.ma
 
pause()
 
pause()
 +
 +
</pre>
 +
 +
=== Arnold - Windows - Batch render for student version ===
 +
<pre>
 +
// HOW TO - RENDER A LIST OF SHOTS WITHOUT ARNOLD BATCH RENDER LICENSE
 +
 +
// 1ST STEP
 +
// First, create a .bat which will look like this:
 +
// Replace path to maya.exe with your own path, and with paths to your .mel files - How many lines as you want to render shots/scenes.
 +
 +
 +
 +
 +
"C:\Program Files\Autodesk\Maya2018\bin\maya.exe" -script C:\YOUR_PATH\shot1.mel
 +
 +
"C:\Program Files\Autodesk\Maya2018\bin\maya.exe" -script C:\YOUR_PATH\shot2.mel
 +
 +
popd
 +
 +
pause
 +
 +
 +
 +
 +
// 2ND STEP
 +
// CREATE A .mel FILE FOR EACH SHOT/SCENE AS FOLLOWING
 +
 +
 +
 +
 +
////////
 +
//// PATH TO FILE YOU WANT TO RENDER
 +
////////
 +
 +
file -f -o "C:\YOUR_PATH\your_scene_001.mb";
 +
 +
////////
 +
//// NOTHING TO CHANGE HERE
 +
////////
 +
 +
// RENDER ALL ENABLED LAYERS AND RENDER ALL ENABLED CAMERAS
 +
renderSequenceOptionsWindow;
 +
optionVar -intValue "renderSequenceAllLayers" 1;
 +
optionMenuGrp -edit -enable false renderSequenceCameraList; optionVar -intValue "renderSequenceAllCameras" 1;
 +
 +
// REFRESH MAYA UI TO ALLOW SEQUENCE RENDER
 +
// THANKS TO RODOLPHE VAILLANT http://rodolphe-vaillant.fr
 +
global proc mel_process_idle_events()
 +
{
 +
    // '$list' contains all the current events/commands in the idle queue
 +
    string $list[] = `evalDeferred -list`;
 +
    // The timer is here for safety
 +
    // you could use a counter or the mel command 'progressWindow'
 +
    timer -startTimer;
 +
    while( (size($list) > 0) )
 +
    {
 +
        // Idle events might spawn more idle events so we need to
 +
        // loop until the list is empty
 +
        python("maya.utils.processIdleEvents()");
 +
        $list = `evalDeferred -list`;
 +
        // Stop processing idle events after 15 seconds
 +
        if( `timer -lap` > 15)
 +
            break;
 +
    }
 +
    timer -endTimer;
 +
}
 +
// display the "Tool settings" pannel:
 +
toolPropertyWindow -inMainWindow true;
 +
updateMainWindowComponentState();
 +
// Wait for UI to refresh:
 +
mel_process_idle_events();
 +
// safely access UI elements:
 +
button -visible false "someButtonInTheToolSettingsWindow";
 +
 +
////////
 +
//// CUSTOM PARAMETERS
 +
////////
 +
 +
// SET START FRAME
 +
setAttr "defaultRenderGlobals.startFrame" 1;
 +
 +
// SET END FRAME
 +
setAttr "defaultRenderGlobals.endFrame" 100;
 +
 +
// DISABLE ALL RENDER LAYERS
 +
$selected=`ls -type "renderLayer"`;
 +
for ($object in $selected){
 +
    renderLayerEditorRenderable RenderLayerTab $object "0";
 +
}
 +
 +
// SET RENDER LAYER TO RENDER
 +
renderLayerEditorRenderable RenderLayerTab defaultRenderLayer "1";
 +
 +
////////
 +
//// GENERAL RENDER SETTINGS
 +
////////
 +
 +
// SET IMAGE FILE PREFIX
 +
setAttr -type "string" defaultRenderGlobals.imageFilePrefix "<Scene>/<RenderLayer>/<Scene>_<RenderLayer>_<Camera>";
 +
 +
// SET IMAGE FORMAT TO EXR
 +
setAttr -type "string" defaultArnoldDriver.ai_translator "exr";
 +
 +
// SET MERGE AOVS ON
 +
setAttr "defaultArnoldDriver.mergeAOVs" 1;
 +
 +
// SET FRAME EXTENSION WITH FRAME PADDING FOR ANIMATION
 +
setMayaSoftwareFrameExt("3", 0);
 +
 +
// SET RESOLUTION
 +
editRenderLayerGlobals -currentRenderLayer defaultRenderLayer;
 +
setAttr defaultResolution.width 1920;
 +
setAttr defaultResolution.height 1080;
 +
 +
$width = `getAttr defaultResolution.width`;
 +
$height = `getAttr defaultResolution.height`;
 +
$deviceAspect = (float($width)/float($height));
 +
setAttr defaultResolution.deviceAspectRatio $deviceAspect;
 +
 +
////////
 +
//// NOTHING TO CHANGE HERE
 +
////////
 +
 +
// RENDER
 +
RenderSequence;
 +
//print"RENDER_FINISHED";
 +
 +
// SAVE
 +
//file -f -save;
 +
 +
// QUIT MAYA
 +
evalDeferred("quit -f");
  
 
</pre>
 
</pre>

Revision as of 21:35, 3 May 2021

Maya .bat Batch Render Scripts

Redshift Batch Render - Windows

"C:\Program Files\Autodesk\Maya2018\bin\Render.exe" -r redshift -s 1 -e 100 -rl RENDER_LAYER K:\YOUR_PROJECT\YOUR_FILE.ma
pause()

Maxwell Batch Render - Windows

"C:\Program Files\Autodesk\Maya2018\bin\Render.exe" -r maxwell -s 1 -e 100 -l RENDER_LAYER K:\YOUR_PROJECT\YOUR_FILE.ma
pause()

Arnold Batch Render - Windows

// For Legacy render layers

"C:\Program Files\Autodesk\Maya2018\bin\Render.exe" -r arnold -s 1 -e 100 -l RENDER_LAYER K:\YOUR_PROJECT\YOUR_FILE.ma
pause()

// For Render setup layers

"C:\Program Files\Autodesk\Maya2018\bin\Render.exe" -r arnold -s 1 -e 100 -rl RENDER_LAYER K:\YOUR_PROJECT\YOUR_FILE.ma
pause()

Arnold - Windows - Batch render for student version

// HOW TO - RENDER A LIST OF SHOTS WITHOUT ARNOLD BATCH RENDER LICENSE

// 1ST STEP
// First, create a .bat which will look like this:
// Replace path to maya.exe with your own path, and with paths to your .mel files - How many lines as you want to render shots/scenes.




"C:\Program Files\Autodesk\Maya2018\bin\maya.exe" -script C:\YOUR_PATH\shot1.mel

"C:\Program Files\Autodesk\Maya2018\bin\maya.exe" -script C:\YOUR_PATH\shot2.mel

popd

pause




// 2ND STEP
// CREATE A .mel FILE FOR EACH SHOT/SCENE AS FOLLOWING




////////
//// PATH TO FILE YOU WANT TO RENDER
////////

file -f -o "C:\YOUR_PATH\your_scene_001.mb";

////////
//// NOTHING TO CHANGE HERE
////////

// RENDER ALL ENABLED LAYERS AND RENDER ALL ENABLED CAMERAS
renderSequenceOptionsWindow;
optionVar -intValue "renderSequenceAllLayers" 1;
optionMenuGrp -edit -enable false renderSequenceCameraList; optionVar -intValue "renderSequenceAllCameras" 1;

// REFRESH MAYA UI TO ALLOW SEQUENCE RENDER
// THANKS TO RODOLPHE VAILLANT http://rodolphe-vaillant.fr
global proc mel_process_idle_events()
{
    // '$list' contains all the current events/commands in the idle queue
    string $list[] = `evalDeferred -list`;
    // The timer is here for safety
    // you could use a counter or the mel command 'progressWindow'
    timer -startTimer;
    while( (size($list) > 0) )
    {
        // Idle events might spawn more idle events so we need to
        // loop until the list is empty
        python("maya.utils.processIdleEvents()");
        $list = `evalDeferred -list`;
        // Stop processing idle events after 15 seconds
        if( `timer -lap` > 15)
            break;
    }
    timer -endTimer;
}
// display the "Tool settings" pannel:
toolPropertyWindow -inMainWindow true;
updateMainWindowComponentState();
// Wait for UI to refresh:
mel_process_idle_events();
// safely access UI elements:
button -visible false "someButtonInTheToolSettingsWindow";

////////
//// CUSTOM PARAMETERS
////////

// SET START FRAME
setAttr "defaultRenderGlobals.startFrame" 1;

// SET END FRAME
setAttr "defaultRenderGlobals.endFrame" 100;

// DISABLE ALL RENDER LAYERS
$selected=`ls -type "renderLayer"`;
for ($object in $selected){
    renderLayerEditorRenderable RenderLayerTab $object "0";
}

// SET RENDER LAYER TO RENDER
renderLayerEditorRenderable RenderLayerTab defaultRenderLayer "1";

////////
//// GENERAL RENDER SETTINGS
////////

// SET IMAGE FILE PREFIX
setAttr -type "string" defaultRenderGlobals.imageFilePrefix "<Scene>/<RenderLayer>/<Scene>_<RenderLayer>_<Camera>";

// SET IMAGE FORMAT TO EXR
setAttr -type "string" defaultArnoldDriver.ai_translator "exr";

// SET MERGE AOVS ON
setAttr "defaultArnoldDriver.mergeAOVs" 1;

// SET FRAME EXTENSION WITH FRAME PADDING FOR ANIMATION
setMayaSoftwareFrameExt("3", 0);

// SET RESOLUTION
editRenderLayerGlobals -currentRenderLayer defaultRenderLayer;
setAttr defaultResolution.width 1920;
setAttr defaultResolution.height 1080;

$width = `getAttr defaultResolution.width`;
$height = `getAttr defaultResolution.height`;
$deviceAspect = (float($width)/float($height));
setAttr defaultResolution.deviceAspectRatio $deviceAspect;

////////
//// NOTHING TO CHANGE HERE
////////

// RENDER
RenderSequence;
//print"RENDER_FINISHED";

// SAVE
//file -f -save;

// QUIT MAYA
evalDeferred("quit -f");