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 the Iray+ renderer.
pathtofile  = "C:\previews\BackplateImg.jpg"
cur.backplate_file = pathtofile   //Set the backplate image.

Currently 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()   //Assign 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()

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


Get an Iray+ Material Parameter

irpGetProperty <object.material> <property_name_string>

This function lets you retrieve individual properties of an Iray+ material.

Example:

irpGetProperty $obj.mat "refr_gloss"   //Get 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 an Iray+ Material Parameter

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

This function lets you access and set the properties of an Iray+ material.

Example:

irpSetProperty $obj.mat "refr_gloss" 1.0   //Set the value of the "refr_gloss" parameter to 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 Layer Type

irpGetMaterialType <object.material>

This function lets you retrieve the layer type of an Iray+ material.

Example:

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


Set an Iray+ Material Layer Type

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

This function lets you set the material layer type of an Iray+ material.

Example:

IrayMaterial = Iray__Material()   //Create a new Iray+ material.

irpSetMaterialType IrayMaterial "IrayPlus_ArchAndDesign" false   // Set the layer type of the 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


Export an Iray+ Material to MDL

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

This function lets you export an 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 standard built-in functions. For more information on these functions, please refer to the Autodesk MAXScript documentation.

Example:

setProperty <IrayLight> <light_property> <value>   //Use the 3ds Max setProperty function to set an Iray+ Light's property.


Other

Various additional settings are exposed to MAXScript.

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 optional 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 color

Get the minimum or maximum Irradiance color in the scene:

MAXScriptIrayPlusRenderer.getIrradianceDisplayColour<Min/Max_Scene_Irradiance>

Example:

MAXScriptIrayPlusRenderer.getIrradianceDisplayColour MAXScriptIrayPlusRenderer.minIrradiance


Last edited: