Thanks for posting this; i'd seen it earlier in the thread but I wasn't too sure about how to implement it for a batch render with scene states. In my situation, I wanted to render a sequence, using multiple saved scene states, from an orthographic camera - this bug was prohibiting me from doing this using the built in batch render tool.
Instead, chatGPT and I worked out a solution to replace the batch renderer (at least for that purpose) using the following maxScript. I'm posting this in case anyone else finds themselves in the same situation (or I forget what I did and stumble on this thread again in a few years...)
-- === NOTES ===
--This script assumes Arnold is set as your default render engine, and that your current active view is set to an orthographic camera.
-- === USER CONFIGURATION ===
--Enter the saved scene states to be rendered:
sceneStates = #(
"SceneState1",
"SceneState2",
"etc..."
)
cameraName = "OrthographicCamera" --change this to your orthographic camera's name
outputRoot = @"C:\Data\renderOutput" -- Change this path to wherever you want the exported images to be saved
startFrame = 0 -- change to your first frame number
endFrame = 99 -- change to your last frame number
-- === SCRIPT START ===
theCam = getNodeByName cameraName
if theCam == undefined then (
messageBox ("Camera named \"" + cameraName + "\" not found.") title:"Error"
) else (
for stateName in sceneStates do (
format "\n? Restoring Scene State: %\n" stateName
-- Restore the full scene state (View, Environment, Render Settings, Lights, etc.)
if sceneStateMgr.Restore stateName #{1..8} then (
format "? Restored: %\n" stateName
) else (
format "? Failed to restore scene state: %\n" stateName
continue
)
-- Set the active viewport to use the camera (viewport_camera workaround for Arnold)
try (
viewport.SetCamera theCam
format "?? Viewport set to: %\n" cameraName
) catch (
format "? Failed to set viewport to camera: %\n" cameraName
continue
)
-- Ensure Arnold is the production renderer
try (
--renderers.production = Arnold_Renderer() -- this line commented out because it was causing an error and is not needed
format "?? Arnold renderer set as production renderer.\n"
) catch (
format "? Arnold renderer not available. Skipping render for %\n" stateName
continue
)
-- Render frames
for f = startFrame to endFrame do (
sliderTime = f
frameNumStr = formattedPrint f format:"02d"
outputPath = outputRoot + "\\" + stateName + "_f" + frameNumStr + ".tif"
format "?? Rendering frame % for % ? %\n" f stateName outputPath
render frame:f vfb:false outputfile:outputPath
)
)
format "\n? All renders complete.\n"
)