Class PBRBRDFConfiguration
Hierarchy (View Summary)
- MaterialPluginBase
- PBRBRDFConfiguration
Index
Constructors
Properties
Accessors
Methods
Constructors
constructor
-
new PBRBRDFConfiguration(
material: PBRBaseMaterial,
addToPluginList?: boolean,
): PBRBRDFConfigurationParameters
- material: PBRBaseMaterial
- addToPluginList: boolean = true
Returns PBRBRDFConfiguration
Properties
do Not Serialize
Specifies if the material plugin should be serialized, true to skip serialization
Readonlymark All Defines As Dirty
Helper function to mark defines as being dirty.
name
Defines the name of the plugin
priority
Defines the priority of the plugin. Lower numbers run first.
register For Extra Events
Indicates that this plugin should be notified for the extra events (HasRenderTargetTextures / FillRenderTargetTextures / HardBindForSubMesh)
resolve Includes
Indicates that any #include directive in the plugin code must be replaced by the corresponding code.
StaticDEFAULT_ CONDUCTOR_ SPECULAR_ MODEL
Defines the default conductor specular model used by the material.
StaticDEFAULT_ DIELECTRIC_ SPECULAR_ MODEL
Defines the default dielectric specular model used by the material.
StaticDEFAULT_ DIFFUSE_ MODEL
Defines the default diffuse model used by the material.
StaticDEFAULT_ MIX_ IBL_ RADIANCE_ WITH_ IRRADIANCE
Default value for whether IBL irradiance is used to augment rough radiance. If activated, irradiance is blended into the radiance contribution when the material is rough. This better approximates raytracing results for rough surfaces.
StaticDEFAULT_ USE_ ENERGY_ CONSERVATION
Default value used for the energy conservation. This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.
StaticDEFAULT_ USE_ LEGACY_ SPECULAR_ ENERGY_ CONSERVATION
Default value for whether the legacy specular energy conservation is used.
StaticDEFAULT_ USE_ SMITH_ VISIBILITY_ HEIGHT_ CORRELATED
Default value used for the Smith Visibility Height Correlated mode. This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.
StaticDEFAULT_ USE_ SPECULAR_ GLOSSINESS_ INPUT_ ENERGY_ CONSERVATION
Default value used for activating energy conservation for the specular workflow. If activated, the albedo color is multiplied with (1. - maxChannel(specular color)). If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1.
StaticDEFAULT_ USE_ SPHERICAL_ HARMONICS
Default value used for the IBL diffuse part. This can help switching back to the polynomials mode globally which is a tiny bit less GPU intensive at the drawback of a lower quality.
Accessors
base Diffuse Model
Defines the base diffuse roughness model of the material.
conductor Specular Model
The material model to use for specular lighting.
dielectric Specular Model
The material model to use for specular lighting of dielectric materials.
mix Ibl Radiance With Irradiance
Defines if IBL irradiance is used to augment rough radiance. If activated, irradiance is blended into the radiance contribution when the material is rough. This better approximates raytracing results for rough surfaces.
use Energy Conservation
Defines if the material uses energy conservation.
use Legacy Specular Energy Conservation
Defines if the legacy specular energy conservation is used. If activated, the specular color is multiplied with (1. - maxChannel(albedo color)).
use Smith Visibility Height Correlated
LEGACY Mode set to false Defines if the material uses height smith correlated visibility term. If you intent to not use our default BRDF, you need to load a separate BRDF Texture for the PBR You can either load https://assets.babylonjs.com/environments/uncorrelatedBRDF.png or https://assets.babylonjs.com/environments/uncorrelatedBRDF.dds to have more precision Not relying on height correlated will also disable energy conservation.
use Specular Glossiness Input Energy Conservation
Defines if the material uses energy conservation, when the specular workflow is active. If activated, the albedo color is multiplied with (1. - maxChannel(specular color)). If deactivated, a material is only physically plausible, when (albedo color + specular color) < 1. In the deactivated case, the material author has to ensure energy conservation, for a physically plausible rendering.
use Spherical Harmonics
LEGACY Mode set to false Defines if the material uses spherical harmonics vs spherical polynomials for the diffuse part of the IBL. The harmonics despite a tiny bigger cost has been proven to provide closer results to the ground truth.
Methods
add Fallbacks
-
Add fallbacks to the effect fallbacks list.
Parameters
- defines: MaterialDefines
defines the Base texture to use.
- fallbacks: EffectFallbacks
defines the current fallback list.
- currentRank: number
defines the current fallback rank.
Returns number
the new fallback rank.
- defines: MaterialDefines
bind For Sub Mesh
-
bindForSubMesh(
_uniformBuffer: UniformBuffer,
_scene: Scene,
_engine: AbstractEngine,
_subMesh: SubMesh,
): voidBinds the material data.
Parameters
- _uniformBuffer: UniformBuffer
defines the Uniform buffer to fill in.
- _scene: Scene
defines the scene the material belongs to.
- _engine: AbstractEngine
the engine this scene belongs to.
- _subMesh: SubMesh
the submesh to bind data for
Returns void
- _uniformBuffer: UniformBuffer
collect Defines
-
Collects all defines.
Parameters
- defines: { [name: string]: { default: any; type: string } }
The object to append to.
Returns void
- defines: { [name: string]: { default: any; type: string } }
copy To
-
Makes a duplicate of the current configuration into another one.
Parameters
- plugin: MaterialPluginBase
define the config where to copy the info
Returns void
- plugin: MaterialPluginBase
dispose
-
Disposes the resources of the material.
Parameters
Optional_forceDisposeTextures: booleanForces the disposal of all textures.
Returns void
fill Render Target Textures
-
Fills the list of render target textures.
Parameters
- _renderTargets: SmartArray<RenderTargetTexture>
the list of render targets to update
Returns void
- _renderTargets: SmartArray<RenderTargetTexture>
get Active Textures
-
Returns an array of the actively used textures.
Parameters
- _activeTextures: BaseTexture[]
Array of BaseTextures
Returns void
- _activeTextures: BaseTexture[]
get Animatables
-
Returns the animatable textures.
Parameters
- _animatables: IAnimatable[]
Array of animatable textures.
Returns void
- _animatables: IAnimatable[]
get Attributes
-
Gets the attributes used by the plugin.
Parameters
- _attributes: string[]
list that the attribute names should be added to.
- _scene: Scene
the scene that the material belongs to.
- _mesh: AbstractMesh
the mesh being rendered.
Returns void
- _attributes: string[]
get Class Name
-
Gets the current class name useful for serialization or dynamic coding.
Returns string
The class name.
get Custom Code
-
getCustomCode(
_shaderType: string,
_shaderLanguage?: ShaderLanguage,
): Nullable<{ [pointName: string]: string }>Returns a list of custom shader code fragments to customize the shader.
Parameters
- _shaderType: string
"vertex" or "fragment"
- _shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL
The shader language to use.
Returns Nullable<{ [pointName: string]: string }>
null if no code to be added, or a list of pointName => code. Note that
pointNamecan also be a regular expression if it starts with a!. In that case, the string found by the regular expression (if any) will be replaced by the code provided. - _shaderType: string
get Samplers
-
Gets the samplers used by the plugin.
Parameters
- _samplers: string[]
list that the sampler names should be added to.
Returns void
- _samplers: string[]
get Uniform Buffers Names
-
Gets the uniform buffers names added by the plugin.
Parameters
- _ubos: string[]
list that the ubo names should be added to.
Returns void
- _ubos: string[]
get Uniforms
-
getUniforms(
_shaderLanguage?: ShaderLanguage,
): {
externalUniforms?: string[];
fragment?: string;
ubo?: { arraySize?: number; name: string; size?: number; type?: string }[];
vertex?: string;
}Gets the description of the uniforms to add to the ubo (if engine supports ubos) or to inject directly in the vertex/fragment shaders (if engine does not support ubos)
Parameters
- _shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL
The shader language to use.
Returns {
externalUniforms?: string[];
fragment?: string;
ubo?: { arraySize?: number; name: string; size?: number; type?: string }[];
vertex?: string;
}the description of the uniforms
- _shaderLanguage: ShaderLanguage = ShaderLanguage.GLSL
hard Bind For Sub Mesh
-
hardBindForSubMesh(
_uniformBuffer: UniformBuffer,
_scene: Scene,
_engine: AbstractEngine,
_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: AbstractEngine
defines the engine the material belongs to.
- _subMesh: SubMesh
the submesh to bind data for
Returns void
- _uniformBuffer: UniformBuffer
has Render Target Textures
-
Gets a boolean indicating that current material needs to register RTT
Returns boolean
true if this uses a render target otherwise false.
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 Compatible
-
Gets a boolean indicating that the plugin is compatible with a given shader language.
Returns boolean
true if the plugin is compatible with the shader language
is Ready For Sub Mesh
-
isReadyForSubMesh(
_defines: MaterialDefines,
_scene: Scene,
_engine: AbstractEngine,
_subMesh: SubMesh,
): booleanSpecifies that the submesh is ready to be used.
Parameters
- _defines: MaterialDefines
the list of "defines" to update.
- _scene: Scene
defines the scene the material belongs to.
- _engine: AbstractEngine
the engine this scene belongs to.
- _subMesh: SubMesh
the submesh to check for readiness
Returns boolean
- boolean indicating that the submesh is ready or not.
- _defines: MaterialDefines
parse
-
Parses a plugin configuration from a serialized object.
Parameters
- source: any
Serialized object.
- scene: Scene
Defines the scene we are parsing for
- rootUrl: string
Defines the rootUrl to load from
Returns void
- source: any
prepare Defines
-
Updates the material defines for BRDF settings.
Parameters
- defines: MaterialBRDFDefines
defines the material defines to update
Returns void
- defines: MaterialBRDFDefines
prepare Defines Before Attributes
-
prepareDefinesBeforeAttributes(
_defines: MaterialDefines,
_scene: Scene,
_mesh: AbstractMesh,
): voidSets the defines for the next rendering. Called before PrepareDefinesForAttributes is called.
Parameters
- _defines: MaterialDefines
the list of "defines" to update.
- _scene: Scene
defines the scene to the material belongs to.
- _mesh: AbstractMesh
the mesh being rendered
Returns void
- _defines: MaterialDefines
serialize
-
Serializes this plugin configuration.
Returns any
- An object with the serialized config.
Plugin that implements the BRDF component of the PBR material