[page:Material] →

[name]

A custom node-based material.

This material used to describe custom material setups exported from Blender or 3ds Max. I can be physically based or non-physical depending on the specified node graph.

Examples

Change material color specified in the "RGB.001" node:

var object = app.scene.getObjectByName("MyObj"); var mat = object.material; var index = mat.nodeRGBMap['RGB.001']; // 'RGB.001' is the name of an RGB node mat.nodeRGB[index] = new v3d.Vector4(1, 0, 0, 1); // new color in RGBA format mat.needsUpdate = true;

Change value specified in the "Value.001" node:

var object = app.scene.getObjectByName("Circle"); var mat = object.material; var index = mat.nodeValueMap['Value.001']; mat.nodeValue[index] = 0.5; // new value mat.needsUpdate = true;

Constructor

[name]([param:Object parameters])

[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance. Any property of the material (including any property inherited from [page:Material]) can be passed in here.

The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal string and is *0xffffff* (white) by default. [page:Color.set](color) is called internally.

Properties

See the base [page:Material] class for common properties.

[property:DiGraph nodeGraph]

Directed graph which contains material nodes.

[property:Object additionalNodeGraphs]

Additional graphs representing node groups of the main node graph.

[property:String profile]

Node material profile, it can be "blender" or "max".

[property:Object nodeTextures]

Object with material textures. It maps texture names to [page:Texture textures]. You can use it to dynamically assign new textures to a material.

[property:Array nodeRGB]

Array of [page:Vector4 Vector4] values which contains color values of a material's "RGB" nodes. Please note that these colors are represented by 4-dimentional vector, not the [page:Color Color] class.

[property:Array nodeRGBMap]

Maps "RGB" node name to index in [page:.nodeRGB] array. Used to define which color value is to be updated, see the example listing above.

[property:Array nodeValue]

Array of float values which contain values of the material's "Value" nodes.

[property:Array nodeValueMap]

Maps "Value" node name to index in [page:.nodeValue] array. Used to define which value is to be updated, see the example listing above.

[property:Boolean isMeshNodeMaterial]

Used to check whether this class represent node material.
You should not change this, as it is used internally for optimization.

Methods

See the base [page:Material] class for common methods.

[method:null updateNodeGraph]()

Generate shaders and update other material parameters based on the specified [page:.nodeGraph].

Static Methods

[method:DiGraph nodeGraphFromGLTF]([param:Object gltfNodeGraph])

Convert [page:GLTFLoader GLTF node graph] to the format used by the material's [page:.nodeGraph] property.

Puzzles

Use the following puzzles to manage your materials:
[page:Puzzles.assign_material assign material] - assign the material to an object.
[page:Puzzles.replace_texture replace texture] - replace the material's texture.

[sourceHint]