You can use the render() function to invoke the 3ds max renderer. It can take many optional parameters to control the rendering.
[ camera: <camera_node> ]
Defaults to active viewport.
[ frame: <number> | #current ]
Defaults to #current.
[ framerange: <interval> | #active ]
[ fromframe: <number> ]
[ toframe: <number> ]
[ nthframe: <number> ]
Defaults to unsupplied, and the frame value controls which frames to render.
[ 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.
[ 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> ]
Defaults to current renderer Show VFB state.
[ netrender: <boolean> ]
Defaults to current renderer Net Render state.
[ renderer: #draft | #production]
Allows the selection of draft or production renderer. By default, the currently selected renderer is used.
[ renderType: #normal | #region | #regionCrop | #blowup | #selection ]
[ 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 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). Note that #region 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.
[ 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
#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> ]
All correspond to items in the 3ds max Render Scene setup dialogs.
The following are also available if the 3ds max 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.
You can invoke the renderer and have it do one or more of four things with the rendered output:
Display it in a virtual frame buffer (the default), controlled with the vfb: parameter.
Store the rendering in an image file by supplying an outputfile: parameter. The type of image file to be created is determined from the file suffix you specify.
Return the result as a MAXScript Bitmap value that you can perform Bitmap operations on (see the Bitmap Values topic).
Store the rendering in an existing MAXScript Bitmap value by supplying the to: parameter. Supplying this parameter causes settings such as height, width, aspect, gamma, file name, etc. to be taken from the supplied bitmap.
Note: The render() function 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 ...