Scripted Material Plug-ins

Scripted Material plug-ins can only extend existing Material plug-ins. A scripted Material plug-in is declared by specifying the <superclass> as material.

A scripted Material plug-in must have at least one rollout defined.

In a scripted Material plug-in, Material and Map buttons that are associated with a parameter in a parameter block do not call the button’s picked event handler. Instead, you should link the button to a parameter in a parameter block, and use the set handler for the parameter.


-- this is a level 3 plug-in, the beginnings of a custom glass material.

-- It extends Standard material and replaces its UI with a single

-- rollout with 2 spinners and a color picker

plugin material myGlass

name:"Supa Glass"


extends:Standard replaceUI:true version:1


parameters main rollout:params


trans type:#float default:27 ui:trans

refrac type:#float default:1.5 ui:refrac

col type:#color default:blue ui:col

on trans set val do delegate.opacity = val

on refrac set val do delegate.ior = val

on col set val do delegate.diffuse_color = val


rollout params "Glass Parameters"


spinner trans "Transparency: " fieldwidth:45 offset:[-90,0]

spinner refrac "Index of Refraction: " fieldwidth:45 offset:[-90,0]

colorpicker col "Base color: " align:#center


on create do


-- setup initial material

delegate.opacityFalloff = 75




The render() function can be called re-entrantly within a scripted material. (In releases prior 3ds Max 4, attempting to do this caused a runtime error saying that the renderer could not be called while a render was already under way.)

See also

Updating Scripted Plug-ins

Scripted Plug-in Methods

Scripted Plug-in Clauses

Scripted Plug-ins