Creates a material instance
defines the name of the material
Optional
scene: Nullable<Scene>defines the scene to reference
Optional
doNotAdd: booleanspecifies if the material should be added to the scene
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
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
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
Specifies if depth writing should be forced
Callback triggered to get the render target textures
The ID of the material
List of inspectable custom properties (used by the Inspector)
https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
Gets or sets user defined metadata
The name of the material
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
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
Readonly
FresnelThe dirty fresnel flag value
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
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.
If the material can be rendered to several textures with MRT extension
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
Specifies if updates for the material been locked
Can this material render to prepass
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 the value specifying if point clouds are enabled
Sets the state of point cloud mode
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
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.
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
Specifies if the material is ready to be used
a boolean indicating if the material is ready to be used
Optional
mesh: AbstractMeshdefines the mesh to check
Optional
useInstances: booleanspecifies if instances should be used
Specifies that the submesh is ready to be used
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
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
Static
ParseCreates a material from parsed material data
a new material
defines parsed material data
defines the hosting scene
defines the root URL to use to load textures
Generated using TypeDoc
Base class for the main features of a material in Babylon.js