Class OpenPBRMaterial
Hierarchy
- OpenPBRMaterialBase
- OpenPBRMaterial
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
Instantiates a new OpenPBRMaterial instance.
Parameters
- name: string
The material name
Optionalscene: SceneThe scene the material will be use in.
- forceGLSL: boolean = false
Use the GLSL code generation for the shader (even on WebGPU). Default is false
Returns OpenPBRMaterial
- name: string
Properties
_ image Processing Configuration
Default configuration related to image processing available in the standard Material.
_ image Processing Observer
Keep track of the image processing observer to allow dispose and replace.
_ use Fuzz Roughness From Texture Alpha
Specifies that the fuzz roughness is stored in the alpha channel of the texture. This is for compatibility with glTF where the fuzz roughness is often stored in the alpha channel of the fuzz color texture.
_ use Subsurface Weight From Texture Alpha
Specifies that the subsurface weight is stored in the alpha channel of the texture. This is for compatibility with glTF where the subsurface weight is stored in the alpha channel of the diffuseTransmissionTexture.
allow Shader Hot Swapping
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)
animations
Stores the animations for the material
check Ready On Every Call
Specifies if the ready state should be checked on each call
check Ready Only Once
Specifies if the ready state should be checked once
clip Plane
Gets or sets the active clipplane 1
clip Plane2
Gets or sets the active clipplane 2
clip Plane3
Gets or sets the active clipplane 3
clip Plane4
Gets or sets the active clipplane 4
clip Plane5
Gets or sets the active clipplane 5
clip Plane6
Gets or sets the active clipplane 6
custom Shader Name Resolve
shaderName: string,
uniforms: string[],
uniformBuffers: string[],
samplers: string[],
defines: string[] | MaterialDefines,
attributes?: string[],
options?: ICustomShaderNameResolveOptions,
) => string
Custom callback helping to override the default shader used in the material.
depth Function
Specifies the depth function that should be used. 0 means the default engine function
disable Color Write
Specifies if color writing should be disabled
disable Depth Write
Specifies if depth writing should be disabled
do Not Serialize
Specifies if the material should be serialized
force Depth Write
Specifies if depth writing should be forced
get Render Target Textures
Callback triggered to get the render target textures
id
The ID of the material
inspectable Custom Properties
List of inspectable custom properties (used by the Inspector)
metadata
Gets or sets user defined metadata
name
The name of the material
on Compiled
Callback triggered when the material is compiled
on Dispose Observable
An event triggered when the material is disposed
on Error
Callback triggered when an error occurs
Optionalplugin Manager
Plugin manager for this material
point Size
Stores the size of points
Readonlypre Pass Configuration
Defines additional PrePass parameters for the material.
reserved Data Store
For internal use only. Please do not use.
separate Culling Pass
Specifies if there should be a separate pass for culling
shadow Depth Wrapper
Custom shadow depth material to use for shadow rendering instead of the in-built one
side Orientation
Stores the value for side orientation
state
The state of the material
Readonlystencil
Gives access to the stencil properties of the material
texture Repetition Hex Tiling Params
Parameters for the hex tiling texture repetition mode (TEXTURE_REPETITION_HEX_TILING). x = rotation strength (0..1, default 1.0) — how much each hex tile is rotated. y = fall-off contrast (0..1, default 0.6) — how much luminance affects blending weight at tile borders. z = exponent (1..20, default 7.0) — controls the sharpness of weight falloff between tiles. w = contrast (0..1, default 0.5) — boost blending contrast via Gain3 (0.5 = neutral, >0.5 = higher contrast).
unique Id
Gets or sets the unique id of the material
use Coat Roughness From Weight Texture
Specifies whether the coat roughness is taken from the same texture as the coat_weight.
z Offset
Stores the z offset Factor value
z Offset Units
Stores the z offset Units value
Static ReadonlyAll Dirty Flag
The all dirty flag value
Static ReadonlyAttributes Dirty Flag
The dirty attribute flag value
Static ReadonlyClock Wise Side Orientation
Stores the clock-wise side orientation
Static ReadonlyCounter Clock Wise Side Orientation
Stores the counter clock-wise side orientation
StaticForce GLSL
Force all the PBR materials to compile to glsl even on WebGPU engines. False by default. This is mostly meant for backward compatibility.
StaticForce Vertex Output Invariant
If true, all materials will have their vertex output set to invariant (see the vertexOutputInvariant property).
Static ReadonlyFresnel Dirty Flag
The dirty fresnel flag value
Static ReadonlyImage Processing Dirty Flag
The dirty image processing flag value
Static ReadonlyLight Dirty Flag
The dirty light flag value
Static ReadonlyLIGHTFALLOFF_ GLTF
PBRMaterialLightFalloff gltf: light is falling off as described in the gltf moving to PBR document to enhance interoperability with other engines.
Static ReadonlyLIGHTFALLOFF_ PHYSICAL
PBRMaterialLightFalloff Physical: light is falling off following the inverse squared distance law.
Static ReadonlyLIGHTFALLOFF_ STANDARD
PBRMaterialLightFalloff Standard: light is falling off like in the standard material to enhance interoperability with other materials.
Static ReadonlyLine List Draw Mode
Returns the line list draw mode
Static ReadonlyLine Loop Draw Mode
Returns the line loop draw mode
Static ReadonlyLine Strip Draw Mode
Returns the line strip draw mode
Static ReadonlyMATERIAL_ ALPHABLEND
MaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.
Static ReadonlyMATERIAL_ ALPHATEST
MaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.
Static ReadonlyMATERIAL_ ALPHATESTANDBLEND
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_ NORMALBLENDMETHOD_ RNM
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_ NORMALBLENDMETHOD_ WHITEOUT
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_ OPAQUE
MaterialTransparencyMode: No transparency mode, Alpha channel is not use.
Static ReadonlyMisc Dirty Flag
The dirty misc flag value
StaticOn Event Observable
Event observable which raises global events common to all materials (like MaterialPluginEvent.Created)
Static ReadonlyPoint Fill Mode
Returns the point fill mode
Static ReadonlyPoint List Draw Mode
Returns the point list draw mode
Static ReadonlyPre Pass Dirty Flag
The dirty prepass flag value
Static ReadonlySSS_ QUALITY_ HIGH
SSS convolution uses 32 samples.
Static ReadonlySSS_ QUALITY_ LOW
SSS convolution uses 8 samples.
Static ReadonlySSS_ QUALITY_ MEDIUM
SSS convolution uses 16 samples (default).
Static ReadonlyTexture Dirty Flag
The dirty texture flag value
Static ReadonlyTriangle Fan Draw Mode
Returns the triangle fan draw mode
Static ReadonlyTriangle Fill Mode
Returns the triangle fill mode
Static ReadonlyTriangle Strip Draw Mode
Returns the triangle strip draw mode
Static ReadonlyWire Frame Fill Mode
Returns the wireframe mode
Accessors
alpha
-
get alpha(): number
Gets the alpha value of the material
Returns number
-
set alpha(value: number): void
Sets the alpha value of the material
Parameters
- value: number
Returns void
alpha Cut Off
Defines the alpha limits in alpha test mode.
alpha Mode
-
get alphaMode(): number
Gets the value of the alpha mode
Returns number
-
set alphaMode(value: number): void
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 21 ALPHA_REPLACE_COLOR Defines that alpha blending is COLOR=SRC, ALPHA=SRC_ALPHA + (1 - SRC_ALPHA) * DEST_ALPHA Parameters
- value: number
Returns void
alpha Modes
-
get alphaModes(): readonly number[]
Gets the list of alpha modes (length greater than 1 for multi-targets)
Returns readonly number[]
ambient Occlusion Texture
Defines the ambient occlusion texture.
apply Decal Map After Detail Map
If sets to true, the decal map will be applied after the detail map. Else, it is applied before (default: false)
back Face Culling
-
get backFaceCulling(): boolean
Gets the culling state
Returns boolean
-
set backFaceCulling(value: boolean): void
Sets the culling state (true to enable culling, false to disable)
Parameters
- value: boolean
Returns void
background Refraction Texture
-
Parameters
- texture: Nullable<BaseTexture>
Returns void
base Color
Color of the base diffuse lobe. See OpenPBR's specs for base_color
base Color Texture
Base Color Texture property. See OpenPBR's specs for base_color
base Diffuse Roughness
Roughness of the diffuse lobe. See OpenPBR's specs for base_diffuse_roughness
base Diffuse Roughness Texture
Roughness texture of the diffuse lobe. See OpenPBR's specs for base_diffuse_roughness
base Metalness
Metalness of the base lobe. See OpenPBR's specs for base_metalness
base Metalness Texture
Metalness texture. See OpenPBR's specs for base_metalness
base Weight
Base Weight is a multiplier on the diffuse and metal lobes. See OpenPBR's specs for base_weight
base Weight Texture
Base Weight is a multiplier on the diffuse and metal lobes. See OpenPBR's specs for base_weight
block Dirty Mechanism
-
get blockDirtyMechanism(): boolean
Block the dirty-mechanism for this specific material When set to false after being true the material will be marked as dirty.
Returns boolean
-
set blockDirtyMechanism(value: boolean): void
Parameters
- value: boolean
Returns void
camera Color Curves
-
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.
Returns Nullable<ColorCurves>
-
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.
Parameters
- value: Nullable<ColorCurves>
Returns void
camera Color Curves Enabled
-
get cameraColorCurvesEnabled(): boolean
Gets whether the color curves effect is enabled.
Returns boolean
-
set cameraColorCurvesEnabled(value: boolean): void
Sets whether the color curves effect is enabled.
Parameters
- value: boolean
Returns void
camera Color Grading Enabled
-
get cameraColorGradingEnabled(): boolean
Gets whether the color grading effect is enabled.
Returns boolean
-
set cameraColorGradingEnabled(value: boolean): void
Gets whether the color grading effect is enabled.
Parameters
- value: boolean
Returns void
camera Color Grading Texture
-
Gets the Color Grading 2D Lookup Texture.
Returns Nullable<BaseTexture>
camera Contrast
-
get cameraContrast(): number
Gets The camera contrast used on this material.
Returns number
-
set cameraContrast(value: number): void
Sets The camera contrast used on this material.
Parameters
- value: number
Returns void
camera Exposure
-
get cameraExposure(): number
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.
Returns number
-
set cameraExposure(value: number): void
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.
Parameters
- value: number
Returns void
camera Tone Mapping Enabled
-
get cameraToneMappingEnabled(): boolean
Gets whether tonemapping is enabled or not.
Returns boolean
-
set cameraToneMappingEnabled(value: boolean): void
Sets whether tonemapping is enabled or not
Parameters
- value: boolean
Returns void
can Render To MRT
-
get canRenderToMRT(): boolean
Can this material render to several textures at once
Returns boolean
coat Color
Defines the color of the clear coat on the surface. See OpenPBR's specs for coat_color
coat Color Texture
Color texture of the clear coat. See OpenPBR's specs for coat_color
coat Darkening
Defines the amount that interreflections within the coat allow the underlying surface to be darkened. A value of 1.0 means that the physically correct amount of darkening is applied, while a value of 0.0 means that no darkening is applied. See OpenPBR's specs for coat_darkening
coat Darkening Texture
Defines the amount that interreflections within the coat allow the underlying surface to be darkened. A value of 1.0 means that the physically correct amount of darkening is applied, while a value of 0.0 means that no darkening is applied. See OpenPBR's specs for coat_darkening
coat Ior
Defines the IOR of the clear coat on the surface. See OpenPBR's specs for coat_ior
coat Roughness
Defines the roughness of the clear coat on the surface. See OpenPBR's specs for coat_roughness
coat Roughness Anisotropy
Defines the anisotropy of the clear coat on the surface. See OpenPBR's specs for coat_roughness_anisotropy
coat Roughness Anisotropy Texture
Anisotropic Roughness texture of the clear coat. See OpenPBR's specs for coat_roughness_anisotropy
coat Roughness Texture
Roughness texture of the clear coat. See OpenPBR's specs for coat_roughness
coat Weight
Defines the amount of clear coat on the surface. See OpenPBR's specs for coat_weight
coat Weight Texture
Coat weight texture. See OpenPBR's specs for coat_weight
cull Back Faces
-
get cullBackFaces(): boolean
Gets the type of faces that should be culled
Returns boolean
-
set cullBackFaces(value: boolean): void
Sets the type of faces that should be culled (true for back faces, false for front faces)
Parameters
- value: boolean
Returns void
direct Intensity
Intensity of the direct lights e.g. the four lights available in your scene. This impacts both the direct diffuse and specular highlights.
disable Lighting
If sets to true, disables all the lights affecting the material.
emission Color
Defines the color of the material's emission. See OpenPBR's specs for emission_color
emission Color Texture
Defines the texture of the material's emission color. See OpenPBR's specs for emission_color
emission Luminance
Defines the luminance of the material's emission. See OpenPBR's specs for emission_luminance
enable Specular Anti Aliasing
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 normalmap values.
environment BRDF Texture
Let user defines the brdf lookup texture used for IBL. A default 8bit version is embedded but you could point at :
- Default texture: https://assets.babylonjs.com/environments/correlatedMSBRDF_RGBD.png
- Default 16bit pixel depth texture: https://assets.babylonjs.com/environments/correlatedMSBRDF.dds
- LEGACY Default None correlated https://assets.babylonjs.com/environments/uncorrelatedBRDF_RGBD.png
- LEGACY Default None correlated 16bit pixel depth https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds
environment Intensity
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.
fill Mode
-
get fillMode(): number
Gets the material fill mode
Returns number
-
set fillMode(value: number): void
Sets the material fill mode
Parameters
- value: number
Returns void
fog Enabled
-
get fogEnabled(): boolean
Gets the value of the fog enabled state
Returns boolean
-
set fogEnabled(value: boolean): void
Sets the state for enabling fog
Parameters
- value: boolean
Returns void
force Alpha Test
Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.
force Irradiance In Fragment
Force the shader to compute irradiance in the fragment shader in order to take normal mapping into account.
force Normal Forward
Force normal to face away from face.
fuzz Color
Defines the color of the fuzz layer on the surface. See OpenPBR's specs for fuzz_color
fuzz Color Texture
Color texture of the fuzz layer. See OpenPBR's specs for fuzz_color
fuzz Roughness
Defines the roughness of the fuzz layer on the surface. See OpenPBR's specs for fuzz_roughness
fuzz Roughness Texture
Roughness texture of the fuzz layer. See OpenPBR's specs for fuzz_roughness
fuzz Sample Number
-
get fuzzSampleNumber(): number
The number of samples used to compute the fuzz IBL lighting.
Returns number
-
set fuzzSampleNumber(n: number): void
Parameters
- n: number
Returns void
fuzz Weight
Defines the weight of the fuzz layer on the surface. See OpenPBR's specs for fuzz_weight
fuzz Weight Texture
Weight texture of the fuzz layer. See OpenPBR's specs for fuzz_weight
geometry Coat Normal Texture
Defines the normal of the material's coat layer. See OpenPBR's specs for geometry_coat_normal
geometry Coat Tangent
Defines the tangent of the material's coat layer. Used only for anisotropic reflections. See OpenPBR's specs for geometry_coat_tangent
geometry Coat Tangent Angle
-
get geometryCoatTangentAngle(): number
Defines the angle of the tangent of the material's coat layer.
Returns number
-
set geometryCoatTangentAngle(value: number): void
Defines the angle of the tangent of the material's coat layer.
Parameters
- value: number
Returns void
geometry Coat Tangent Texture
Defines the tangent of the material's coat layer. Used only for anisotropic reflections. See OpenPBR's specs for geometry_coat_tangent
geometry Normal Texture
Defines the normal of the material's geometry. See OpenPBR's specs for geometry_normal
geometry Opacity
Defines the opacity of the material's geometry. See OpenPBR's specs for geometry_opacity
geometry Opacity Texture
Defines the opacity texture of the material's geometry. See OpenPBR's specs for geometry_opacity
geometry Tangent
Defines the tangent of the material's geometry. Used only for anisotropic reflections. See OpenPBR's specs for geometry_tangent
geometry Tangent Angle
-
get geometryTangentAngle(): number
Defines the angle of the tangent of the material's geometry. Used only for anisotropic reflections. See OpenPBR's specs for geometry_tangent
Returns number
-
set geometryTangentAngle(value: number): void
Parameters
- value: number
Returns void
geometry Tangent Texture
Defines the tangent of the material's geometry. Used only for anisotropic reflections. See OpenPBR's specs for geometry_tangent
geometry Thickness
Defines the thickness of the material's geometry. Not part of OpenPBR's specs but useful for rasterization approximations of volume.
geometry Thickness Texture
Defines the thickness of the material's geometry. Not part of OpenPBR's specs but useful for rasterization approximations of volume.
geometry Thin Walled
Defines whether the geometry is thin-walled (like a sheet of paper) or not. See OpenPBR's specs for geometry_thin_walled
has Render Target Textures
-
get hasRenderTargetTextures(): boolean
Gets a boolean indicating that current material needs to register RTT
Returns boolean
has Scattering
-
get hasScattering(): boolean
Specifies if the material has scattering properties such as subsurface scattering or transmission scattering.
Returns boolean
has Transparency
-
get hasTransparency(): boolean
Specifies if we can see through the surface of the material due to subsurface scattering or transmission.
Returns boolean
image Processing Configuration
-
Gets the image processing configuration used either in this material.
Returns ImageProcessingConfiguration
-
Sets the Default image processing configuration used either in the this material.
If sets to null, the scene one is in use.
Parameters
- value: ImageProcessingConfiguration
Returns void
invert Normal Map X
If sets to true, x component of normal map value will invert (x = 1.0 - x).
invert Normal Map Y
If sets to true, y component of normal map value will invert (y = 1.0 - y).
is Frozen
-
get isFrozen(): boolean
Specifies if updates for the material been locked
Returns boolean
is Pre Pass Capable
-
get isPrePassCapable(): boolean
Can this material render to prepass
Returns boolean
is Vertex Output Invariant
-
get isVertexOutputInvariant(): boolean
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.
Returns boolean
-
set isVertexOutputInvariant(value: boolean): void
Parameters
- value: boolean
Returns void
max Simultaneous Lights
Number of Simultaneous lights allowed on the material.
need Depth Pre Pass
-
get needDepthPrePass(): boolean
Gets the depth pre-pass value
Returns boolean
-
set needDepthPrePass(value: boolean): void
Sets the need depth pre-pass value
Parameters
- value: boolean
Returns void
on Bind
on Bind Observable
-
An event triggered when the material is bound
Returns Observable<AbstractMesh>
on Dispose
-
set onDispose(callback: () => void): void
Called during a dispose event
Parameters
- callback: () => void
Returns void
on Effect Created Observable
-
An event triggered when the effect is (re)created
Returns Observable<{ effect: Effect; subMesh: Nullable<SubMesh> }>
on Un Bind Observable
-
An event triggered when the material is unbound
Returns Observable<Material>
parallax Scale Bias
Controls the scale bias of the parallax mode.
points Cloud
-
get pointsCloud(): boolean
Gets the value specifying if point clouds are enabled
Returns boolean
-
set pointsCloud(value: boolean): void
Sets the state of point cloud mode
Parameters
- value: boolean
Returns void
real Time Filtering
-
get realTimeFiltering(): boolean
Enables realtime filtering on the texture.
Returns boolean
-
set realTimeFiltering(b: boolean): void
Parameters
- b: boolean
Returns void
real Time Filtering Quality
-
get realTimeFilteringQuality(): number
Quality switch for realtime filtering
Returns number
-
set realTimeFilteringQuality(n: number): void
Parameters
- n: number
Returns void
refraction High Quality Blur
-
get refractionHighQualityBlur(): boolean
When true, uses a 4-tap rotated-grid kernel for refractive background blur, eliminating bilinear block artifacts at the cost of 3 extra texture samples. When false, a single dithered sample is used. Default: true.
Returns boolean
-
set refractionHighQualityBlur(value: boolean): void
Parameters
- value: boolean
Returns void
shader Language
-
Gets the shader language used in this material.
Returns ShaderLanguage
specular Color
Color of the specular lobe. See OpenPBR's specs for specular_color
specular Color Texture
Specular Color Texture property. See OpenPBR's specs for specular_color
specular Ior
IOR of the specular lobe. See OpenPBR's specs for specular_ior
specular Roughness
Roughness of the specular lobe. See OpenPBR's specs for specular_roughness
specular Roughness Anisotropy
Anisotropic roughness of the specular lobe. See OpenPBR's specs for specular_roughness_anisotropy
specular Roughness Anisotropy Texture
Anisotropic Roughness texture. See OpenPBR's specs for specular_roughness
specular Roughness Texture
Roughness texture of the specular lobe. See OpenPBR's specs for specular_roughness
specular Weight
Weight of the specular lobe. See OpenPBR's specs for specular_weight
specular Weight Texture
Weight texture of the specular lobe. See OpenPBR's specs for specular_weight
sss Depth Texture
-
Defines the depth texture used for subsurface scattering. This is the depth defined in screen space. If it's not provided, the depth will be looked for in the scene.geometryBufferRenderer. Accepts a ThinTexture so that an InternalTexture obtained from a frame graph handle can be wrapped with
new ThinTexture(internalTexture)and assigned directly. Setting this property marks all sub-meshes as textures-dirty so the shader recompiles.Returns Nullable<ThinTexture>
-
Parameters
- value: Nullable<ThinTexture>
Returns void
sss Irradiance Texture
-
Defines the irradiance texture used for subsurface scattering. If it's not provided, the irradiance will be looked for in the scene.geometryBufferRenderer. Accepts a ThinTexture so that an InternalTexture obtained from a frame graph handle can be wrapped with
new ThinTexture(internalTexture)and assigned directly. Setting this property marks all sub-meshes as textures-dirty so the shader recompiles.Returns Nullable<ThinTexture>
-
Parameters
- value: Nullable<ThinTexture>
Returns void
sss Quality
-
get sssQuality(): number
Controls the sample count of the screen-space SSS convolution kernel. Use the SSS_QUALITY_LOW / MEDIUM / HIGH constants (8 / 16 / 32 samples). Higher quality reduces noise at the cost of GPU time. Default: MEDIUM.
Returns number
-
set sssQuality(value: number): void
Parameters
- value: number
Returns void
subsurface Color
Defines the color of the subsurface scattering in the volume. See OpenPBR's specs for subsurface_color
subsurface Color Texture
Subsurface color texture. See OpenPBR's specs for subsurface_color
subsurface Radius
Defines the radius of the subsurface scattering in the volume. See OpenPBR's specs for subsurface_radius
subsurface Radius Scale
Defines the scale factor applied to the subsurface radius. See OpenPBR's specs for subsurface_radius_scale
subsurface Radius Scale Texture
Subsurface radius scale texture. See OpenPBR's specs for subsurface_radius_scale
subsurface Scatter Anisotropy
Defines the anisotropy of the subsurface scattering in the volume. See OpenPBR's specs for subsurface_scatter_anisotropy
subsurface Weight
Defines the amount of subsurface scattering on the surface. See OpenPBR's specs for subsurface_weight
subsurface Weight Texture
Subsurface weight texture. See OpenPBR's specs for subsurface_weight
texture Repetition Mode
-
get textureRepetitionMode(): number
Gets the texture repetition breaking mode.
Returns number
-
set textureRepetitionMode(value: number): void
Sets the texture repetition breaking mode. Use one of the Constants.TEXTURE_REPETITION_* values to break visible texture tiling patterns. Ordered by cost: NONE (1 fetch), NOISE_BLEND (3), HEX_TILING (3), TILE_RANDOMIZATION (4), VORONOI_BOMBING (9). Not supported on WebGL1 — the mode will be forced to NONE.
Parameters
- value: number
Returns void
thin Film Ior
Defines the index of refraction of the thin film layer.
thin Film Thickness
Defines the thickness of the thin film layer in μm. If a texture is provided for thinFilmWeightTexture, this value will act as a multiplier to the texture values. See OpenPBR's specs for thin_film_thickness
thin Film Thickness Min
Defines the minimum thickness of the thin film layer in μm.
thin Film Thickness Texture
Defines the maximum thickness of the thin film layer in μm.
thin Film Weight
Defines the weight of the thin film layer on top of the base layer for iridescent effects.
thin Film Weight Texture
Thin film weight texture.
transmission Color
Transmission color of the surface. See OpenPBR's specs for transmission_color
transmission Color Texture
Transmission color texture. See OpenPBR's specs for transmission_color
transmission Depth
Transmission depth of the volume See OpenPBR's specs for transmission_depth
transmission Depth Texture
Transmission depth texture. See OpenPBR's specs for transmission_depth
transmission Dispersion Abbe Number
Transmission Dispersion Abbe number. See OpenPBR's specs for transmission_dispersion_abbe_number
transmission Dispersion Scale
Transmission Dispersion Scale factor. See OpenPBR's specs for transmission_dispersion_scale
transmission Dispersion Scale Texture
Transmission Dispersion Scale texture. See OpenPBR's specs for transmission_dispersion_scale
transmission Scatter
Transmission scatter of the surface. See OpenPBR's specs for transmission_scatter
transmission Scatter Anisotropy
Transmission scatter anisotropy See OpenPBR's specs for transmission_scatter_anisotropy
transmission Scatter Texture
Transmission scatter texture. See OpenPBR's specs for transmission_scatter
transmission Weight
Transmission weight of the surface. See OpenPBR's specs for transmission_weight
transmission Weight Texture
Transmission weight texture. See OpenPBR's specs for transmission_weight
transparency Mode
-
get transparencyMode(): number
Gets the current transparency mode.
Returns number
-
set transparencyMode(value: number): void
Gets the current transparency mode.
Parameters
- value: number
Returns void
two Sided Lighting
If sets to true and backfaceCulling is false, normals will be flipped on the backside.
unlit
If set to true, no lighting calculations will be applied.
use Alpha Fresnel
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)
use Ambient In Gray Scale
Specifies if the ambient texture contains the ambient occlusion information in its red channel only.
use Ambient Occlusion From Metallic Texture Red
Specifies if the metallic texture contains the ambient occlusion information in its red channel.
use GLTF Light Falloff
-
get useGLTFLightFalloff(): boolean
In order to support the falloff compatibility with gltf, a special mode has been added to reproduce the gltf light falloff.
Returns boolean
-
set useGLTFLightFalloff(value: boolean): void
In order to support the falloff compatibility with gltf, a special mode has been added to reproduce the gltf light falloff.
Parameters
- value: boolean
Returns void
use Horizon Occlusion
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).
use Linear Alpha Fresnel
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)
use Logarithmic Depth
-
get useLogarithmicDepth(): boolean
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.
Returns boolean
-
set useLogarithmicDepth(value: boolean): void
Parameters
- value: boolean
Returns void
use Object Space Normal Map
Allows using an object space normal map (instead of tangent space).
use Parallax
Allows using the normal map in parallax mode.
use Parallax Occlusion
Allows using the normal map in parallax occlusion mode.
use Physical Light Falloff
-
get usePhysicalLightFalloff(): boolean
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.
Returns boolean
-
set usePhysicalLightFalloff(value: boolean): void
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.
Parameters
- value: boolean
Returns void
use Radiance Occlusion
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.
use Specular Weight From Texture Alpha
Specifies that the specular weight is stored in the alpha channel of the specular weight texture.
use Vertex Pulling
-
get useVertexPulling(): boolean
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).
Returns boolean
-
set useVertexPulling(value: boolean): void
Parameters
- value: boolean
Returns void
wireframe
-
get wireframe(): boolean
Returns boolean
-
set wireframe(value: boolean): void
Sets the state of wireframe mode
Parameters
- value: boolean
Returns void
Methods
_ attach Image Processing Configuration
-
Attaches a new image processing configuration to the Standard Material.
Parameters
- configuration: Nullable<ImageProcessingConfiguration>
Returns void
atomic Materials Update
-
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.
Parameters
- callback: (material: this) => void
the callback to be executed that will update the material
Returns void
- callback: (material: this) => void
bind
bind Eye Position
-
Binds the view matrix to the effect
Parameters
- effect: Effect
defines the effect to bind the view matrix to
OptionalvariableName: stringname of the shader variable that will hold the eye position
Returns void
- effect: Effect
bind For Sub Mesh
bind Only Normal Matrix
-
Binds the given normal matrix to the active effect
Parameters
- normalMatrix: Matrix
the matrix to bind
Returns void
- normalMatrix: Matrix
bind Only World Matrix
-
Binds the given world matrix to the active effect
Parameters
- world: Matrix
the matrix to bind
Returns void
- world: Matrix
bind Properties For Sub Mesh
-
bindPropertiesForSubMesh(
uniformBuffer: UniformBuffer,
scene: Scene,
engine: Engine,
subMesh: SubMesh,
): voidBinds the material data (this function is called even if mustRebind() returns false)
Parameters
- uniformBuffer: UniformBuffer
defines the Uniform buffer to fill in.
- scene: Scene
defines the scene the material belongs to.
- engine: Engine
defines the engine the material belongs to.
- subMesh: SubMesh
the submesh to bind data for
Returns void
- uniformBuffer: UniformBuffer
bind View
-
Binds the view matrix to the effect
Parameters
- effect: Effect
defines the effect to bind the view matrix to
Returns void
- effect: Effect
bind View Projection
-
Binds the view projection and projection matrices to the effect
Parameters
- effect: Effect
defines the effect to bind the view projection and projection matrices to
Returns void
- effect: Effect
build Uniform Layout
-
Initializes the uniform buffer layout for the shader.
Returns void
clone
-
Makes a duplicate of the current material.
Parameters
- name: string
name to use for the new material.
- cloneTexturesOnlyOnce: boolean = true
if a texture is used in more than one channel (e.g baseColor and opacity), only clone it once and reuse it on the other channels. Default false.
- rootUrl: string = ""
defines the root URL to use to load textures
Returns OpenPBRMaterial
cloned material instance
- name: string
dispose
-
Disposes the resources of the material.
Parameters
OptionalforceDisposeEffect: booleanForces the disposal of effects.
OptionalforceDisposeTextures: booleanForces the disposal of all textures.
Returns void
force Compilation
-
forceCompilation(
mesh: AbstractMesh,
onCompiled?: (material: Material) => void,
options?: Partial<IMaterialCompilationOptions>,
): voidForce shader compilation
Parameters
- mesh: AbstractMesh
Define the mesh we want to force the compilation for
OptionalonCompiled: (material: Material) => voidDefine a callback triggered when the compilation completes
Optionaloptions: Partial<IMaterialCompilationOptions>Define the options used to create the compilation
Returns void
- mesh: AbstractMesh
force Compilation Async
-
forceCompilationAsync(
mesh: AbstractMesh,
options?: Partial<IMaterialCompilationOptions>,
): Promise<void>Force shader compilation
Parameters
- mesh: AbstractMesh
defines the mesh that will use this material
Optionaloptions: Partial<IMaterialCompilationOptions>defines additional options for compiling the shaders
Returns Promise<void>
a promise that resolves when the compilation completes
- mesh: AbstractMesh
freeze
-
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 andfreeze()again afterwards.Returns void
get Active Textures
get Alpha Test Texture
-
Gets the texture used for the alpha test
Returns Nullable<BaseTexture>
the texture to use for alpha testing
get Animatables
-
Returns the animatable textures. If material have animatable metallic texture, then reflectivity texture will not be returned, even if it has animations.
Returns IAnimatable[]
- Array of animatable textures.
get Binded Meshes
-
Gets the meshes bound to the material
Returns AbstractMesh[]
an array of meshes bound to the material
get Class Name
-
Returns string
the name of the material class.
get Effect
get Scene
has Texture
-
Checks to see if a texture is used in the material.
Parameters
- texture: BaseTexture
Base texture to use.
Returns boolean
- Boolean specifying if a texture is used in the material.
- texture: BaseTexture
is Ready
-
Specifies if the material is ready to be used
Parameters
Optionalmesh: AbstractMeshdefines the mesh to check
OptionaluseInstances: booleanspecifies if instances should be used
Returns boolean
a boolean indicating if the material is ready to be used
is Ready For Sub Mesh
-
Specifies that the submesh is ready to be used.
Parameters
- mesh: AbstractMesh
BJS mesh.
- subMesh: SubMesh
A submesh of the BJS mesh. Used to check if it is ready.
OptionaluseInstances: booleanSpecifies that instances should be used.
Returns boolean
- boolean indicating that the submesh is ready or not.
- mesh: AbstractMesh
mark As Dirty
-
Marks a define in the material to indicate that it needs to be re-computed
Parameters
- flag: number
defines a flag used to determine which parts of the material have to be marked as dirty
Returns void
- flag: number
mark Dirty
-
Marks the material to indicate that it needs to be re-calculated
Parameters
- forceMaterialDirty: boolean = false
Forces 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.
Returns void
- forceMaterialDirty: boolean = false
need Alpha Blending
-
Returns boolean
true when the material needs alpha blending — i.e. when geometry_opacity < 1 or a geometry opacity texture is present.
need Alpha Blending For Mesh
-
Specifies if the mesh will require alpha blending. Overridden to check geometry_opacity before the _hasTransparencyMode short-circuit in the base class, which would otherwise always return false when _transparencyMode is MATERIAL_OPAQUE.
Parameters
- mesh: AbstractMesh
The mesh to check
Returns boolean
true if alpha blending is needed for the mesh
- mesh: AbstractMesh
need Alpha Testing
need Alpha Testing For Mesh
-
Specifies if material alpha testing should be turned on for the mesh
Parameters
- mesh: AbstractMesh
defines the mesh to check
Returns boolean
a boolean specifying if alpha testing should be turned on for the mesh
- mesh: AbstractMesh
reset Draw Cache
-
Resets the draw wrappers cache for all submeshes that are using this material
Returns void
serialize
-
Serializes this PBR Material.
Returns any
- An object with the serialized material.
set Alpha Mode
-
Sets the value of the alpha mode for a specific target index.
Parameters
- value: number
The alpha mode value to set.
- targetIndex: number = 0
The index of the target to set the alpha mode for. Defaults to 0.
Returns void
- value: number
set Pre Pass Renderer
-
Sets the required values to the prepass renderer. It can't be sets when subsurface scattering of this material is disabled. When scene have ability to enable subsurface prepass effect, it will enable.
Returns boolean
- If prepass is enabled or not.
to String
-
Returns a string representation of the current material
Parameters
OptionalfullDetails: booleandefines a boolean indicating which levels of logging is desired
Returns string
a string with material information
unbind
-
Unbinds the material from the mesh
Returns void
unfreeze
-
Unlocks updates for the material
Returns void
StaticParse
-
Parses a PBR Material from a serialized object.
Parameters
- source: any
Serialized object.
- scene: Scene
BJS scene instance.
- rootUrl: string
url for the scene object
Returns OpenPBRMaterial
- OpenPBRMaterial
- source: any
StaticParse Alpha Mode
-
Parses the alpha mode from the material data to parse
Parameters
- parsedMaterial: any
defines the material data to parse
- material: Material
defines the material to update
Returns void
- parsedMaterial: any
A Physically based material that follows the specification of OpenPBR.
For more information, please refer to the documentation : https://academysoftwarefoundation.github.io/OpenPBR/index.html