Skip to main content

Material

Class

An asset that describes how visual objects should appear.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Index

Remarks

Each Material is a collection of Pass which define the actual rendering passes. Materials are used by MaterialMeshVisual for drawing meshes in the scene.

Example

// Gets the first pass of a material on a sprite and plays the animation from its texture
var sprite = script.getSceneObject().getFirstComponent(SpriteVisual.getTypeName());
var material = sprite.getMaterial(0);
material.getPass(0).baseTex.control.play(-1,0.0);

// Print number of passes
print("Pass count = " + material.getPassCount().toString());

Extends

Properties

mainPass

mainPass: Pass

The first Pass of the Material, or null if the Material has no passes.

Default Value

null

name

name: string

The name of the Asset in Lens Studio.

Default Value

""

Inherited from

Asset.name


uniqueIdentifier

readonly uniqueIdentifier: string

Since

Lens Scripting Version 176

Inherited from

Asset.uniqueIdentifier

Methods

clone()

clone(): Material

Returns a copy of the Material.

Returns

Material


getPass()

getPass(index): Pass

Returns the Pass of the Material at index index.

Parameters

ParameterType
indexnumber

Returns

Pass


getPassCount()

getPassCount(): number

Returns the number of Pass for the Material.

Returns

number


getTypeName()

static getTypeName(): TypeName<Material>

Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().

Returns

TypeName<Material>

Overrides

Asset.getTypeName


getTypeName()

getTypeName(): string

Returns the name of this object's type.

Returns

string

Inherited from

Asset.getTypeName


isOfType()

isOfType(type): boolean

Returns true if the object matches or derives from the passed in type.

Parameters

ParameterType
typestring

Returns

boolean

Inherited from

Asset.isOfType


isSame()

isSame(other): boolean

Returns true if this object is the same as other. Useful for checking if two references point to the same thing.

Parameters

ParameterType
otherScriptObject

Returns

boolean

Inherited from

Asset.isSame

See also

Material Overview.