Documentation



Menu

MaxScript Reference

Iray includes support for MaxScript within 3ds Max. These functions have been made available to allow reading and modification of Iray+ Lights, Materials and Render Settings.

Contents

Render Settings

The Iray+ Render Settings can be read and modified using standard MaxScript functions.

Example:

renderers.current = Iray()  // set the renderer to Iray+, You could also use Iray__Interactive() here.
cur = renderers.current
showproperties cur           //show all render properties available to Iray+ renderer
pathtofile  = "C:\previews\BackplateImg.jpg"
cur.backplate_file = pathtofile                      //Set the backplate image

List of supported render properties:

.brightness : float
.saturation : float
.burn_highlights : float
.crush_blacks : float
.use_custom_whitepoint : boolean
.whitepoint : RGB color
.whitepoint_preset : integer
.cloud_address : string
.cloud_video_format : string
.cloud_video_bit_rate : integer
.cloud_video_frame_rate : integer
.backplate_use : boolean
.backplate_fit : boolean
.backplate_file : string
.backplate_scale : point2
.backplate_scale_linked : boolean
.backplate_offset : point2
.backplate_gamma : float
.dof_enable : boolean
.dof_strength : float
.dof_use_target_dist : boolean
.dof_focus_dist : float
.dof_backplate : boolean
.iteration_count : integer
.max_rendering_time : integer
.physically_accurate : boolean
.photo_max_bounces : integer
.caustic_sampler : boolean
.irt_approx_bounced_light : boolean
.irt_approx_area_light : boolean
.irt_max_bounces : integer
.bloom_filter_enable: boolean
.bloom_filter_radius: float
.bloom_filter_threshold: float
.bloom_filter_strength: float


Create a New Iray+ Material

Iray+ materials can be created using a single initialiser:

Iray__Material()

The layer on this can then be changed using irpSetMaterialType

Example:

IrayMaterial = Iray__Material()          //Assigns a name to the Iray+ material. This can then be assigned to a scene object


Create a New Iray+ Map

An Iray+ map can be created using a similar approach to the creation of an Iray+ material.

Example:

IrayMaterial = Iray__Perlin_Noise()

List of Iray+ Map initialisers:

Iray__Perlin_Noise()
Iray__Worley_Noise()
Iray__Flake_Noise()
Iray__Flow_Noise()


Get a list of Iray Parameters

irpGetPropertyList <object.material>

This function returns the property names of a specified object as an array.

Example:

irpGetPropertyList $obj.mat


Set an Iray+ Material Parameter

irpSetProperty <object.material> <property_name_string> <property_value>

Allows you to access and set the properties of an Iray+ material.

Example:

irpSetProperty $obj.mat "refr_gloss" 1.0

You can also pass maps to the Iray+ material using this function. If supported, it will attach the map to the specified material parameter.


✱  Note: The property name must always be passed as a string.
To get a list of property names, see irpGetPropertyList.


Get an Iray+ Material Parameter

irpGetProperty <object.material> <property_name_string>

Allows you to get the property of an Iray+ material.

Example:

irpGetProperty $obj.mat "refr_gloss"          // Returns the value of the "refr_gloss" parameter

✱  Note: The property name must always be passed as a string.
To get a list of property names, see irpGetPropertyList


Set Iray+ Material Layer Type

irpSetMaterialType <object.material> <IRP_LayerName_string> <enable_emission_bool>

Used to set the material layer type of the Iray+ material.

Example:

IrayMaterial = Iray__Material()         // create a new Iray+ material

irpSetMaterialType IrayMaterial "IrayPlus_ArchAndDesign" false         // Set the layer type of an Iray+ Material to IrayPlus_ArchAndDesign. Disable emission on the material.

Currently supported layer types:

You can apply one of the Iray+ mental ray® conversion material layers using:

"IrayPlus_Generic"
"IrayPlus_ArchAndDesign"
"IrayPlus_MetallicPaint"
"IrayPlus_FastSSS"
"IrayPlus_SkinSSS"

Alternatively, you can set one of the standard Iray+ material layers using the name of the required layer. A list of the layer names can be found here

For example, to set a Velvet material with no emission you would use:

irpSetMaterialType $obj.mat "Velvet" false         // Set the layer type of the Iray+ Material to Velvet. Disable emission on the material.


Get Iray+ Material Layer Type

irpGetMaterialType <object.material>

Used to get the layer type of the Iray+ material.

Example:

irpGetMaterialType allObjects[1].mat              //Returns a string containing  the layer type of the currently applied Iray+ material layer.


Export Iray+ Material to MDL

irpExportMDL <object.material> [ filename:<output_filename> ]

Used to get export the Iray+ material to MDL.

The optional 'filename' key allows you to specify the name of the mdl file to export to. If this key is not set, then a File Save dialog will be displayed.

Example:

irpExportMDL allObjects[1].mat filename:"c:/outputdirectory/material.mdl" 


Lights

Most of the lights are supported using the standard built-in MaxScript functions. For more information on these functions, please refer to the Autodesk MaxScript Documentation.

Example:

setProperty <IrayLight> <light_property> <value>         //uses the max setProperty function to set an Iray+ lights property


Other

There are some miscellaneous settings exposed to maxscript as described below:

Enable/Disable Irradiance Layer

Enable, disable or query the state of the Irradiance layer:

MAXScriptIrayPlusRenderer.enableIrradiance <optional_bool>

Example

MAXScriptIrayPlusRenderer.enableIrradiance true        // To query the state, simply omit the true/false condition

Get Irradiance Min/Max values

Get the minimum or maximum Irradiance values in the scene.

MAXScriptIrayPlusRenderer.minIrradiance
MAXScriptIrayPlusRenderer.maxIrradiance

Example:

MAXScriptIrayPlusRenderer.maxIrradiance

Get Irradiance Min/Max colour values

Get the minimum or maximum Irradiance colour in the scene.

MAXScriptIrayPlusRenderer.getIrradianceDisplayColour<Min/Max_Scene_Irradiance>

Example:

MAXScriptIrayPlusRenderer.getIrradianceDisplayColour MAXScriptIrayPlusRenderer.minIrradiance


Page Last Edited: