Progressive render for Animations
This script renders all the MXS files located in the input folder but instead of rendering them sequentially until each one reaches the final SL, it renders them incrementally. First it renders all the frames up to SL 4, producing a low SL version of the whole animation that you can use for starting post-production tasks, and then continues refining the whole animation to SL 6, 8, 10,... in steps of 2 Sampling Levels, until the indicated final SL.
It is useful for quickly previewing animations, and for overlapping the rendering process with the postproduction process, saving a huge amount of time in animation projects.
Example
// This script renders all the MXS files located in the input folder but instead of rendering them sequentially until each one reaches the final SL, it renders them incrementally. First it renders all the frames up to SL 4, producing a low SL version of the whole animation that you can use for starting post-production tasks, and then continues refining the whole animation to SL 6, 8, 10,... in steps of 2 Sampling Levels, until the indicated final SL. // It is useful for quickly previewing animations, and for overlapping the rendering process with the postproduction process, saving a huge amount of time in animation projects. var inputFolder = "C:\input"; var outputFolder = "C:\output"; var mxsCount = FileManager.getNumberOfFilesInFolder( inputFolder, "*.mxs" ); var mxsList = FileManager.getFilesInFolder( inputFolder, "*.mxs" ); RenderEvents["renderFinished()"].connect(renderHasFinished); var initialSL = 4; var finalSL = 12; var slStep = 2; var currentSL = initialSL; var i = 0; var isRendering = 0; while( currentSL <= finalSL ) { for( i = 0; i < mxsCount; i++ ) { renderScene(); while( 1 ) { if( isRendering == 0 ) { break; } } } currentSL += slStep; } ////////////////////////////////////////////////////////////////// function renderScene() { var mxsFile = mxsList[i]; var imagePath = outputFolder + "\" + FileManager.getFileName( mxsFile ) + ".png"; var mxiPath = outputFolder + "\" + FileManager.getFileName( mxsFile ) + ".mxi"; Maxwell.print( "rendering Mxs file: " + mxsFile ); Maxwell.openMxs( mxsFile ); Scene.setImagePath( imagePath ); Scene.setMxiPath( mxiPath ); Scene.setSamplingLevel( currentSL ); Scene.setResX( 400 ); Scene.setResY( 400 ); Scene.setResumeRenderEnabled( true ); isRendering = 1; Maxwell.startRender(); } ////////////////////////////////////////////////////////////////// function renderHasFinished() { isRendering = 0; Maxwell.print( "Render finished!!" ); } //////////////////////////////////////////////////////////////////
Â
Â