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.
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;
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.
See the base Material class for common properties.
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.
Scales the effect of the environment map by multiplying its color. Default is 1.
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.
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.
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.
Directed graph which contains material nodes.
Additional graphs representing node groups of the main node graph.
Node material profile, it can be "blender" or "max".
Object with material textures. It maps texture names to textures. You can use it to dynamically assign new textures to a material.
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.
Array of float values which contain values of the material's "Value" nodes.
Maps "Value" node name to index in .nodeValue array. Used to define which value is to be updated, see the example listing above.
Used to check whether this class represent node material.
You should not change this, as it is used internally for optimization.
See the base Material class for common methods.
Generate shaders and update other material parameters based on the specified .nodeGraph.
Convert GLTF node graph to the format used by the material's .nodeGraph property.
Use the following puzzles to manage your materials:
assign material - assign the material to an object.
replace texture - replace the material's texture.
For more info on how to obtain the source code of this module see this page.