MaxScript
MaxScript Overview
Note that MaxScript support is only available for 3ds Max 5.x and later. While V-Ray still exports all its parameters to MaxScript in 3ds Max 3.x and 3ds Max 4.x, there is no MaxScript access to the current renderer in those version.
In 3ds Max 5.x and higher, assuming that your current renderer is set to V-Ray, you can refer to it from MaxScript using the renderers structure:
vr=renderers.current
VRay_Adv_1_09_03g:VRay_Adv_1_09_03g
Renderer Properties
Assuming that the variable vr holds an instance of the V-Ray renderer, you can work with the renderer settings as with any other MaxScript object:
showproperties vr
.imageSampler_type : integer
.fixedRate_subdivs : integer
.fixedRate_rand : boolean
...............
...............
...............
.options_maxDepth : integer
.options_maps : boolean
.options_filterMaps : boolean
.output_on : boolean
.output_width : integer
.output_height : integer
.output_fileOnly : boolean
.output_saveFile : boolean
.output_fileName : string
.output_saveRawFile : boolean
.output_rawFileName : string
false
Accessing the parameters is fairly easy, for example:
vr.gi_on=true
true
Renderer Methods
You can also use the following methods for saving/loading irradiance and photon maps (assuming that vrholds an instance of V-Ray):
Renderer Method |
Description |
vr.saveCausticsPhotonMap<filename> |
saves the current caustics photon map to the given file |
vr.saveGlobalPhotonMap<filename> |
saves the current global photon map to the given file |
vr.saveIrradianceMap<filename> |
saves the current irradiance map to the given file |
vr.saveLightCache<filename> |
saves the current light cache to the given file |
vr.loadIrradianceMap<filename> |
loads the irradiance map from the given file |
vr.clearIrradianceMap() |
clears the irradiance map that is currently in memory |
vr.clearLightCache() |
clears the light cache that is currently in memory |
vr.showLastVFB() |
shows the V-Ray VFB window with last rendered image |
Global Functions
Additionally, the following MaxScript functions are globally available:
Global Function |
Description |
doVRayObjectProperties() |
brings up the V-Ray Object Properties dialog |
doVRayMeshExport() |
brings up the V-Ray Mesh Export dialog |
vrayMeshExport [meshFile:"<mesh file>"] [autoCreateProxies:true|false] [exportMultiple:true|false] [animation:on|off] [animationRange:#scene|#explicit] [animationStart:<integer>] [animationEnd:<integer>] [animationRedrawViews:true|false] [maxPreviewFaces:<integer>] |
exports a .vrmesh file without showing a dialog |
setVRaySilentMode() |
disables any V-Ray dialogs that may appear when loading a scene (f.e. notification for differences with older versions etc). |