Create a new node based material
defines the material name
Optional
scene: Scenedefines the hosting scene
Optional
options: Partial<INodeMaterialOptions>defines creation option
Gets or sets the root nodes of the material fragment (pixel) shader
Gets or sets the root nodes of the material vertex shader
Gets or sets a boolean indicating that the material is allowed (if supported) to do shader hot swapping. This means that the material can keep using a previous shader while a new one is being compiled. This is mostly used when shader parallel compilation is supported (true by default)
Stores the animations for the material
Gets an array of blocks that needs to be serialized even if they are not yet connected
Specifies if the ready state should be checked on each call
Specifies if the ready state should be checked once
Gets or sets the active clipplane 1
Gets or sets the active clipplane 2
Gets or sets the active clipplane 3
Gets or sets the active clipplane 4
Gets or sets the active clipplane 5
Gets or sets the active clipplane 6
A free comment about the material
Custom callback helping to override the default shader used in the material.
Optional
attributes: string[]Optional
options: ICustomShaderNameResolveOptionsSpecifies the depth function that should be used. 0 means the default engine function
Specifies if color writing should be disabled
Specifies if depth writing should be disabled
Specifies if the material should be serialized
Gets or sets a boolean indicating that alpha blending must be enabled no matter what alpha value or alpha channel of the FragmentBlock are
Specifies if depth writing should be forced
Callback triggered to get the render target textures
The ID of the material
Gets or sets a boolean indicating that alpha value must be ignored (This will turn alpha blending off even if an alpha value is produced by the material)
List of inspectable custom properties (used by the Inspector)
https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
Defines the maximum number of lights that can be used in the material
Gets or sets user defined metadata
The name of the material
Observable raised when the material is built
Callback triggered when the material is compiled
An event triggered when the material is disposed
Callback triggered when an error occurs
Optional
pluginPlugin manager for this material
Stores the size of points
For internal use only. Please do not use.
Specifies if there should be a separate pass for culling
Custom shadow depth material to use for shadow rendering instead of the in-built one
Stores the value for side orientation
Snippet ID if the material was created from the snippet server
The state of the material
Readonly
stencilGives access to the stencil properties of the material
Gets or sets the unique id of the material
Stores the z offset Factor value
Stores the z offset Units value
Static
Readonly
AllThe all dirty flag value
Static
Readonly
AttributesThe dirty attribute flag value
Static
Readonly
ClockStores the clock-wise side orientation
Static
Readonly
CounterStores the counter clock-wise side orientation
Static
EditorURLDefine the Url to load node editor script
Static
Readonly
FresnelThe dirty fresnel flag value
Static
IgnoreGets or sets a boolean indicating that node materials should not deserialize textures from json / snippet content
Static
Readonly
LightThe dirty light flag value
Static
Readonly
LineReturns the line list draw mode
Static
Readonly
LineReturns the line loop draw mode
Static
Readonly
LineReturns the line strip draw mode
Static
Readonly
MATERIAL_MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
Static
Readonly
MATERIAL_MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
Static
Readonly
MATERIAL_MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer. They are also discarded below the alpha cutoff threshold to improve performances.
Static
Readonly
MATERIAL_The Reoriented Normal Mapping method is used to blend normals. Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
Static
Readonly
MATERIAL_The Whiteout method is used to blend normals. Details of the algorithm can be found here: https://blog.selfshadow.com/publications/blending-in-detail/
Static
Readonly
MATERIAL_MaterialTransparencyMode: No transparency mode, Alpha channel is not use.
Static
Readonly
MiscThe dirty misc flag value
Static
OnEvent observable which raises global events common to all materials (like MaterialPluginEvent.Created)
Static
Readonly
PointReturns the point fill mode
Static
Readonly
PointReturns the point list draw mode
Static
Readonly
PreThe dirty prepass flag value
Static
SnippetDefine the Url to load snippets
Static
Readonly
TextureThe dirty texture flag value
Static
Readonly
TriangleReturns the triangle fan draw mode
Static
Readonly
TriangleReturns the triangle fill mode
Static
Readonly
TriangleReturns the triangle strip draw mode
Static
Readonly
WireReturns the wireframe mode
Gets the alpha value of the material
Sets the alpha value of the material
Gets the value of the alpha mode
Sets the value of the alpha mode.
Value | Type | Description |
---|---|---|
0 | ALPHA_DISABLE | |
1 | ALPHA_ADD | |
2 | ALPHA_COMBINE | |
3 | ALPHA_SUBTRACT | |
4 | ALPHA_MULTIPLY | |
5 | ALPHA_MAXIMIZED | |
6 | ALPHA_ONEONE | |
7 | ALPHA_PREMULTIPLIED | |
8 | ALPHA_PREMULTIPLIED_PORTERDUFF | |
9 | ALPHA_INTERPOLATE | |
10 | ALPHA_SCREENMODE |
Gets the culling state
Sets the culling state (true to enable culling, false to disable)
Block the dirty-mechanism for this specific material When set to false after being true the material will be marked as dirty.
Gets or sets the unique identifier used to identified the effect associated with the material
If the material can be rendered to several textures with MRT extension
Get a string representing the shaders built by the current node graph
Gets the type of faces that should be culled
Sets the type of faces that should be culled (true for back faces, false for front faces)
Gets the material fill mode
Sets the material fill mode
Gets the value of the fog enabled state
Sets the state for enabling fog
Gets a boolean indicating that current material needs to register RTT
Gets the image processing configuration used either in this material.
Sets the Default image processing configuration used either in the this material.
If sets to null, the scene one is in use.
Specifies if updates for the material been locked
Can this material render to prepass
Gets or sets the mode property
Gets the depth pre-pass value
Sets the need depth pre-pass value
Called during a bind event
An event triggered when the material is bound
Called during a dispose event
An event triggered when the effect is (re)created
Gets or sets options to control the node material overall behavior
Gets the value specifying if point clouds are enabled
Sets the state of point cloud mode
Gets the list of prepass texture required
Outputs written to the prepass
Gets the current transparency mode.
Sets the transparency mode of the material.
Value | Type | Description |
---|---|---|
0 | OPAQUE | |
1 | ALPHATEST | |
2 | ALPHABLEND | |
3 | ALPHATESTANDBLEND |
Sets the state of wireframe mode
Add a new block to the list of output nodes
the current material
defines the node to add
This allows you to modify the material without marking it as dirty after every change. This function should be used if you need to make more than one dirty-enabling change to the material - adding a texture, setting a new fill mode and so on. The callback will pass the material as an argument, so you can make your changes to it.
the callback to be executed that will update the material
Binds the submesh to this material by preparing the effect and shader to draw
defines the world transformation matrix
defines the mesh containing the submesh
defines the submesh to bind the material to
Build the material and generates the inner effect
Optional
verbose: booleandefines if the build should log activity
Optional
updateBuildId: booleandefines if the internal build Id should be updated (default is true)
Optional
autoConfigure: booleandefines if the autoConfigure method should be called when initializing blocks (default is false)
Makes a duplicate of the current material.
defines the name to use for the new material
Optional
shareEffect: booleandefines if the clone material should share the same effect (default is false)
Create the effect to be used as the custom effect for a particle system
Particle system to create the effect for
Optional
onCompiled: ((effect: Effect) => void)defines a function to call when the effect creation is successful
Optional
onError: ((effect: Effect, errors: string) => void)defines a function to call when the effect creation has failed
Create a post process from the material
the post process created
The camera to apply the render pass to.
Optional
options: number | PostProcessOptionsThe required width/height ratio to downsize to before computing the render pass. (Use 1.0 for full size)
Optional
samplingMode: numberThe sampling mode to be used when computing the pass. (default: 0)
Optional
engine: EngineThe engine which the post process will be applied. (default: current engine)
Optional
reusable: booleanIf the post process can be reused on the same frame. (default: false)
Optional
textureType: numberType of textures used when performing the post process. (default: 0)
Optional
textureFormat: numberFormat of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)
Create a new procedural texture based on this node material
the new procedural texture attached to this node material
defines the size of the texture
defines the hosting scene
Disposes the material
Optional
forceDisposeEffect: booleanspecifies if effects should be forcefully disposed
Optional
forceDisposeTextures: booleanspecifies if textures should be forcefully disposed
Optional
notBoundToMesh: booleanspecifies if the material that is being disposed is known to be not bound to any mesh
Force shader compilation
defines the mesh associated with this material
Optional
onCompiled: ((material: Material) => void)defines a function to execute once the material is compiled
Optional
options: Partial<IMaterialCompilationOptions>defines the options to configure the compilation
Optional
onError: ((reason: string) => void)defines a function to execute if the material fails compiling
Force shader compilation
a promise that resolves when the compilation completes
defines the mesh that will use this material
Optional
options: Partial<IMaterialCompilationOptions>defines additional options for compiling the shaders
Gets the meshes bound to the material
an array of meshes bound to the material
Get a block by its name
the required block or null if not found
defines the predicate used to find the good candidate
Get an input block by its name
the required input block or null if not found
defines the predicate used to find the good candidate
Optional
mesh: AbstractMeshOptional
useInstances: booleanGet if the submesh is ready to be used and all its information available. Child classes can use it to update shaders
a boolean indicating that the submesh is ready or not
defines the mesh to check
defines which submesh to check
Optional
useInstances: booleanspecifies that instances should be used
Loads the current Node Material from a url pointing to a file save by the Node Material Editor
Please use NodeMaterial.ParseFromFileAsync instead
a promise that will fulfil when the material is fully loaded
defines the url to load from
Optional
rootUrl: stringdefines the root URL for nested url in the node material
Clear the current graph and load a new one from a serialization object
Please use the parseSerializedObject method instead
defines the JSON representation of the material
Optional
rootUrl: stringdefines the root URL to use to load textures and relative dependencies
Optional
merge: booleandefines whether or not the source must be merged or replace the current content
Marks the material to indicate that it needs to be re-calculated
Optional
forceMaterialDirty: booleanForces the material to be marked as dirty for all components (same as this.markAsDirty(Material.AllDirtyFlag)). You should use this flag if the material is frozen and you want to force a recompilation.
Specifies if the mesh will require alpha blending
a boolean specifying if alpha blending is needed for the mesh
defines the mesh to check
Clear the current graph and load a new one from a serialization object
defines the JSON representation of the material
Optional
rootUrl: stringdefines the root URL to use to load textures and relative dependencies
Optional
merge: booleandefines whether or not the source must be merged or replace the current content
Adds a new optimizer to the list of optimizers
the current material
defines the optimizers to add
Remove a block from the list of root nodes
the current material
defines the node to remove
Remove an optimizer from the list of optimizers
the current material
defines the optimizers to remove
Static
CreateCreates a new node material set to default basic configuration
a new NodeMaterial
defines the name of the material
Optional
scene: Scenedefines the hosting scene
Static
ParseCreates a node material from parsed material data
a new node material
defines the JSON representation of the material
defines the hosting scene
Optional
rootUrl: stringdefines the root URL to use to load textures and relative dependencies
Static
ParseCreates a node material from a snippet saved in a remote file
a promise that will resolve to the new node material
defines the name of the material to create
defines the url to load from
defines the hosting scene
Optional
rootUrl: stringdefines the root URL for nested url in the node material
Optional
skipBuild: booleandefines whether to build the node material
Optional
targetMaterial: NodeMaterialdefines a material to use instead of creating a new one
Static
ParseCreates a node material from a snippet saved by the node material editor
a promise that will resolve to the new node material
defines the snippet to load
Optional
scene: Scenedefines the hosting scene
Optional
rootUrl: stringdefines the root URL to use to load textures and relative dependencies
Optional
nodeMaterial: NodeMaterialdefines a node material to update (instead of creating a new one)
Optional
skipBuild: booleandefines whether to build the node material
Optional
waitForTextureReadyness: booleandefines whether to wait for texture readiness resolving the promise (default: false)
Static
_Generated using TypeDoc
Class used to create a node based material built by assembling shader blocks