Next (Animation) Previous (Objects)


###Create Material
Material creation is similar to the object creation, you can use both creators and addNode() approaches, when using addNode(), you need to add node under virtual node %MaterialLibrary, and you can also name the material and set some default primitives, the command looks like,

ctx('%MaterialLibrary').addNode('name', 'Material', {'Material':{"MaterialType":{"Primitive":value}}});

For Example: Create a Standard material,

ctx.exec("creators", "createStandardContext");

Create a Standard material “MyMaterial“,

ctx('%MaterialLibrary').addNode('MyMaterial', 'Material', {'Material':{"Standard":{}}});

###Rename Material
As mentioned in the “Create Material“, we can initialize the primitives of a material when creating it.
And we can also modify the value of primitive at any time. Different with an object, a material only has Name property and Material plug, to rename of a material use the command like,


For Example: Rename the material from “Standard“ to “MyMaterial“.


###Set Primitives
All primitives of material are under the operators of the Material plug. Under this plug, all material has an operator named as their “MaterialType“, and you can add an operator named vray/BRDFLayered_item. To set the primitive value of operator “MaterialType“, use the command like,


For Example: set the diffuseColor of Standard material “MyMaterial“ to (0.5,0.5,0.5),


###Apply Material
To apply a material to an object, return to Material plug of the desired object, set the operator reference to the name of the material which you want, the command looks like,


For Example: Apply “MyMaterial“ to the object “MyBox“,


###Plugs and Operators
MaterialType: Physical, Standard, MultiID, CubeMap, EnvironmentMap, Canvas.

Primitive: Please check

Next (Animation) Previous (Objects)