Notifications
Clear all

[Closed] Controlling renders thru batch files

So I’ve got a scene in max that I need to render, but max crashes every 5-15 frames, so I have to babysit max (reload max, reload scene, update frame # to render, render) until the rendering is complete. Babysitting max is not something I’d like to do, I’d prefer to have a batch file doing this.

I can do this with a batch file:

3dsmax.exe somefile.max -U MAXScript somescript.ms

…which gets me half of the way there (as I can check for files and control the renderer thru maxscript), but I’m missing how to check and see if 3dsmax.exe is running (as it could crash any moment with this particular scene).

So, the order of events I’d like is this:

  1. I begin the batch file (the batch file only renders one .max file)
  2. The batch file checks to see if max is running
    -if true, it waits for max to finish the frame (the frame rendering times are always less than a few minutes, so if max freezes (doesn’t crash), the batch file can kill max and start the frames again).
    -if false, the batch file launches 3dsmax.exe with a particular .ms file.
  3. Loop back to 2 unless successful completion of rendering (this could be as simple as maxscript writing a text file that the batch file checks).

So, how can I check to see if 3dsmax.exe is running (from inside a windows batch file)?

Here’s some made up code that illustrates what I’d like to do:

while textFile.contents == false
   if os.process.3dsmax.exe == true then (wait) else (launch max w/ maxscript)
11 Replies
1 Reply
 lo1
(@lo1)
Joined: 1 year ago

Posts: 0

Why not just render the scene with backburner?

Thanks stigatle, that does help.

Here is a batch file that checks to see if 3dsmax.exe is running, and if it isn’t, launches 3dsmax 2012, passes a .max file to open, and passes a .ms file to run, after the scene has been loaded:


  tasklist /FI "IMAGENAME eq 3dsmax.exe" /FO CSV > search.log
  FOR /F %%A IN (search.log) DO IF %%~zA EQU 0 GOTO end
  "C:\Program Files\Autodesk\3ds Max 2012\3dsmax.exe" "C:	est	est.max" -U MAXScript "C:	est	est.ms"
  :end
  del search.log
  

I don’t know how to click the ‘Adopt the files gamma and lut settings?’ ok button, so the batch isn’t totally automated. How would I programmatically click the ‘ok’ button?**

**This is not the way to do it. It’s better to load max without a scene, pass a maxscript to 3dsmax, and have the maxscript load the scene, at which point the prompts buttons can be pressed by maxscript.

Do you use alot of MR proxies? Rendering X frames before crash is usually a memory leak.

Why not just render the scene with backburner?

Node won’t restart automatically after crash. Backburner is great though.

Do you use alot of MR proxies?  Rendering X frames before crash is usually a memory leak.

No MR proxies. I’ve narrowed the error down to the raycast acceleration phase of vray, where 3dsmax.exe either instantly closes or vray throws an ‘unhandled exception’ where vray couldn’t allocate enough memory.

The error is related to the number of motion blur geometry samples – if I turn the samples down to 2 it renders 75% of the time – but I’ve got radial motion blur happening on a propeller, so I need around 10 samples. I’ve had to split the rendering into two passes, the propeller and the plane, but the plane is the file that crashes max. So, I’m trying to force max to render the plane pass one frame at a time. I’ve already resized 4k maps to 2k and done some subdivision reversion, but I think I just need more memory for this particular scene.

2 Replies
 lo1
(@lo1)
Joined: 1 year ago

Posts: 0

Actually, by default it will attempt to restart the server 3 times, though this can be modified from the manager settings dialog.

 lo1
(@lo1)
Joined: 1 year ago

Posts: 0

You can set 2 samples for the entire scene and 10 samples for the propeller only.

lo, you’re right – back burner will attempt to restart the server, if max crashes. but, if max crashes and a dialog pops up requiring user interaction – the server just sits there, waiting for user interaction. such is the case with a vray unhandled exception:

i was hoping to allow for such a case by setting a maximum time limit to let the 3dsmax process run for. if every frame is predictably well below 5 minutes, then the batch file can kill 3dsmax.exe if it’s running time exceeds 5 minutes. but that is not the most elegant solution.

You can set 2 samples for the entire scene and 10 samples for the propeller only.

The compositor I’m working with actually prefers the propeller as it’s own pass, so he can adjust the alpha levels for a proper fit in the shot. It just so happened to also help solve my rendering problem (kinda). And I doubt I could fit both into memory, if I’m having trouble fitting just the plane.

Here’s what the shot looks like so far (we’re going for an archival ww2 style):

^ There’s supposed to be about 20 planes in that shot. Better get this batch file working!

 lo1

perhaps this can be solved by adding this startup script to your render nodes:

if (IsNetServer()) do setVRaySilentMode()

Why would you motionblur that propeller in the first place? just make an animated texture of a motionblurred prop and put that on a disc shaped object… rotate those very slowly to get some variations across the different airplanes.

lo, that startup script is awesome! I did not know that vray had a silent node. More than likely, if silent mode suppresses popups, this will allow me to render the scene with backburner.

Why would you motionblur that propeller in the first place?

Well, to be as accurate as possible. I found the rpms of the corsair engine and did some maths to arrive at a rotation speed of approximately 5800 degrees per second. Then we began testing different kinds of motion blur (1/30th, 1/60th, etc…) to achieve the propeller ‘look’. Your advice is good – I think I’ll make the propellers a texture, then rotate the texture to get the moblur. Then I don’t have a need for the propeller geometry in the scene.

Thanks guys!