MaxScript usage with Octane 3dsMax

3D Studio Max Plugin (Export Script Plugins developed by [gk] and KilaD; Integrated Plugin developed by Karba)
Forum rules
Please post only in English in this subforum. For alternate language discussion please go here http://render.otoy.com/forum/viewforum.php?f=18
neonZorglub
OctaneRender Team
Posts: 1002
Joined: Sun Jul 31, 2016 10:08 pm

Render output - setting main filename and render element filenames

The main output filename (editable in Render settings / Common tab) can be read by
mainOutFilename = rendOutputFilename -- current output filename, as set in the 'Common' tab of render settings [eg "C:\temp\outTst3\mySceneCC.png"]

it can be set by assigning the same 3dsMax global variable rendOutputFilename :
rendOutputFilename = "C:\\temp\\outTst3\\mySceneDD.png"
or
rendOutputFilename = "C:/temp/outTst3/mySceneDD.png"
(Note that the Render settings dialog should be closed when setting this variable. ref: https://help.autodesk.com/view/3DSMAX/2 ... 6ECCDD6D20)
(rendTimeType, rendOutputFilename and rendSaveFile are 3ds Max variables)

Render Elements
For the render elements, by default, each render element filename is set automatically by 3dsmax to be in the same folder as the main render output filename, with a prefix using the element name.
For example, when adding a Diffuse render element when the current name output is "C:\temp\outTst3\mySceneCC.png", the element filename is set to "C:\temp\outTst3\mySceneCC_Diffuse.png"


Octane has some options to set those render element filenames differently, in the 'Passes Output' rollout of the Kernel tab.
See the 'Overwrite default Render Element folder' and 'Overwrite root path' check boxes, and the related options.
Those options are accessible with maxscript the same way as the other render settings variables (reminder : use showproperties renderers.current for full list)

.renderOutput_enable_MultiLayerEXR : boolean
.renderOutput_enable_stdRgbOut : boolean
.renderOutput_singleEXR_AsOctane : boolean
.renderOutput_exrCompression : integer
.renderOutput_exrDWACompressionLevel : float
.renderOutput_exrUseTonemap : boolean
.renderOutput_exrUseFloat16 : boolean
.renderOutput_exrFileType : integer
.renderOutput_ColorSpace : string
.renderOutput_OCIOLook : string
.renderOutput_ForceToneMap : boolean

.outputFolders_enableOverwrite : boolean
.outputFolders_overwriteBasePath : boolean
.outputFolders_basePath : string
.outputFolders_useCommonSubFolder : boolean
.outputFolders_CommonSubFolder : string
.outputFolders_usePassSubFolder : boolean
.outputFolders_removeBaseName : boolean
.outputFolders_removePassName : boolean
.renderOutput_OctDigitCount : integer


for example:
rd = renderers.current
rd.outputFolders_enableOverwrite = true
rd.outputFolders_usePassSubFolder = true
will save each render element in its own folder (eg "C:\temp\outTst3\Diffuse\mySceneCC_Diffuse.png")

If those options are not enough for a particular purpose, those element filenames can be set / accessed as follow:

re = maxOps.GetCurRenderElementMgr()
elemCount = re.numrenderelements() -- get number of render elements

--- manually set all render element filenames:

mainOutFilename = rendOutputFilename -- current output filename, as set in the 'Common' tab of render settings
mainOutShortname = filenameFromPath mainOutFilename --eg "mySceneCC.png" cf 'File Name Parsing' : https://help.autodesk.com/view/MAXDEV/2 ... 00E0B9D604
mainOutBasename = getFilenameFile mainOutFilename --eg "mySceneCC"
mainOutPath = getFilenamePath mainOutFilename -- eg "C:\temp\outTst3\"
for n = 0 to (elemCount - 1) do
(
el = re.getrenderelement n -- access one of the render element
elemName = el.elementname -- eg "Diffuse"
relem_filename = mainOutPath + mainOutBasename + "_ELEM_" + elemName + ".png" -- re-create a full path and filename. eg "C:\temp\outTst3\mySceneCC_ELEM_Diffuse.png"

re.SetRenderElementFilename n relem_filename -- change the render element filename
}
tombyrom
Licensed Customer
Posts: 58
Joined: Fri Dec 15, 2023 9:26 am

Hello neonZorglub
How would I get the current render camera in production renders?

rendGetCamera() always returns undefined even when a proper camera is in use. I need something that works across frames

Thanks
neonZorglub
OctaneRender Team
Posts: 1002
Joined: Sun Jul 31, 2016 10:08 pm

tombyrom wrote: Sat May 10, 2025 10:50 pm Hello neonZorglub
How would I get the current render camera in production renders?

rendGetCamera() always returns undefined even when a proper camera is in use. I need something that works across frames

Thanks
Hi tombyrom,
As Octane uses the current viewport camera for rendering (in production mode and Octane viewport mode), you can get the camera like that:
cam = viewport.getCamera()

ref:
https://forums.autodesk.com/t5/3ds-max- ... p/12957832
https://help.autodesk.com/view/MAXDEV/2 ... 83619E89DE

Also, to list the octane camera properties of the render settings (used when a non Octane camera is selected for rendering) :
showproperties renderers.current "viewcam*"
tombyrom
Licensed Customer
Posts: 58
Joined: Fri Dec 15, 2023 9:26 am

neonZorglub wrote: Tue May 13, 2025 11:05 pm
As Octane uses the current viewport camera for rendering (in production mode and Octane viewport mode), you can get the camera like that:
cam = viewport.getCamera()
Thanks neonZorglub, I was already using viewport.getCamera() to get camera XY position but for some reason in my preRenderCallback it did not seem to update on subsequent frames, which led me down the path of finding another way to get it dynamically. However, out of nowhere viewport.getCamera() is now working in the preRenderCallback across frames, perhaps another change I made...

Thanks for your reply!
Post Reply

Return to “Autodesk 3Ds Max”