Instantiates a new standard material. This is the default material used in Babylon. It is the best trade off between quality and performances.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
Define the name of the material in the scene
Optional
scene: SceneDefine the scene the material belong to
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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/moreMaterials#bump-map
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: ICustomShaderNameResolveOptionsDefines the decal map parameters for the material.
Specifies the depth function that should be used. 0 means the default engine function
Readonly
detailDefines 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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
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)
https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
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.
Complex 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.
https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction#lightmaps
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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
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.
Optional
pluginPlugin manager for this material
Stores the size of points
Readonly
preDefines additional PrePass parameters for the material.
Define the reflection fresnel parameters of the material.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
Define the texture used to display the reflection.
Define the refraction fresnel parameters of the material.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
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
Readonly
stencilGives 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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/parallaxMapping
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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/parallaxMapping
If true automatically deducts the fresnels values from the material specularity.
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/fresnelParameters
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
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.
The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT). They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects. These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image; corresponding to low luminance, medium luminance, and high luminance areas respectively.
The color grading curves provide additional color adjustment that is applied after any color grading transform (3D LUT). They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects. These are similar to controls found in many professional imaging or colorist software. The global controls are applied to the entire image. For advanced tuning, extra controls are provided to adjust the shadow, midtone and highlight areas of the image; corresponding to low luminance, medium luminance, and high luminance areas respectively.
Gets whether the color curves effect is enabled.
Sets whether the color curves effect is enabled.
Gets whether the color grading effect is enabled.
Gets whether the color grading effect is enabled.
Gets the Color Grading 2D Lookup Texture.
Sets the Color Grading 2D Lookup Texture.
Gets The camera contrast used on this material.
Sets The camera contrast used on this material.
The camera exposure used on this material. This property is here and not in the camera to allow controlling exposure without full screen post process. This corresponds to a photographic exposure.
The camera exposure used on this material. This property is here and not in the camera to allow controlling exposure without full screen post process. This corresponds to a photographic exposure.
Gets whether tonemapping is enabled or not.
Sets whether tonemapping is enabled or not
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
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 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 |
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.
https://doc.babylonjs.com/features/featuresDeepDive/materials/advanced/logarithmicDepthBuffer
Sets the state of wireframe mode
Static
AmbientAre ambient textures enabled in the application.
Static
BumpAre bump textures enabled in the application.
Static
ColorAre color grading textures enabled in the application.
Static
DetailAre detail textures enabled in the application.
Static
DiffuseAre diffuse textures enabled in the application.
Static
EmissiveAre emissive textures enabled in the application.
Static
FresnelAre fresnels enabled in the application.
Static
LightmapAre lightmap textures enabled in the application.
Static
OpacityAre opacity textures enabled in the application.
Static
ReflectionAre reflection textures enabled in the application.
Static
RefractionAre refraction textures enabled in the application.
Static
SpecularAre specular textures enabled in the application.
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
Makes a duplicate of the material, and gives it a new name
the cloned material
defines the new name for the duplicated material
Optional
cloneTexturesOnlyOnce: 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.
Optional
rootUrl: stringdefines the root URL to use to load textures
Disposes the material
Optional
forceDisposeEffect: booleanspecifies if effects should be forcefully disposed
Optional
forceDisposeTextures: booleanspecifies if textures should be forcefully disposed
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
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
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 standard material from parsed material data
a new standard material
defines the JSON representation of the material
defines the hosting scene
defines the root URL to use to load textures and relative dependencies
Generated using TypeDoc
This is the default material used in Babylon. It is the best trade off between quality and performances.
See
https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction