API

Class PBRBRDFConfiguration

Plugin that implements the BRDF component of the PBR material

Hierarchy (View Summary)

Index
doNotSerialize: boolean = false

Specifies if the material plugin should be serialized, true to skip serialization

markAllDefinesAsDirty: () => void

Helper function to mark defines as being dirty.

name: string

Defines the name of the plugin

priority: number = 500

Defines the priority of the plugin. Lower numbers run first.

registerForExtraEvents: boolean = false

Indicates that this plugin should be notified for the extra events (HasRenderTargetTextures / FillRenderTargetTextures / HardBindForSubMesh)

resolveIncludes: boolean = false

Indicates that any #include directive in the plugin code must be replaced by the corresponding code.

DEFAULT_CONDUCTOR_SPECULAR_MODEL: number = Constants.MATERIAL_CONDUCTOR_SPECULAR_MODEL_GLTF

Defines the default conductor specular model used by the material.

DEFAULT_DIELECTRIC_SPECULAR_MODEL: number = Constants.MATERIAL_DIELECTRIC_SPECULAR_MODEL_GLTF

Defines the default dielectric specular model used by the material.

DEFAULT_DIFFUSE_MODEL: number = Constants.MATERIAL_DIFFUSE_MODEL_E_OREN_NAYAR

Defines the default diffuse model used by the material.

DEFAULT_MIX_IBL_RADIANCE_WITH_IRRADIANCE: boolean = true

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.

DEFAULT_USE_ENERGY_CONSERVATION: boolean = true

Default value used for the energy conservation. This should only be changed to adapt to the type of texture in scene.environmentBRDFTexture.

DEFAULT_USE_LEGACY_SPECULAR_ENERGY_CONSERVATION: boolean = true

Default value for whether the legacy specular energy conservation is used.

DEFAULT_USE_SMITH_VISIBILITY_HEIGHT_CORRELATED: boolean = true

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.

DEFAULT_USE_SPECULAR_GLOSSINESS_INPUT_ENERGY_CONSERVATION: boolean = true

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.

DEFAULT_USE_SPHERICAL_HARMONICS: boolean = true

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.

baseDiffuseModel: number

Defines the base diffuse roughness model of the material.

conductorSpecularModel: number

The material model to use for specular lighting.

dielectricSpecularModel: number

The material model to use for specular lighting of dielectric materials.

mixIblRadianceWithIrradiance: boolean

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.

useEnergyConservation: boolean

Defines if the material uses energy conservation.

useLegacySpecularEnergyConservation: boolean

Defines if the legacy specular energy conservation is used. If activated, the specular color is multiplied with (1. - maxChannel(albedo color)).

useSmithVisibilityHeightCorrelated: boolean

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.

useSpecularGlossinessInputEnergyConservation: boolean

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.

useSphericalHarmonics: boolean

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.

  • 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 pointName can 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.

  • 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