LensStudio:AssetUtils.js.createMaterialFromGraph
FunctionCreates 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
| Parameter | Type | Description |
|---|---|---|
assetManager | AssetManager | The asset manager used to create the material. |
graphType | ShaderGraphType | The type of the shader graph asset. |
materialDir? | string | The directory where the material will be created. Default is an empty string. |
materialName? | string | The name of the material. Default is 'new material'. |
shaderGraphDir? | string | The 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.