ScriptSpot

Forum topic · General Scripting

max quick render VS render()

By br0t · 2011-06-28

Description

Heya,
I am trying to batch render some max files using the camera inside the file, if there is one. Thats why I use

render camera:theCam outputFile:outFile

to start the rendering (if previously a camera has been found) and

 rendOutputFileName = outFile; max quick render

if no camera has been found.
"outFile" is a pathname like this:

"C:/Users/br0t/Desktop/test.jpg"

Both render an image, which looks correct in the Frame Buffer, but the first method will save a plain black image. max quick render works correctly, but I dont know how to set a camera as the active viewport. Any ideas why render() fails?

Cheers

Comments (4)

Its a Vray Frame buffer problem.

JokerMartini · 2011-06-29

To stop from getting a black image all you have to do is turn on the split channels checkbox in the vray frame buffer section. I just finished writing a script that does exactly what you mentioned above. If you need some more information on it let me know and I can show you the code.

br0t · 2011-06-29

gimme da code :D

hi br0t

Anubis · 2011-06-28

No visible reason, render() with camera argument works fine. You can try also render to:bitmap but here is as well a snippet code to set a camera to the active viewport.

theCam = cameras[1]
if isValidNode theCam and \
getActiveCamera() != theCam do (
	if viewport.CanSetToViewport theCam do
		viewport.setCamera theCam
)
if getActiveCamera() == undefined then (
	rendOutputFileName = outFile
	rendSaveFile = on
	max quick render
)
else (
	render camera:theCam outputFile:outFile
)

p.s. - if you render to bitmap...

bm = bitmap renderWidth renderHeight fileName:outFile
render camera:theCam to:bm
save bm ; free bm

br0t · 2011-06-28

thanks Anubis, that is helpful!

I think my black image is a Vray problem, or more a problem with the vray frame buffer. If I turn it off, everything renders fine. Unfortunately I cannot do that by script, so I am now loading a renderpreset each time, that thas the vfb disabled.

Cheers