Material
- Last UpdatedOct 22, 2025
- 3 minute read
The Material node enables you to access the material of a mesh.
Accessing the material of a mesh can be useful for different reasons:
-
Customizing material values with direct feedback on engine rendering.
-
Creating animations or behaviors based on material value dynamic changes.
Depending on the content of the MWX file, some materials allow you to select a different shader from the original shader specified in the MWX file content. You can change the shader even during runtime.
The typical usage is to create a Material node directly from the XR Studio Graphic Context Editor, select the mesh or the item, and then change its values while observing the rendering output in realtime.
Platform support
This node is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-Portable WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Submaterials
Sometimes a single mesh can have multiple submaterials (numSubMaterials is set to corresponding number). In this case, the corresponding material node is provided with fields to interact with each of the submaterials using the syntax nodeName.submaterialN\materialPropertyField
For example, mat_V1010.submaterial0\mGlossiness.
Note that in some cases, some parameters are designed to be common to all the submaterials, such as v3Color and v3ColorMul in the shUber_blink shader material type. These common parameters are duplicated into all submaterials. In these cases, the value is not initialized to the value in the shaderBuffer, but to its default value.
Code example
This is a code example for the Material node.
<Material name="mat_sphere_Sphere001" mesh="sphere|Sphere001" shader="myLibrary|myShader|shader01">
Material fields
These are the fields for Material node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > Material
Depending on the shader type, other fields may be available to customize how the shader renders the mesh.
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
lodLevel |
sint |
Optional |
Read only |
Specifies the LOD level of the mesh the material refers to. Set to zero (0) in case of mesh with no LOD. |
|
mesh |
svec3 |
Mandatory |
Read only |
Name of the mesh to which this material refers. |
|
numSubMaterials |
sint |
Optional |
0 |
Indicates the number of submaterials defined for the mesh. When there is no submaterial. the value is 0. |
|
shader |
svec3 |
Optional |
Read from MWX content |
The name of the shader to use to render mesh with the material. |