Material

MeshNodeMaterial

A custom node-based material.

This material used to describe custom material setups exported from Blender or 3ds Max. It 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

MeshNodeMaterial(parameters : 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 Material) can be passed in here.

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

Properties

See the base Material class for common properties.

.envMap : Texture

The environment map. To ensure a physically correct rendering, you should only add environment maps which were preprocessed by PMREMGenerator. Assigned automatically from a corresponding CubeReflectionProbe object if Material.envMapAutoAssign is true. Default is null.

.envMapIntensity : Float

Scales the effect of the environment map by multiplying its color. Default is 1.

.envMapParallaxMatrix : Matrix4

A Matrix4 used for applying the parallax effect to the material's .envMap. This matrix carries the transformation from the world space to the space of a particular reflection probe, which environment map this material uses for rendering. Calculated automatically if Material.envMapAutoAssign is true. Default is the identity matrix.

.envMapParallaxMatrixInv : Matrix4

A Matrix4 inverse to .envMapParallaxMatrix. Used for applying the parallax effect to the material's .envMap. Calculated automatically if Material.envMapAutoAssign is true. Default is the identity matrix.

.envMapParallaxType : Constant

Defines the type of the parallax volume. The same as CubeReflectionProbe.parallaxType. Assigned automatically from the corresponding CubeReflectionProbe if Material.envMapAutoAssign is true. Default is ReflectionProbeTypeInfinite.

.nodeGraph : DiGraph

Directed graph which contains material nodes.

.additionalNodeGraphs : Object

Additional graphs representing node groups of the main node graph.

.profile : String

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

.nodeTextures : Object

Object with material textures. It maps texture names to textures. You can use it to dynamically assign new textures to a material.

.nodeRGB : Array

Array of 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 Color class.

.nodeRGBMap : Array

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

.nodeValue : Array

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

.nodeValueMap : Array

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

.isMeshNodeMaterial : Boolean

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 Material class for common methods.

.updateNodeGraph () : null

Generate shaders and update other material parameters based on the specified .nodeGraph.

Static Methods

.nodeGraphFromGLTF (gltfNodeGraph : Object) : DiGraph

Convert GLTF node graph to the format used by the material's .nodeGraph property.

Puzzles

Use the following puzzles to manage your materials:
assign material - assign the material to an object.
replace texture - replace the material's texture.

Source

For more info on how to obtain the source code of this module see this page.