Nightly releases are generated automatically from the latest source code and are intended for experimental purposes only.
These builds may contain incomplete or untested features, bugs, or security vulnerabilities, and as such, are not for production use.
Users should be aware that nightly releases may cause unexpected behavior, data loss, or system instability.
Use of these releases is at the user's own risk, and it is advised to have adequate backups before testing.
The software is provided as is with no guarantees or support.
The MaterialAPI provides a set of methods for creating and managing materials in a webvis context. It allows you to:
Create materials and assign them to specific nodes in a scene.
Edit and update existing materials.
Retrieve all materials at once.
Request detailed material data for a specific material.
Remove materials when they are no longer needed.
Quick Start
The fastest way to get familiar with the MaterialAPI is by creating a material and assigning it to a node. The material can then be updated later and removed when it is no longer needed:
// Get the webvis contextconstcontext = webvis.getContext();// Create a node to assign the material to and enable the resource to make it visibleconstnodeId = context.add({dataURI:"urn:x-i3d:shape:box", initialProperties: {enabled:true}});// Create a materialconstmaterialId = context.createMaterial({baseColor: [1, 0, 0],opacity:1,roughness:0.5,metallic:0,name:"Red Material",});// Create an appearance URI which can be used to assign the material to a nodeconstappearanceURI = `urn:X-l3d:material:${materialId}`;// Assign the material to the previously added node via the APPEARANCE_URI propertyawaitcontext.setProperty(nodeId, webvis.Property.APPEARANCE_URI, appearanceURI);// Change the base color and the name of the materialcontext.changeMaterial(materialId, {baseColor: [0, 1, 0],name:"Green Material" });// Unassign the material from the nodeawaitcontext.setProperty(nodeId, webvis.Property.APPEARANCE_URI, null);// Remove the material if no longer requiredcontext.removeMaterial(materialId);
Events
The following events are associated with the MaterialAPI:
MaterialAPI
Overview
The MaterialAPI provides a set of methods for creating and managing materials in a webvis context. It allows you to:
Quick Start
The fastest way to get familiar with the MaterialAPI is by creating a material and assigning it to a node. The material can then be updated later and removed when it is no longer needed:
Events
The following events are associated with the MaterialAPI: