Controlling the VFB Programmatically
This page contains information for controlling the V-Ray Frame Buffer through environment variables and MaxScript.
Overview
The V-Ray Frame Buffer can be controlled programmatically in two ways: the first is by using MaxScript commands and the second, by using various environment variables.
From MaxScript
The vfbControl() MaxScript function modifies the various aspects of the VFB. These commands can be used in the MAXScript Listener or in an executable script. Commands follow this structure:
vfbControl (parameter)Â
vfbControl (parameter) (argument)
For example, to turn off the red channel in the VFB, type
vfbControl #red
false
To see a list of available options, type one of the following:
vfbControl()
vfbControl #help
Global VFB function |
Description |
vrayVFBGetRegionEnabled() |
Returns whether region rendering in the V-Ray VFB is enabled (true) or disabled (false). |
vrayVFBGetRegion() |
Returns an array with four integer elements, representing the pixel coordinates of the VFB render region (left, top, right, bottom). The left and top coordinates are included in the region, the right and bottom one are not. |
vrayVFBSetRegionEnabled true|false |
Turns on or off the VFB region render option. |
vrayVFBSetRegion left top right bottom |
Sets the VFB render region to the specified
|
vrayVFBGetNumChannels() |
Returns the number of channels (render elements) in the V-Ray VFB. This will return 0 if the VFB is not initialized or does not store any data. |
vrayVFBGetChannelName i |
Return the name of the i-th channel. Indexes start from 1. |
vrayVFBGetChannelType i |
Returns the storage type of the i-th channel. Indexes start from 1. The return value specifies the type of data for each pixel in the given channel:
|
vrayVFBGetChannelAlias i |
Returns the alias for the i-th channel. Indexes start from 1. See the RegionChannelAlias enum in the file "pixelbuffer.h" from the V-Ray SDK. |
vrayVFBGetChannelBitmap i |
Returns the contents of the specified channel as a 3ds Max bitmap. Indexes start from 1. This will return undefined if the channel index is not valid or the VFB does not contain any data. |
vfbControl() |
Allows control over the various aspects of the V-Ray VFB. Type vfbControl() for a list of available parameters, or for more details see the Controlling the VFB Programmatically page. |
vfbControl #show [true/false] |
Opens (true) or Closes (false) the VFB window or returns its current display state if called without a value. |
Parameter Tables
Here are some guidelines for using MaxScript:
-
Arguments listed as Boolean can only receive true/false values. These options turn a feature on (true) or off (false).
-
Remember that float values include a decimal while integers do not. This means that integers can be used when a float is required, but float values cannot be used where integers are required.
-
String values must be enclosed in double quotes.
-
Available values from enumerated lists are presented with a pipe (|) separator. For example, 0 | 1 | 2 means the argument value can only be a 0, 1, or 2. String values of this argument type are input with quote marks. For example, #setregion "reset"
-
Successfully loading a file or setting a numerical value implicitly enables the corresponding option. For example, using #setregion to set a region for rendering automatically turns on region rendering. If you want to disable a feature, do it after running the load/set command.
-
Many commands will return the current values for the parameter when used without arguments. This feature has been enabled for all commands for which it makes sense to do so.
VFB Toolbar Options
Parameter |
Description |
Arguments |
Examples |
#help |
Displays options for the vfbControl command |
None |
|
#show |
Opens (true) or closes (false) the VFB window or returns its current display state if called without a value |
Boolean |
|
#rgb |
Enables/disables the corresponding VFB toolbar feature |
Boolean |
vfbControl #alpha true |
#trackmouse |
Enables/disables the Track mouse while rendering feature |
Boolean |
|
#linkpdp |
Enables/disables the Link VFB to PDPlayer feature |
Boolean |
|
#swapab |
Enables/disables the Swap A/B feature |
Boolean |
|
#setcompareab |
Enables/disables Compare horizontal and Compare vertical features |
"h" | "hor" | "horizontal" |
vfbControl #setcompareab "h" |
#loadimage |
Loads the specified image in VFB |
String (filename) |
|
#saveimage |
Saves the VFB RGB color channel as an image |
String (filename) |
|
#saveallimage |
Saves all VFB render channels to separate images or a single vrimg file |
String (filename) |
|
#savemultiimage |
Saves a multichannel .exr or .vrimg file with all VFB render channels inside |
String (filename) |
vfbcontrol #savemultiimage "D:\output\image.exr" |
#setregion |
Sets the render region in pixels, or resets to entire image |
Integers: left top right bottom |
vfbControl #setregion 0 0 640 480 |
#getregion |
Returns the current left, top, right, and bottom settings for region rendering |
None |
vfbControl #getregion |
#clearimage |
Clears the VFB image |
None |
|
#duplicate |
Duplicates the VFB |
None |
|
#hide |
Hides the VFB |
None |
|
#getchannel |
Returns the index of the currently selected render element channel. |
None |
|
#getchannelnames |
Returns a list of the channels available in the current image |
None |
|
#setchannel |
Selects the render element channel with an index |
Integer |
vfbControl #setchannel 0 |
#clamp |
Enables/disables Force color clamping |
Boolean |
vfbControl #clamp true |
#viewclamp |
Enables/disables View clamped colors |
Boolean |
|
#info |
Enables/disables Show Pixel information |
Boolean |
|
#pixelaspect |
Enables/disables Use pixel aspect |
Boolean |
|
#stereo |
Sets the Stereo value using an integer: |
0 | 1 | 2 |
vfbControl #stereo 1 |
#pos |
Controls the position of the VFB window: |
Integers: top left |
vfbControl #pos 100 150 |
VFB Color Correction Options
Parameter |
Description |
Arguments |
Examples |
#showcc |
Shows/hides the Color Corrections panel |
Boolean |
|
#exposure |
Enables/disables Exposure correction |
Boolean |
|
#whitebalance |
Enables/disables White Balance correction |
Boolean |
|
#huesat |
Enables/disables Hue / Saturation correction |
Boolean |
|
#colorbalance |
Enables/disables Color Balance correction |
Boolean |
|
#levels |
Enables/disables Levels correction |
Boolean |
|
#curve |
Enables/disables Curve correction |
Boolean |
|
#bkgr |
Enables/disables Background Image correction |
Boolean |
|
#lut |
Enables/disables LUT correction |
Boolean |
|
#ocio |
Enables/disables OCIO correction |
Boolean |
|
#icc |
Enables/disables ICC correction |
Boolean |
|
#srgb |
Enables/disables sRGB gamma correction |
Boolean |
|
#ccociovt |
Sets OCIO View Transform by number in the dropdown list |
Integer |
|
#ccocioics |
Sets OCIO Input Colorspace by number in the dropdown list |
Integer |
|
#ccociodd |
Sets OCIO Display Device by number in the dropdown list |
Integer |
|
#ocioinputcolorspace |
Sets OCIO Input Colorspace by name |
String |
|
#ociodisplaydevice |
Sets OCIO Display Device by name |
String |
|
#ocioviewtransform |
Sets OCIO View Transform by name |
String |
|
#itemsociocs |
Returns a list of all available OCIO Input Colorspace values |
None |
|
#itemsociodd |
Returns a list of all available OCIO Display Device values |
None |
|
#itemsociovt |
Returns a list of all available OCIO View Transform values |
None |
|
#itemsiccri |
Returns a list of all available ICC Rendering Intent values |
None |
|
#colorbalancemode |
Sets the Color Balance mode with an integer: |
0 | 1 | 2 | 3 |
vfbControl #colorbalancemode 3 |
#colorbalancevalue |
Sets the Color Balance values |
# # # |
vfbControl #colorbalancevalue 0.2 0 0.1 |
#huesaturationvalue |
Sets the Hue/Saturation values |
# # # |
|
#cclevels_rgb |
Enables/disables color components in Levels correction |
Boolean |
|
#bkgrimgasforegr |
Enables/disables the use of Background correction image as foreground |
Boolean |
|
#lutconverttolog |
Enables/disables Log space conversion before applying LUT |
Boolean |
|
#cciccblackpoint |
Enables/disables ICC black point compression |
Boolean |
|
#cciccrenderintent |
1 - Perceptual |
1 | 2 | 3 | 4 |
|
#setexposure |
Sets Exposure value |
Float |
|
#sethighlightburn |
Sets Highlight Burn value |
Float |
|
#setcontrast |
Sets Contrast value |
Float |
|
#setlevelsmin |
Sets Levels min value |
Float |
|
#setlevelsmax |
Sets Levels max value |
Float |
|
#setwhitebalanceval |
Sets White Balance Temperature value |
Float |
|
#getexposure |
Returns the current Exposure float value |
None |
|
#gethighlightburn |
Returns the current Highlight Burn value |
None |
|
#getcontrast |
Returns the current Contrast float value |
None |
|
#getlevelsmin |
Returns the current Levels min float value |
None |
|
#getlevelsmax |
Returns the current Levels max float value |
None |
|
#getwhitebalanceval |
Returns the current White Balance Temperature float value |
None |
|
#loadbkgrimage |
Specifies file for Background image correction |
String (filename) |
|
#loadlut |
Specifies file for LUT correction |
String (filename) |
|
#loadocio |
Specifies file for OCIO correction |
String (filename) |
|
#loadicc |
Specifies file for ICC correction |
String (filename) |
|
#loadcurve |
Load Curve shape from the specified .bcurve file |
String (filename) |
|
#savecurve |
Save Curve shape in the specified .bcurve file |
String (filename) |
|
#saveglobalccpreset |
Save Global preset for the Corrections control panel to a specified .vccglb file |
String (filename) |
|
#loadglobalccpreset |
Load Global preset for the Corrections control panel from a specified .vccglb file |
String (filename) |
|
#saveccpreset |
Save preset for corrections control rollout to a specified file. |
String (filename) |
|
#loadccpreset |
Load preset in corrections control rollout from a specified file. |
String (filename) |
|
#resetcc |
Resets parameters from corresponding |
None |
vfbcontrol #resetcc - Resets all correction control parameters |
#bkgrimgfile |
Returns the filename (string) used in the corresponding Correction Control rollout |
None |
|
VFB History
Parameter |
Description |
Arguments |
Examples |
#showhistory |
Shows/Hides History panel |
Boolean |
|
#historytemppath |
Returns the path used for History Directory |
None |
|
#historymaxsize |
Size of VFB History in MB |
Integer |
|
#historyselect |
Selects a History image based on index. |
Integer |
vfbControl #historyselect 2 |
#historyload |
Performs an operation on the History image |
None |
vfbControl #historyselect 0 (required before next command) |
#historyclear |
Deletes all images from history |
None |
|
#historycomment |
Adds a comment to the History image |
String |
vfbControl #historyselect 1 |
Lens Effects
Parameter |
Description |
Arguments |
Examples |
#bloom |
Turns on/off Bloom |
Boolean |
vfbControl #bloom true |
#glare |
Turns on/off Glare |
Boolean |
|
#bloomfill |
Turns on/off Bloom Fill Edges |
Boolean |
|
#glarefill |
Turns on/off Glare Fill Edges |
Boolean |
|
#bloommode |
Sets the Bloom mode |
"image" | "both" | "renderelem" |
vfbControl #bloommode "image" |
#glaremode |
Sets the Glare mode |
"image" | "both" | "renderelem" |
|
#glaretype |
Sets the Glare type |
"image" | "rendercam" | "camparams" |
|
#bloomweight |
Sets Bloom Weight value |
Float |
|
#bloomsize |
Sets Bloom Size value |
Float |
|
#bloomshape |
Sets Bloom Shape value |
Float |
|
#glareweight |
Sets Glare Weight value |
Float |
|
#glaresize |
Sets Glare Size value |
Float |
|
#bloomintensity |
Enables/disables Bloom Mask by Intensity |
Boolean |
|
#bloomobject |
Enables/disables Bloom Mask by Object ID |
Boolean |
|
#bloommaterial |
Enables/disables Bloom Mask by Material ID |
Boolean |
|
#glareintensity |
Enables/disables Glare Mask by Intensity |
Boolean |
|
#glareobject |
Enables/disables Glare Mask by Object ID |
Boolean |
|
#glarematerial |
Enables/disables Glare Mask by Material ID |
Boolean |
|
#bloomsetintensity |
Sets Bloom Intensity mask value |
Float |
|
#glaresetintensity |
Sets Glare Intensity mask value |
Float |
|
#bloomgetintensity |
Returns Bloom Intensity mask float value |
None |
|
#glaregetintensity |
Returns Glare Intensity mask float value |
None |
|
#bloomsetobject |
Sets Bloom Object ID mask value |
Integer |
|
#bloomsetmaterial |
Sets Bloom Material ID value |
Integer |
|
#glaresetobject |
Sets Glare Object ID mask value |
Integer |
|
#glaresetmaterial |
Sets Glare Material ID value |
Integer |
|
#bloomgetobject |
Returns Bloom Object ID mask integer value |
None |
|
#bloomgetmaterial |
Returns Bloom Material ID integer value |
None |
|
#glaregetobject |
Returns Glare Object ID mask integer value |
None |
|
#glaregetmaterial |
Returns Glare Material ID integer value |
None |
|
#glarediffraction |
Enables/disables Glare Difraction |
Boolean |
|
#glareuseobstacle |
Enables/disables Use Obstacle image |
Boolean |
|
#glareblades |
Enables/disables Blades |
Boolean |
|
#glaresetblades |
Sets Glare Blades number |
Float |
|
#glarebladesrot |
Sets Glare Blades rotation |
Float |
|
#glarefnumber |
Sets Glare F-Number value |
Float |
|
#glaregetblades |
Returns Glare Blades number float value |
None |
|
#glareimage |
Specifies Glare Image |
String (filename) |
|
#glareobstacleimage |
Specifies Glare Obstacle image |
String (filename) |
|
Stamps
Parameter |
Description |
Value Options |
Examples |
#stamp |
Enables/disables the stamp |
Boolean |
vfbControl #stamp true |
#stamphalign |
Sets horizontal alignment for stamp |
"left" | "center" | "right" |
|
#stampvalign |
Sets vertical alignment for stamp |
"top" | "bottom" |
|
#stamptext |
Sets the text string to appear on the stamp |
String |
vfbControl #stamptext "Test rendering" |
Debug Shading
Parameter |
Description |
Value Options |
Examples |
#debugshading |
Enables/Disables Debug Shading |
Boolean |
vfbControl #debugshading true |
#debugshadinglockedselection |
Switches from Isolate Selected to Isolate Locked Selection Debug Shading mode |
Boolean |
vfbControl #debugshadinglockedselection true |
#debugshadingmode |
Sets Debug Shading mode with an integer: |
Integer |
vfbControl #debugshadingmode 1 |
. ipr_debugshading_wireframe_subtris |
Shows/Hides subtriangles in Wireframe shading mode. |
Boolean |
renderers.current.ipr_debugshading_wireframe_subtris true |
.ipr_debugshading_wireframe_width_pix |
Sets pixel width for Wireframe shading mode. |
Float |
renderers.current.ipr_debugshading_wireframe_width_pix 0.5 |
.ipr_debugshading_ao_radius_pix |
Sets radius in pixels for the Ambient Occlusion shading mode. |
Float |
renderers.current.ipr_debugshading_ao_radius_pix 20 |
Environment Variables
Some aspects of the VFB can also be controlled with various environment variables:
Variable Name |
Description |
VRAY_VFB_SRGB |
Turn On (1) or Off (2) sRGB option of V-Ray VFB by default. |
VRAY_VFB_PIXEL_ASPECT |
Turn On (1) or Off (2) Use pixel aspect option of V-Ray VFB by default. |
VRAY_VFB_GLOBAL_PRESET_FILE_USE |
Enable (1) or Disable (0) automatic loading of a global .vccglb preset for the VFB. |
VRAY_VFB_GLOBAL_PRESET_FILE |
Specify default .vccglb filename (string) to be used when loading automatic global preset. |
VRAY_VFB_ICC |
Enable (1) or Disable (2) the ICC correction in VFB by default. |
VRAY_VFB_ICC_FILE |
Specify default ICC correction file for V-Ray VFB. It will be automatically loaded when ICC is enabled. |
VRAY_VFB_OCIO |
Enable (1) or Disable (2) the OCIO correction in V-Ray VFB by default. |
VRAY_VFB_OCIO_INPUT_COLORSPACE |
Specify default input OCIO color space. A default OCIO configuration can be specified by the OCIO environment variable. |
VRAY_VFB_OCIO_DISPLAY_DEVICE |
Specify default OCIO display device. A default OCIO configuration can be specified by the OCIO environment variable. |
VRAY_VFB_OCIO_VIEW_TRANSFORM |
Specify default OCIO view transform. A default OCIO configuration can be specified by the OCIO environment variable. |
VRAY_VFB_LUT |
Enable (1) or Disable (2) the LUT correction in V-Ray VFB by default. |
VRAY_VFB_LUT_FILE |
Specify default LUT correction file for V-Ray VFB. It will be automatically loaded when LUT is enabled. |
VRAY_VFB_AFFECT_SWATCHES |
Apply VFB corrections to swatches in the Material Editor: |
VRAY_VFB_ALWAYS_ON_TOP |
Specify a ALWAYS ON TOP behavior: |