Maya batch render

udithah_backup2023
Observer

Maya batch render

udithah_backup2023
Observer
Observer

Hi there, I have several fbx/objs, that I want to render and create a preview for.
I'm using Maya 2025.
I am trying to write a script to test out cmd line rendering, however I keep getting an error message

as a test, i created the following mel file

'

// Define input FBX and output render paths
string $inputFile = "H:\\3D Models\\Aeroplanes\\AH-64D.fbx"; 
string $outputImage = "H:\\3D Models\\Aeroplanes\\AH-64D_preview.png"; 

// Import the FBX file
try
{
    file -import -type fbx $inputFile; 
    print ("File Imported: " + $inputFile + "\n");

    // Set up the render output file
    int $renderWidth = 1920; 
    int $renderHeight = 1080; 

    // Set render settings (adjust as needed)
    setAttr defaultRenderGlobals.imageFormat 1; // PNG format
    setAttr defaultResolution.width $renderWidth;
    setAttr defaultResolution.height $renderHeight;
    setAttr defaultRenderGlobals.imageFilePrefix $outputImage; 

    // Render the scene
    render -r; 
    print ("Rendering complete. Output saved to: " + $outputImage + "\n"); 
}
catch
{
    print ("Failed to render file: " + $inputFile + "\n");
}'


and then I try to run it with the following command prompt

"D:\Program Files\Autodesk\Maya2025\bin\mayabatch.exe" -file "H:\3D Models\Aeroplanes\import_and_render.mel"
Access is denied.

I get a windows popup error saying This app cant run in your pc.

can anyone provide any suggestions on how to fix this?

Also I want to update the script to go thru multiple folders/sub folders and find any fbx,obj, maya files and render them.
I have about 1000+ folders with sub/sub folders

0 Likes
Reply
196 Views
0 Replies
Replies (0)