Optionalscene: SceneProtected Optional_Protected_Protected_Specifies if back face culling is enabled
Protected_Protected_Specifies if back or front faces should be culled (when culling is enabled)
Protected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_Protected_Shader language used by the material
Protected_The transparency mode of the material.
Protected_Protected_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)
Defines the alpha limits in alpha test mode.
The color of the material lit by the environmental background lighting.
AKA Occlusion Texture in other nomenclature, it helps adding baked shadows into your material.
Stores the animations for the material
If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
Bump mapping is a technique to simulate bump and dents on a rendered surface. These are made by creating a normal map from an image. The means to do this can be found on the web, a search for 'normal map generator' will bring up free and paid for methods of doing this.
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.
Defines the decal map parameters for the material.
Specifies the depth function that should be used. 0 means the default engine function
ReadonlydetailDefines the detail map parameters for the material.
The basic color of the material as viewed under a light.
Define the diffuse fresnel parameters of the material.
The basic texture of the material as viewed under a light.
Specifies if color writing should be disabled
Specifies if depth writing should be disabled
Does lights from the scene impacts this material. It can be a nice trick for performance to disable lighting on a fully emissive material.
Specifies if the material should be serialized
Define the color of the material as if self lit. This will be mixed in the final result even in the absence of light.
Define the emissive fresnel parameters of the material.
Define texture of the material as if self lit. This will be mixed in the final result even in the absence of light.
Specifies if depth writing should be forced
Callback triggered to get the render target textures
The ID of the material
In case of refraction, define the value of the index of refraction.
List of inspectable custom properties (used by the Inspector)
If sets to true, x component of normal map value will invert (x = 1.0 - x).
If sets to true, y component of normal map value will invert (y = 1.0 - y).
Invert the refraction texture alongside the y axis. It can be useful with procedural textures or probe for instance.
ReadonlyisComplex lighting can be computationally expensive to compute at runtime. To save on computation, lightmaps may be used to store calculated lighting in a texture which will be applied to a given mesh.
If true, some kind of energy conservation will prevent the end result to be more than 1 by reducing the emissive level when the final color is close to one.
Defines the maximum number of lights that can be used in the material
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
Define the opacity fresnel parameters of the material.
Define the transparency of the material from a texture. The final alpha value can be read either from the red channel (if texture.getAlphaFromRGB is false) or from the luminance or the current texel (if texture.getAlphaFromRGB is true)
Apply a scaling factor that determine which "depth" the height map should reprensent. A value between 0.05 and 0.1 is reasonnable in Parallax, you can reach 0.2 using Parallax Occlusion.
OptionalpluginPlugin manager for this material
Stores the size of points
ReadonlypreDefines additional PrePass parameters for the material.
Define the reflection fresnel parameters of the material.
Define the texture used to display the reflection.
Define the refraction fresnel parameters of the material.
Define the texture used to display the refraction.
For internal use only. Please do not use.
Helps to define how blurry the reflections should appears in the material.
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
Define how the color and intensity of the highlight given by the light in the material.
Defines how sharp are the highlights in the material. The bigger the value the sharper giving a more glossy feeling to the result. Reversely, the smaller the value the blurrier giving a more rough feeling to the result.
Define how the color and intensity of the highlight given by the light in the material.
The state of the material
ReadonlystencilGives access to the stencil properties of the material
If sets to true and backfaceCulling is false, normals will be flipped on the backside.
Gets or sets the unique id of the material
Does the transparency come from the diffuse texture alpha channel.
If true, the emissive value is added into the end result, otherwise it is multiplied in.
Defines if the glossiness/roughness of the material should be read from the specular map alpha channel
In case of light mapping, define whether the map contains light or shadow informations.
Allows using an object space normal map (instead of tangent space).
Is parallax enabled or not.
Is parallax occlusion enabled or not. If true, the outcome is way more realistic than traditional Parallax but you can expect a performance hit that worthes consideration.
If true automatically deducts the fresnels values from the material specularity.
Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones). A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.
Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones). A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.
Stores the z offset Factor value
Stores the z offset Units value
Static ReadonlyAllThe all dirty flag value
Static ReadonlyAttributesThe dirty attribute flag value
Static ReadonlyClockStores the clock-wise side orientation
Static ReadonlyCounterStores the counter clock-wise side orientation
StaticForceForce all the standard materials to compile to glsl even on WebGPU engines. False by default. This is mostly meant for backward compatibility.
StaticForceIf true, all materials will have their vertex output set to invariant (see the vertexOutputInvariant property).
Static ReadonlyFresnelThe dirty fresnel flag value
Static ReadonlyImageThe dirty image processing flag value
Static ReadonlyLightThe dirty light flag value
Static ReadonlyLIGHTFALLOFF_PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.
Static ReadonlyLIGHTFALLOFF_PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.
Static ReadonlyLIGHTFALLOFF_PBRMaterialLightFalloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.
Static ReadonlyLineReturns the line list draw mode
Static ReadonlyLineReturns the line loop draw mode
Static ReadonlyLineReturns the line strip draw mode
Static ReadonlyMATERIAL_MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
Static ReadonlyMATERIAL_MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
Static ReadonlyMATERIAL_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 ReadonlyMATERIAL_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 ReadonlyMATERIAL_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 ReadonlyMATERIAL_MaterialTransparencyMode: No transparency mode, Alpha channel is not use.
Static ReadonlyMiscThe dirty misc flag value
StaticOnEvent observable which raises global events common to all materials (like MaterialPluginEvent.Created)
Static ReadonlyPointReturns the point fill mode
Static ReadonlyPointReturns the point list draw mode
Static ReadonlyPreThe dirty prepass flag value
Static ReadonlyTextureThe dirty texture flag value
Static ReadonlyTriangleReturns the triangle fan draw mode
Static ReadonlyTriangleReturns the triangle fill mode
Static ReadonlyTriangleReturns the triangle strip draw mode
Static ReadonlyWireReturns the wireframe mode
Protected_Returns true if alpha blending should be disabled.
Protected_Protected_Protected_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 | Defines that alpha blending is COLOR=SRC_ALPHA * SRC + DEST, ALPHA=DEST_ALPHA |
| 2 | ALPHA_COMBINE | Defines that alpha blending is COLOR=SRC_ALPHA * SRC + (1 - SRC_ALPHA) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA |
| 3 | ALPHA_SUBTRACT | Defines that alpha blending is COLOR=(1 - SRC) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA |
| 4 | ALPHA_MULTIPLY | Defines that alpha blending is COLOR=DEST * SRC, ALPHA=SRC_ALPHA + DEST_ALPHA |
| 5 | ALPHA_MAXIMIZED | Defines that alpha blending is COLOR=SRC_ALPHA * SRC + (1 - SRC) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA |
| 6 | ALPHA_ONEONE | Defines that alpha blending is COLOR=SRC + DEST, ALPHA=DEST_ALPHA |
| 7 | ALPHA_PREMULTIPLIED | Defines that alpha blending is COLOR=SRC + (1 - SRC_ALPHA) * DEST, ALPHA=SRC_ALPHA + DEST_ALPHA |
| 8 | ALPHA_PREMULTIPLIED_PORTERDUFF | Defines that alpha blending is COLOR=SRC + (1 - SRC_ALPHA) * DEST, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA |
| 9 | ALPHA_INTERPOLATE | Defines that alpha blending is COLOR=CST * SRC + (1 - CST) * DEST, ALPHA=CST_ALPHA * SRC + (1 - CST_ALPHA) * DEST_ALPHA |
| 10 | ALPHA_SCREENMODE | Defines that alpha blending is COLOR=SRC + (1 - SRC) * DEST, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA |
| 11 | ALPHA_ONEONE_ONEONE | Defines that alpha blending is COLOR=SRC + DST, ALPHA=SRC_ALPHA + DEST_ALPHA |
| 12 | ALPHA_ALPHATOCOLOR | Defines that alpha blending is COLOR=DEST_ALPHA * SRC + DST, ALPHA=0 |
| 13 | ALPHA_REVERSEONEMINUS | Defines that alpha blending is COLOR=(1 - DEST) * SRC + (1 - SRC) * DEST, ALPHA=(1 - DEST_ALPHA) * SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA |
| 14 | ALPHA_SRC_DSTONEMINUSSRCALPHA | Defines that alpha blending is ALPHA=SRC + (1 - SRC ALPHA) * DEST, ALPHA=SRC_ALPHA + (1 - SRC ALPHA) * DEST_ALPHA |
| 15 | ALPHA_ONEONE_ONEZERO | Defines that alpha blending is COLOR=SRC + DST, ALPHA=SRC_ALPHA |
| 16 | ALPHA_EXCLUSION | Defines that alpha blending is COLOR=(1 - DEST) * SRC + (1 - SRC) * DEST, ALPHA=DEST_ALPHA |
| 17 | ALPHA_LAYER_ACCUMULATE | Defines that alpha blending is COLOR=SRC_ALPHA * SRC + (1 - SRC ALPHA) * DEST, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA |
| 18 | ALPHA_MIN | Defines that alpha blending is COLOR=MIN(SRC, DEST), ALPHA=MIN(SRC_ALPHA, DEST_ALPHA) |
| 19 | ALPHA_MAX | Defines that alpha blending is COLOR=MAX(SRC, DEST), ALPHA=MAX(SRC_ALPHA, DEST_ALPHA) |
| 20 | ALPHA_DUAL_SRC0_ADD_SRC1xDST | Defines that alpha blending uses dual source blending and is COLOR=SRC + SRC1 * DEST, ALPHA=DST_ALPHA |
Gets the list of alpha modes (length greater than 1 for multi-targets)
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.
Can this material render to several textures at once
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 or sets the vertex output invariant state Setting this property to true will force the shader compiler to disable some optimization to make sure the vertex output is always calculated the same way across different compilation units. You may need to enable this option if you are seeing some depth artifacts when using a depth pre-pass, for e.g. Note that this may have an impact on performance, so leave this option disabled if not needed.
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
An event triggered when the material is unbound
Gets the value specifying if point clouds are enabled
Sets the state of point cloud mode
Gets the shader language used in this material.
Gets the current transparency mode.
Sets the transparency mode of the material.
| Value | Type | Description |
|---|---|---|
| 0 | OPAQUE | |
| 1 | ALPHATEST | |
| 2 | ALPHABLEND | |
| 3 | ALPHATESTANDBLEND |
In case the depth buffer does not allow enough depth precision for your scene (might be the case in large scenes) You can try switching to logarithmic depth.
Tells the engine to draw geometry using vertex pulling instead of index drawing. This will automatically set the vertex buffers as storage buffers and make them accessible to the vertex shader (WebGPU only).
Sets the state of wireframe mode
StaticAmbientAre ambient textures enabled in the application.
StaticBumpAre bump textures enabled in the application.
StaticColorAre color grading textures enabled in the application.
StaticDetailAre detail textures enabled in the application.
StaticDiffuseAre diffuse textures enabled in the application.
StaticEmissiveAre emissive textures enabled in the application.
StaticFresnelAre fresnels enabled in the application.
StaticLightmapAre lightmap textures enabled in the application.
StaticOpacityAre opacity textures enabled in the application.
StaticReflectionAre reflection textures enabled in the application.
StaticRefractionAre refraction textures enabled in the application.
StaticSpecularAre specular textures enabled in the application.
Protected_Processes to execute after binding the material to a mesh
Optionalmesh: AbstractMeshdefines the rendered mesh
Optionaleffect: Effectdefines the effect used to bind the material
OptionalsubMesh: SubMeshProtected_Protected_Protected_whether or not there is a usable alpha channel for transparency.
Protected_Protected_Indicates that we need to re-calculated for all submeshes
Protected_Indicates that attributes need to be re-calculated for all submeshes
Protected_Marks all submeshes of a material to indicate that their material defines need to be re-calculated
defines a function which checks material defines against the submeshes
Protected_Indicates that fresnel and misc need to be re-calculated for all submeshes
Protected_Indicates that fresnel needs to be re-calculated for all submeshes
Protected_Indicates that image processing needs to be re-calculated for all submeshes
Protected_Indicates that lights need to be re-calculated for all submeshes
Protected_Indicates that misc needs to be re-calculated for all submeshes
Protected_Indicates that prepass needs to be re-calculated for all submeshes
Protected_Indicates that textures and misc need to be re-calculated for all submeshes
Protected_Indicates that textures need to be re-calculated for all submeshes
Protected_Indicates that the scene should check if the rendering now needs a prepass
Protected_Protected_Protected_whether or not the alpha value of the diffuse texture should be used for alpha blending.
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 material to the mesh
defines the world transformation matrix
Optionalmesh: Meshdefines the mesh to bind the material to
Binds the view matrix to the effect
defines the effect to bind the view matrix to
OptionalvariableName: stringname of the shader variable that will hold the eye position
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
Binds the given normal matrix to the active effect
the matrix to bind
Binds the given world matrix to the active effect
the matrix to bind
Binds the view matrix to the effect
defines the effect to bind the view matrix to
Binds the view projection and projection matrices to the effect
defines the effect to bind the view projection and projection matrices to
Builds the material UBO layouts. Used internally during the effect preparation.
Makes a duplicate of the material, and gives it a new name
defines the new name for the duplicated material
OptionalcloneTexturesOnlyOnce: booleanif a texture is used in more than one channel (e.g diffuse and opacity), only clone it once and reuse it on the other channels. Default false.
OptionalrootUrl: stringdefines the root URL to use to load textures
the cloned material
Disposes the material
OptionalforceDisposeEffect: booleanspecifies if effects should be forcefully disposed
OptionalforceDisposeTextures: booleanspecifies if textures should be forcefully disposed
Force shader compilation
defines the mesh associated with this material
OptionalonCompiled: (material: Material) => voiddefines a function to execute once the material is compiled
Optionaloptions: Partial<IMaterialCompilationOptions>defines the options to configure the compilation
OptionalonError: (reason: string) => voiddefines a function to execute if the material fails compiling
Force shader compilation
defines the mesh that will use this material
Optionaloptions: Partial<IMaterialCompilationOptions>defines additional options for compiling the shaders
a promise that resolves when the compilation completes
Locks updates for the material.
Note: while a material is frozen, the scene can still rebind it at least once per camera render (and again whenever another material was bound in between). What can be skipped while the frozen material stays cached are per-mesh updates performed during a rebind.
This includes per-mesh morph target influences. If the same frozen material is shared across several meshes that each have different per-mesh morph influences, only the mesh that triggers the rebind updates those values. Other meshes rendered afterward with the same cached frozen material may reuse stale influences and render with the wrong values.
For that scenario either keep the material unfrozen, clone the material
per mesh and freeze each clone, or unfreeze() before changing
influences and freeze() again afterwards.
Gets the active textures from the material
an array of textures
Get the texture used for alpha test purpose.
the diffuse texture in case of the standard material.
Get the list of animatables in the material.
the list of animatables object used in the material
Gets the meshes bound to the material
an array of meshes bound to the material
Gets the current class name of the material e.g. "StandardMaterial" Mainly use in serialization.
the class name
Returns the material effect
the effect associated with the material
Returns the current scene
a Scene
Specifies if the material uses a texture
defines the texture to check against the material
a boolean specifying if the material uses the texture
Specifies if the material is ready to be used
Optionalmesh: AbstractMeshdefines the mesh to check
OptionaluseInstances: booleanspecifies if instances should be used
a boolean indicating if the material is ready to be used
Get if the submesh is ready to be used and all its information available. Child classes can use it to update shaders
defines the mesh to check
defines which submesh to check
OptionaluseInstances: booleanspecifies that instances should be used
a boolean indicating that the submesh is ready or not
Marks a define in the material to indicate that it needs to be re-computed
defines a flag used to determine which parts of the material have to be marked as dirty
Marks the material to indicate that it needs to be re-calculated
OptionalforceMaterialDirty: 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 material will require alpha blending
a boolean specifying if alpha blending is needed
Specifies if the mesh will require alpha blending
defines the mesh to check
a boolean specifying if alpha blending is needed for the mesh
Specifies if this material should be rendered in alpha test mode
a boolean specifying if an alpha test is needed.
Specifies if material alpha testing should be turned on for the mesh
defines the mesh to check
a boolean specifying if alpha testing should be turned on for the mesh
Resets the draw wrappers cache for all submeshes that are using this material
Serializes this material
the serialized material object
Sets the value of the alpha mode for a specific target index.
The alpha mode value to set.
OptionaltargetIndex: numberThe index of the target to set the alpha mode for. Defaults to 0.
Sets the required values to the prepass renderer.
defines the prepass renderer to setup.
true if the pre pass is needed.
Returns a string representation of the current material
OptionalfullDetails: booleandefines a boolean indicating which levels of logging is desired
a string with material information
Unbinds the material from the mesh
Unlocks updates for the material
Protected Static_StaticParseCreates a standard material from parsed material data
defines the JSON representation of the material
defines the hosting scene
defines the root URL to use to load textures and relative dependencies
a new standard material
StaticParseParses the alpha mode from the material data to parse
defines the material data to parse
defines the material to update
The alpha value of the material