MaterialsModule

The Materials module provides access to the materials in an effect.

Example

//==============================================================================
// The following example demonstrates how to access a material in the Assets,
// assign it to an object, and change it's opacity.
//
// Project setup:
// - Insert a plane
// - Create a material
//==============================================================================

// Load in the required modules
const Materials = require('Materials');
const Scene = require('Scene');

// Locate the plane in the Scene
const plane = Scene.root.find('plane0');

// Locate the plane in the Scene
const material = Materials.get('defaultMaterial0');

// Assign the material to the plane
plane.material = material;

// Set the opacity of the material to 50%
material.opacity = 0.5;

Properties

This module exposes no properties.

Methods

MethodDescription

get

get(materialName: string): MaterialBase

Returns a MaterialBase class that represents the material specified by the materialName parameter. The materials are defined in the AR Studio project.

An exception is thrown when the identifier isn't found in the project.

See Also: MaterialBase.name.

Classes

ClassDescription

BlendedMaterial

The BlendedMaterial class encapsulates materials blended from multiple textures.

BlendShapeToWarpMapMaterial

The BlendShapeToWarpMapMaterial class.

ColorPaintMaterial

The ColorPaintMaterial class encapsulates a face-paint material.

DefaultMaterial

The DefaultMaterial class encapsulates an image-based material.

MaterialBase

The MaterialBase class exposes properties common to all material types.

MetallicRoughnessPbrMaterial

The MetallicRoughnessPbrMaterial class encapsulates physically based materials.

RetouchingMaterial

The RetouchingMaterial class encapsulates parameters which define the extend of certain beautification techniques.

TextureTransform

The TextureTransform class encapsulates scaling and translation transforms about a textures UV axis.