Skip to main content

LensStudio:AssetUtils.js.createMaterialFromGraph

Function

Creates a material from a shader graph asset.

createMaterialFromGraph(assetManager, graphType, materialDir?, materialName?, shaderGraphDir?): Promise<{ material: Material; passInfo: PassInfo; shaderGraphAsset: Pass; }>

Creates a material from a shader graph asset.

Parameters

ParameterTypeDescription
assetManagerAssetManagerThe asset manager used to create the material.
graphTypeShaderGraphTypeThe type of the shader graph asset.
materialDir?stringThe directory where the material will be created. Default is an empty string.
materialName?stringThe name of the material. Default is 'new material'.
shaderGraphDir?stringThe directory of the shader graph asset. Default is an empty string.

Returns

Promise<{ material: Material; passInfo: PassInfo; shaderGraphAsset: Pass; }>

An object containing the created material asset, the shader graph asset, and the pass on the material.