Instantiates a new PBRMaterial instance.
The material name
Optional
scene: SceneThe scene the material will be use in.
AKA Diffuse Color in other nomenclature.
AKA Diffuse Texture in standard nomenclature.
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 a material in ambient lighting.
AKA Occlusion Texture in other nomenclature.
Defines how much the AO map is occluding the analytical lights (point spot...). 1 means it completely occludes it 0 mean it has no impact
AKA Occlusion Texture Intensity in other nomenclature.
Stores the animations for the material
Readonly
anisotropyDefines the anisotropic parameters for the material.
If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
Readonly
brdfDefines the BRDF parameters for the material.
Stores surface normal data used to displace a mesh in a texture.
Specifies if the ready state should be checked on each call
Specifies if the ready state should be checked once
Readonly
clearDefines the clear coat layer parameters for the material.
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.
Intensity of the direct lights e.g. the four lights available in your scene. This impacts both the direct diffuse and specular highlights.
Debug Control allowing disabling the bump map on this material.
Specifies if color writing should be disabled
Specifies if depth writing should be disabled
If sets to true, disables all the lights affecting the material.
Specifies if the material should be serialized
The color emitted from the material.
Intensity of the emissive part of the material. This helps controlling the emissive effect without modifying the emissive color.
Stores the emissive values in a texture.
Enables specular anti aliasing in the PBR shader. It will both interacts on the Geometry for analytical and IBL lighting. It also prefilter the roughness map based on the bump values.
Let user defines the brdf lookup texture used for IBL. A default 8bit version is embedded but you could point at :
Intensity of the environment e.g. how much the environment will light the object either through harmonics for rough material or through the reflection for shiny ones.
Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.
Specifies if depth writing should be forced
Force the shader to compute irradiance in the fragment shader in order to take bump in account.
Force normal to face away from face.
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
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).
Readonly
iridescenceDefines the iridescence layer parameters for the material.
Stores the pre-calculated light information of a mesh in a texture.
Number of Simultaneous lights allowed on the material.
Gets or sets user defined metadata
Specifies the metallic scalar of the metallic/roughness workflow. Can also be used to scale the metalness values of the metallic texture.
In metallic workflow, specifies an F0 factor to help configuring the material F0. By default the indexOfrefraction is used to compute F0;
This is used as a factor against the default reflectance at normal incidence to tweak it.
F0 = defaultF0 * metallicF0Factor * metallicReflectanceColor; F90 = metallicReflectanceColor;
In metallic workflow, specifies an F0 color. By default the F90 is always 1;
Please note that this factor is also used as a factor against the default reflectance at normal incidence.
F0 = defaultF0_from_IOR * metallicF0Factor * metallicReflectanceColor F90 = metallicF0Factor;
Defines to store metallicReflectanceColor in RGB and metallicF0Factor in A This is multiplied against the scalar values defined in the material. If useOnlyMetallicFromMetallicReflectanceTexture is true, don't use the RGB channels, only A
Used to switch from specular/glossiness to metallic/roughness workflow.
AKA Glossiness in other nomenclature.
Used to enable roughness/glossiness fetch from a separate channel depending on the current mode. Gray Scale represents roughness in metallic mode and glossiness in specular mode.
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
Stores the alpha values in a texture. Use luminance if texture.getAlphaFromRGB is true.
Controls the scale bias of the parallax mode.
Optional
pluginPlugin manager for this material
Stores the size of points
Readonly
preDefines additional PrePass parameters for the material.
Defines to store reflectanceColor in RGB This is multiplied against the scalar values defined in the material. If both reflectanceTexture and metallicReflectanceTexture textures are provided and useOnlyMetallicFromMetallicReflectanceTexture is false, metallicReflectanceTexture takes priority and reflectanceTexture is not used
The color reflected from the material.
Stores the reflection values in a texture.
AKA Specular Color in other nomenclature.
AKA Specular texture in other nomenclature.
For internal use only. Please do not use.
Specifies the roughness scalar of the metallic/roughness workflow. Can also be used to scale the roughness values of the metallic texture.
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
Readonly
sheenDefines the Sheen parameters for the material.
Stores the value for side orientation
This is a special control allowing the reduction of the specular highlights coming from the four lights of the scene. Those highlights may not be needed in full environment lighting.
The state of the material
Readonly
stencilGives access to the stencil properties of the material
Readonly
subDefines the SubSurface parameters for 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
If set to true, no lighting calculations will be applied.
A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested. And/Or occlude the blended part. (alpha is converted to gamma to compute the fresnel)
Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.
Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
Specifies if the metallic texture contains the ambient occlusion information in its red channel.
In case the reflectivity map does not contain the microsurface information in its alpha channel, The material will try to infer what glossiness each pixel should be.
This parameters will enable/disable Horizon occlusion to prevent normal maps to look shiny when the normal makes the reflect vector face the model (under horizon).
If true, the light map contains occlusion information instead of lighting info.
A fresnel is applied to the alpha of the model to ensure grazing angles edges are not alpha tested. And/Or occlude the blended part. (alpha stays linear to compute the fresnel)
Specifies if the metallic texture contains the metallness information in its blue channel.
Specifies if the reflectivity texture contains the glossiness information in its alpha channel.
Allows using an object space normal map (instead of tangent space).
Specifies that only the A channel from metallicReflectanceTexture should be used. If false, both RGB and A channels will be used
Allows using the bump map in parallax mode.
Allows using the bump map in parallax occlusion mode.
This parameters will enable/disable radiance occlusion by preventing the radiance to lit too much the area relying on ambient texture to define their ambient occlusion.
Specifies that the material will keeps the reflection highlights over a transparent surface (only the most luminous ones). A car glass is a good example of that. When the street lights reflects on it you can not see what is behind.
Specifies if the metallic texture contains the roughness information in its alpha channel.
Specifies if the metallic texture contains the roughness information in its green channel.
Specifies that the material will keep the specular highlights over a transparent surface (only the most luminous ones). A car glass is a good example 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
DEFAULT_Defines the default value of how much AO map is occluding the analytical lights (point spot...).
Static
Readonly
FresnelThe dirty fresnel flag value
Static
Readonly
LIGHTFALLOFF_PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.
Static
Readonly
LIGHTFALLOFF_PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.
Static
Readonly
LIGHTFALLOFF_PBRMaterialLightFalloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.
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
PBRMATERIAL_PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
Static
Readonly
PBRMATERIAL_PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
Static
Readonly
PBRMATERIAL_PBRMaterialTransparencyMode: 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
PBRMATERIAL_PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.
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 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.
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.
Index of refraction of the material base layer. https://en.wikipedia.org/wiki/List_of_refractive_indices
This does not only impact refraction but also the Base F0 of Dielectric Materials.
From dielectric fresnel rules: F0 = square((iorT - iorI) / (iorT + iorI))
Controls if refraction needs to be inverted on Y. This could be useful for procedural texture.
Specifies if updates for the material been locked
Can this material render to prepass
This parameters will make the material used its opacity to control how much it is refracting against not. Materials half opaque for instance using refraction could benefit from this control.
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
Enables realtime filtering on the texture.
Quality switch for realtime filtering
Stores the refracted light information in a texture.
Gets the current transparency mode.
Sets the transparency mode of the material.
Value | Type | Description |
---|---|---|
0 | OPAQUE | |
1 | ALPHATEST | |
2 | ALPHABLEND | |
3 | ALPHATESTANDBLEND |
In order to support the falloff compatibility with gltf, a special mode has been added to reproduce the gltf light falloff.
In order to support the falloff compatibility with gltf, a special mode has been added to reproduce the gltf light falloff.
Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.
Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.
BJS is using an hardcoded light falloff based on a manually sets up range. In PBR, one way to represents the falloff is to use the inverse squared root algorithm. This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
BJS is using an hardcoded light falloff based on a manually sets up range. In PBR, one way to represents the falloff is to use the inverse squared root algorithm. This parameter can help you switch back to the BJS mode in order to create scenes using both materials.
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.
the callback to be executed that will update the material
Makes a duplicate of the current material.
name to use for the new 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
Force shader compilation
Optional
onCompiled: ((material: Material) => void)Optional
options: Partial<IMaterialCompilationOptions>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: booleanSpecifies that the submesh is ready to be used.
BJS mesh.
A submesh of the BJS mesh. Used to check if it is ready.
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
ParseParses a PBR Material from a serialized object.
Serialized object.
BJS scene instance.
url for the scene object
Generated using TypeDoc
The Physically based material of BJS.
This offers the main features of a standard PBR material. For more information, please refer to the documentation : https://doc.babylonjs.com/features/featuresDeepDive/materials/using/introToPBR