Controlling the Renderer

The render() function invokes the 3ds Max renderer.

Notes:

The render() function can be called re-entrantly within scripted render effect, scripted atmospheric or scripted material. In releases prior 3ds Max 4, attempting to do this caused a runtime error saying that the renderer could not be called while a render was already under way.

render() can take many optional parameters to control the rendering:

render

[ camera: <camera_node> ]

Defaults to active viewport.

[ frame: <number> | #current ]

Defaults to #current.

[ framerange: <interval> | #active ]

[ fromframe: <time> ]

[ toframe: <time> ]

[ nthframe: <time> ]

Defaults to unsupplied, and the frame value controls which frames to render.

Since 3ds Max 5, the parameters frame, fromframe and toframe have been changed to accept time values instead of numbers. Setting them to float values will allow for sub-frame rendering!

[ outputwidth: <number> ]

Defaults to current render width.

[ outputheight: <number> ]

Defaults to current render height.

[ outputSize: <point2> ]

An alternative way to specify the output size of the rendered image. The point2 value is in the form: [width,height]

[ pixelaspect: <number> ]

Defaults to 1.0.

[ renderhiddenobjects: <boolean> ]

Defaults to current renderer Render Hidden Objects state.

[ rendSimplifyAreaLights: <boolean> ]

Lets the renderer simplify area lights by rendering them as point lights when appropriate.

[ superblack: <boolean> ]

Defaults to current renderer Superblack state.

[ force2sided: <boolean> ]

Defaults to current renderer Force 2 Sided state.

[ renderatmosphericeffects: <boolean> ]

Defaults to current renderer Render Atmospheric Effects state.

[ renderfields: <boolean> ]

Defaults to current renderer Render Fields state.

[ fieldorder: #odd | #even ]

Defaults to current renderer preferences Field Order state.

[ outputfile: <string> ]

The frame number is appended to the filename if the file image type is a single image type (.bmp, .jpg, .tga, etc.), and a frame range is being rendered. Defaults to rendering to just the virtual frame buffer.

[ vfb: <boolean> ]

When set to true, opens a Rendered Frame Window to display the rendered image. When set to false, the rendered image will not be displayed.

Defaults to current renderer Rendered Frame Window state.

Note

In versions prior 3ds Max 6, the "Rendered Frame Window" was known as the "Virtual Frame Buffer" (abbreviated as VFB).

[ outputHDRbitmap:<boolean> ]

new.gif When set to true, the new 32 bit floating-point frame buffer will be used. When set to false or not supplied, the standard frame buffer will be used. Available in 3ds Max 8 and higher.

[ netrender: <boolean> ]

Submits the render to Backburner for network rendering.

Defaults to current renderer Net Render state.

[ renderType: #normal | #region | #regionCrop | #blowup | #selection | #regionselected | #cropselected ]

[ region: #(left,top,right,bottom) ]

Provides control over the type of rendering, corresponding to the Render Type menu in the 3ds Max toolbar. If #region, #regionCrop or #blowUp is selected, the region: parameter may be used to override the currently set regions for the active viewport, specified as pixel coordinates relative to the top-left corner in the bitmap (VFB). The region argument is ignored for all other render types. The region argument can be a Box2 value.

If the rendertype is #blowup, and a region is specified, region rectangle must have the same aspect as the render output size aspect. The top, bottom, and left component values are taken from the region argument, but the width is re-calculated to force the proper aspect.

Note

that #region, #regionCrop and #blowUp can only be selected for an active viewport rendering. An error will be reported if they are specified for a camera rendering. Defaults to #normal.

Here is a full list of the supported types, their aliases and the UI types they correspond to:

#view, #normal - correspond to View
#selection, #selected - correspond to Selected
#region - corresponds to Region
#regionCrop, #crop - correspond to Crop
#blowUp - corresponds to Blowup
#regionselected - corresponds to Region Selected
#cropselected - corresponds to Crop Selected

Note:

Render type #boxselected, which corresponds to Box Selected, is currently not supported.

[ to: <bitmap> ]

Specifies an existing bitmap to render into. The render() function takes image size and other parameter settings from the existing bitmap. If not supplied, a new bitmap is created and returned by the render() function.

[ channels: <array_of_channel_names> ]

Specifies which g-buffer channels should be created during the rendering.

For example:

bm = render camera:$cam2 channels:#(#zDepth, #coverage, #objectID)

causes $cam2 to be rendered into a new bitmap that will contain z-depth, pixel coverage and object g-buffer ID channels. The channels: argument must always be an array of channels identifiers, chosen from the following:

#zDepth

#matID

#objectID

#UVCoords

#normal

#unClamped

#coverage

#node

#mask

#shaderColor

#shaderTransparency

#velocity

#weight

Defaults to no g-buffer channels.

[ aperture: <float> ]

Defaults to current renderer Aperture Width value.

[ ditherTrueColor: <boolean> ]

Defaults to current rendering preferences Dither True Color state.

[ ditherPaletted: <boolean> ]

Defaults to current rendering preferences Dither Paletted state.

[ videocolorcheck: <boolean> ]

Defaults to current renderer Video Color Check state.

[ renderPAL: <boolean> ]

Defaults to current rendering preferences Video Color Check NTSC/PAL state. If true, and video color checking is enabled, PAL video color checking is performed.

[ superBlackThreshold: <integer> ]

Defaults to current rendering preferences Super Black Threshold value.

[ maxPixelSize: <float> ]

This property is available in the Render Scene dialog and is also accessible through the RadiosityPreferences interface.

[ useRadiosity: <boolean> ]

This property is available in the Render Scene dialog and is also accessible through the RadiosityPreferences interface.

[ ComputeRadiosity: <boolean> ]

This property is available in the Render Scene dialog and is also accessible through the RadiosityPreferences interface.

[ cancelled: <&var> ]

If the render is cancelled, the variable var will contain true, otherwise it will contain false.

For example:

bm = render cancelled:&wasCancelled

if (not wasCancelled) do ....

 

[ progressbar: <boolean> ]

If true, the entire viewport display is disabled and a progress bar and Cancel button are displayed in the status panel. If false or not present, the viewport display is not disabled. In both cases, Esc will cancel the render.

 

[ renderMultiPassEffects:<boolean> ]

If true or not specified, if the view being rendered is a camera view, and a multipass effect is enabled for that camera, the rendering will be performed using that multipass effect. If explicitly supplied as false, no multipass effect will be rendered. Available in 3ds Max 8 and higher.

[ renderElements:<boolean> ]

If true or not specified, if render elements are present in the scene, those render elements will be rendered. If the outputfile: argument is specified, the render element output will be written to disk in the same manner as if rendered from the Render Scene dialog with the Render Output filename specified. If false, render elements will not be rendered. Available in 3ds Max 8 and higher.

[ renderElementBitmaps:<&var> ]

If render elements are rendered, the render element output bitmaps are placed in an array (one array element per rendered render element), and this array is returned through the specified variable by-reference. If multiple frames are rendered, the final frame's output is used. Available in 3ds Max 8 and higher.

For Example:

render renderMultiPassEffects:true renderElements:true renderElementBitmaps:&reb

if reb != undefined do for b in reb do display b

 

 

The following properties are available if the standard scanline renderer is being used:

[ antiAliasing: <boolean> ]

Defaults to current renderer Anti-Aliasing state.

[ antiAliasFilterSize: <float> ]

Defaults to current renderer Anti-Aliasing Filter Size value.

[ antiAliasFilter: <filter> ]

Defaults to current renderer Anti-Aliasing filter.

[ enablePixelSampler: <boolean> ]

Defaults to the current renderer Global SuperSampling state. This state is true if Disable all Samplers is checked, otherwise false.

[ mapping: <boolean> ]

Defaults to current renderer Mapping state.

[ shadows: <boolean> ]

Defaults to current renderer Shadows state.

[ autoReflect: <boolean> ]

Defaults to current renderer Auto-Reflect/Refract and Mirrors state.

[ forceWireframe: <boolean> ]

Defaults to current renderer Force Wireframe state.

[ wireThickness: <float> ]

Defaults to 1.0.

[ filterMaps: <boolean> ]

Defaults to current renderer Anti-Aliasing Filter Maps state.

[ objectMotionBlur: <boolean> ]

Defaults to current renderer Object Motion Blur Apply state.

[ objectBlurDuration: <float> ]

Defaults to 0.5.

[ objectBlurSamples: <integer> ]

Defaults to 10.

[ objectBlurSubdivisions: <integer> ]

Defaults to 10.

[ imageMotionBlur: <boolean> ]

Defaults to current renderer Image Motion Blur Apply state.

[ imageBlurDuration: <float> ]

Defaults to 0.5.

[ autoReflectLevels: <integer> ]

Defaults to 1.

Note

Since 3ds Max 5, the render() method passes any keyword arguments on to the renderer class instance, so any renderer parameter block or FPS interface property can be set via the keyword argument. This behavior replaces the hardcoded keyword arguments documented in the above topic. The default scanline renderer FPS interface properties were named to maintain consistency with existing scripts.

Quiet Mode Options:

[ quiet: <bool> ]

If true, suppress participating dialogs.

[ missingExtFilesAction: <actions> ]

Actions to take on Missing External Files, where <actions> is: #logmsg, #logToFile, #abort, and/or an integer, or an array of one or more of those items.

[ missingExtFilesList: &variable ]

If #logmsg is specified as action, the by-reference variable will be filled in with array of the missing external file names.

[ missingUVWAction: <actions> ]

Actions to take on Missing UVWs, where <actions> is: #logmsg, #logToFile, #abort, and/or an integer, or an array of one or more of those items.

[ missingUVWList: &variable ]

If #logmsg is specified as action, the by-reference variable will be filled in with array of strings containing the missing map channel and node name.

[ unsupportedRenderEffectAction: <actions> ]

Actions to take on Unsupported Render Effects, where <actions> is: #logmsg, #logToFile, #abort, #default and/or an integer, or an array of one or more of those items. Available in 3ds Max 8 and higher.

[ unsupportedRenderEffectList: &variable ]

If #logmsg is specified as action, the by-reference variable will be filled in with array of the unsupported render effect names. Available in 3ds Max 8 and higher.

See Quiet Mode for details.

You can invoke the renderer and have it do one or more of four things with the rendered output:

Note:

The render() function is interruptible mid-frame using the ESC key.

Examples:

render camera:$cam01 outputwidth:320 outputheight:240

for c in cameras do render c outputFile:(c.name + ".bmp") vfb:off

rollout1.image.bitmap = render camera:$cam01 ...

See also

Rendering - Topics Index