View Full Version : 3dsmaxcmd.exe -preRenderScript

02 February 2009, 08:24 PM
I've just read a thread on "the area" from a desperate guy that doesn't manage to make this switch work, and so do I. Please someone tell me that it actually works or I commit suicide.


02 February 2009, 12:39 AM
well, don't commit suicide just yet... but keep in mind there's some things you can and some things you can't do in a preRender script.

I'd tell you there's a list somewhere that tells you what those things are, but I can't say I know of any.

This, however, is a simple test to show that a preRender script does, in fact, get loaded and executed.

You'll have to replace the paths with the appropriate paths on your machine.

Source of

f = createFile "c:\\3dsmax2009_scenes\\temp.txt"
format "Hello World" to:f
close f
convertToMesh (text())

Command line:

c:\3dsmax11\3dsmaxcmd.exe -outputName:"c:\3dsMax2009_scenes
\result.png"-preRenderScript:"c:\3dsmax2009_scenes\" "c:\3dsmax

'c:\3dsmax2009_scenes\temp.txt' file created, content is 'Hello World'
result.png is written out, content is blank (i.e. the text() shape isn't rendered)

So some bits work, some bits don't.

02 February 2009, 08:22 AM
ok, so it's "half-working"... reminds me of many other things in max... I'm gonna push the investigation a bit further but I really hope that doesn't exclude systematically all operations IN the scene (I would bet that the script is actually executed, but AFTER the rendering :) )... for the moment I only tried a few things to prepare another script...
Actually I'm currently using VRay, and trying to automate many tasks... In those tasks, one consist to automatically assign sphere gizmos to VRaySphereFade (an Atmospheric effect) an send it to the render farm.
First problem: VRaySphereFade gizmo list is not resizable by script... ouch... I've no choice to create one with a hundred gizmos selected by hand and then delete them, to create <deleted> slots...
Second problem: Max is not capable of recording the list of objects included in a atmospheric effect in a renderpreset with environment checked...(may be normal if you think about it, but still it's annoying)
So hey! solution!, I create a preRenderScript to do that! a script that would assign gizmos to VRaysphereFade just before the rendering... so that's what I'm gonna try to do this morning but I guess I'm gonna be disappointed...

thanks anyway! that's useful informations... I owe you life :)


02 February 2009, 10:12 AM
ok, you know what? it works. I really can't explain why for now, but I tried something like:

VRSF = getAtmospheric 1 --VRaySphereFade atmospheric effect (already created with empty slots)
for i = 1 to helpers.count do (
VRSF.gizmos[i] = helpers[i]

and it actually does the thing!

I tried this just before:

saveMaxFile "C:\\temp.max"

and as it didn't work I thought that it wasn't even executing the script after the rendering, so I almost abandoned the thing.
So there are indeed script commands that are executed and other that are not with 3dsmaxcmd...

So thanks again, you gave me faith :)

CGTalk Moderation
02 February 2009, 10:12 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.