PBRMaterial

The Physically based material of BJS.

This offers the main features of a standard PBR material. For more information, please refer to the documentation : http://doc.babylonjs.com/extensions/Physically_Based_Rendering

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

albedoColor

albedoColor: Color3

AKA Diffuse Color in other nomenclature.

albedoTexture

albedoTexture: BaseTexture

AKA Diffuse Texture in standard nomenclature.

alpha

alpha: number

Sets the alpha value of the material

alphaCutOff

alphaCutOff: number

Defines the alpha limits in alpha test mode.

alphaMode

alphaMode: number

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

ambientColor

ambientColor: Color3

The color of a material in ambient lighting.

ambientTexture

ambientTexture: BaseTexture

AKA Occlusion Texture in other nomenclature.

ambientTextureStrength

ambientTextureStrength: number

AKA Occlusion Texture Intensity in other nomenclature.

animations

animations: Array<Animation>

Stores the animations for the material

backFaceCulling

backFaceCulling: boolean

Sets the back-face culling state

bumpTexture

bumpTexture: BaseTexture

Stores surface normal data used to displace a mesh in a texture.

cameraColorCurves

cameraColorCurves: Nullable<ColorCurves>

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.

cameraColorCurvesEnabled

cameraColorCurvesEnabled: boolean

Sets wether the color curves effect is enabled.

cameraColorGradingEnabled

cameraColorGradingEnabled: boolean

Gets wether the color grading effect is enabled.

cameraColorGradingTexture

cameraColorGradingTexture: Nullable<BaseTexture>

Sets the Color Grading 2D Lookup Texture.

cameraContrast

cameraContrast: number

Sets The camera contrast used on this material.

cameraExposure

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.

cameraToneMappingEnabled

cameraToneMappingEnabled: boolean

Sets wether tonemapping is enabled or not

checkReadyOnEveryCall

checkReadyOnEveryCall: boolean

Specifies if the ready state should be checked on each call

checkReadyOnlyOnce

checkReadyOnlyOnce: boolean

Specifies if the ready state should be checked once

directIntensity

directIntensity: number

Intensity of the direct lights e.g. the four lights available in your scene. This impacts both the direct diffuse and specular highlights.

disableBumpMap

disableBumpMap: boolean

Debug Control allowing disabling the bump map on this material.

disableDepthWrite

disableDepthWrite: boolean

Specifies if depth writing should be disabled

disableLighting

disableLighting: boolean

If sets to true, disables all the lights affecting the material.

doNotSerialize

doNotSerialize: boolean

Specifies if the material should be serialized

emissiveColor

emissiveColor: Color3

The color emitted from the material.

emissiveIntensity

emissiveIntensity: number

Intensity of the emissive part of the material. This helps controlling the emissive effect without modifying the emissive color.

emissiveTexture

emissiveTexture: BaseTexture

Stores the emissive values in a texture.

enableSpecularAntiAliasing

enableSpecularAntiAliasing: boolean

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.

environmentBRDFTexture

environmentBRDFTexture: Nullable<BaseTexture>

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.

environmentIntensity

environmentIntensity: number

Intensity of the environment e.g. how much the environment will light the object either through harmonics for rough material or through the refelction for shiny ones.

fillMode

fillMode: number

Sets the material fill mode

fogEnabled

fogEnabled: boolean

Sets the state for enabling fog

forceAlphaTest

forceAlphaTest: boolean

Enforces alpha test in opaque or blend mode in order to improve the performances of some situations.

forceDepthWrite

forceDepthWrite: boolean

Specifies if depth writing should be forced

forceIrradianceInFragment

forceIrradianceInFragment: boolean

Force the shader to compute irradiance in the fragment shader in order to take bump in account.

forceNormalForward

forceNormalForward: boolean

Force normal to face away from face.

getRenderTargetTextures

getRenderTargetTextures: function

Callback triggered to get the render target textures

id

id: string

The ID of the material

imageProcessingConfiguration

imageProcessingConfiguration: ImageProcessingConfiguration

Sets the Default image processing configuration used either in the this material.

If sets to null, the scene one is in use.

indexOfRefraction

indexOfRefraction: number

source material index of refraction (IOR)' / 'destination material IOR.

invertNormalMapX

invertNormalMapX: boolean

If sets to true, x component of normal map value will invert (x = 1.0 - x).

invertNormalMapY

invertNormalMapY: boolean

If sets to true, y component of normal map value will invert (y = 1.0 - y).

invertRefractionY

invertRefractionY: boolean

Controls if refraction needs to be inverted on Y. This could be usefull for procedural texture.

isFrozen

isFrozen: boolean

Specifies if updates for the material been locked

lightmapTexture

lightmapTexture: BaseTexture

Stores the pre-calculated light information of a mesh in a texture.

linkRefractionWithTransparency

linkRefractionWithTransparency: boolean

This parameters will make the material used its opacity to control how much it is refracting aginst not. Materials half opaque for instance using refraction could benefit from this control.

maxSimultaneousLights

maxSimultaneousLights: number

Number of Simultaneous lights allowed on the material.

metallic

metallic: number

Specifies the metallic scalar of the metallic/roughness workflow. Can also be used to scale the metalness values of the metallic texture.

metallicTexture

metallicTexture: BaseTexture

Used to switch from specular/glossiness to metallic/roughness workflow.

microSurface

microSurface: number

AKA Glossiness in other nomenclature.

microSurfaceTexture

microSurfaceTexture: BaseTexture

Used to enable roughness/glossiness fetch from a separate chanel depending on the current mode. Gray Scale represents roughness in metallic mode and glossiness in specular mode.

name

name: string

The name of the material

needDepthPrePass

needDepthPrePass: boolean

Sets the need depth pre-pass value

onBind

onBind: function

Called during a bind event

Type declaration

onBindObservable

onBindObservable: Observable<AbstractMesh>

An event triggered when the material is bound

onCompiled

onCompiled: function

Callback triggered when the material is compiled

Type declaration

    • Parameters

      Returns void

onDispose

onDispose: function

Called during a dispose event

Type declaration

    • (): void
    • Returns void

onDisposeObservable

onDisposeObservable: Observable<Material>

An event triggered when the material is disposed

onError

onError: function

Callback triggered when an error occurs

Type declaration

    • (effect: Effect, errors: string): void
    • Parameters

      • effect: Effect
      • errors: string

      Returns void

onUnBindObservable

onUnBindObservable: Observable<Material>

An event triggered when the material is unbound

opacityTexture

opacityTexture: BaseTexture

Stores the alpha values in a texture.

parallaxScaleBias

parallaxScaleBias: number

Controls the scale bias of the parallax mode.

pointSize

pointSize: number

Stores the size of points

pointsCloud

pointsCloud: boolean

Sets the state of point cloud mode

reflectionColor

reflectionColor: Color3

The color reflected from the material.

reflectionTexture

reflectionTexture: Nullable<BaseTexture>

Stores the reflection values in a texture.

reflectivityColor

reflectivityColor: Color3

AKA Specular Color in other nomenclature.

reflectivityTexture

reflectivityTexture: BaseTexture

AKA Specular texture in other nomenclature.

refractionTexture

refractionTexture: BaseTexture

Stores the refracted light information in a texture.

roughness

roughness: number

Specifies the roughness scalar of the metallic/roughness workflow. Can also be used to scale the roughness values of the metallic texture.

separateCullingPass

separateCullingPass: boolean

Specifies if there should be a separate pass for culling

sideOrientation

sideOrientation: number

Stores the value for side orientation

specularIntensity

specularIntensity: number

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.

state

state: string

The state of the material

storeEffectOnSubMeshes

storeEffectOnSubMeshes: boolean

Specifies if the effect should be stored on sub meshes

transparencyMode

transparencyMode: Nullable<number>

Sets the transparency mode of the material.

Value Type Description
0 OPAQUE
1 ALPHATEST
2 ALPHABLEND
3 ALPHATESTANDBLEND

twoSidedLighting

twoSidedLighting: boolean

If sets to true and backfaceCulling is false, normals will be flipped on the backside.

uniqueId

uniqueId: number

Gets or sets the unique id of the material

unlit

unlit: boolean

If set to true, no lighting calculations will be applied.

useAlphaFresnel

useAlphaFresnel: boolean

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)

useAlphaFromAlbedoTexture

useAlphaFromAlbedoTexture: boolean

Specifies that the alpha is coming form the albedo channel alpha channel for alpha blending.

useAmbientInGrayScale

useAmbientInGrayScale: boolean

Specifies if the ambient texture contains the ambient occlusion information in its red channel only.

useAmbientOcclusionFromMetallicTextureRed

useAmbientOcclusionFromMetallicTextureRed: boolean

Specifies if the metallic texture contains the ambient occlusion information in its red channel.

useAutoMicroSurfaceFromReflectivityMap

useAutoMicroSurfaceFromReflectivityMap: boolean

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.

useHorizonOcclusion

useHorizonOcclusion: boolean

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).

useLightmapAsShadowmap

useLightmapAsShadowmap: boolean

useLinearAlphaFresnel

useLinearAlphaFresnel: boolean

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)

useLogarithmicDepth

useLogarithmicDepth: boolean

Enabled the use of logarithmic depth buffers, which is good for wide depth buffers.

useMetallnessFromMetallicTextureBlue

useMetallnessFromMetallicTextureBlue: boolean

Specifies if the metallic texture contains the metallness information in its blue channel.

useMicroSurfaceFromReflectivityMapAlpha

useMicroSurfaceFromReflectivityMapAlpha: boolean

Specifies if the reflectivity texture contains the glossiness information in its alpha channel.

useObjectSpaceNormalMap

useObjectSpaceNormalMap: boolean

Allows using an object space normal map (instead of tangent space).

useParallax

useParallax: boolean

Allows using the bump map in parallax mode.

useParallaxOcclusion

useParallaxOcclusion: boolean

Allows using the bump map in parallax occlusion mode.

usePhysicalLightFalloff

usePhysicalLightFalloff: boolean

BJS is using an harcoded light falloff based on a manually sets up range. In PBR, one way to represents the fallof is to use the inverse squared root algorythm. This parameter can help you switch back to the BJS mode in order to create scenes using both materials.

useRadianceOcclusion

useRadianceOcclusion: boolean

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.

useRadianceOverAlpha

useRadianceOverAlpha: boolean

Specifies that the material will keeps the reflection highlights over a transparent surface (only the most limunous ones). A car glass is a good exemple of that. When the street lights reflects on it you can not see what is behind.

useRoughnessFromMetallicTextureAlpha

useRoughnessFromMetallicTextureAlpha: boolean

Specifies if the metallic texture contains the roughness information in its alpha channel.

useRoughnessFromMetallicTextureGreen

useRoughnessFromMetallicTextureGreen: boolean

Specifies if the metallic texture contains the roughness information in its green channel.

useSpecularOverAlpha

useSpecularOverAlpha: boolean

Specifies that the material will keeps the specular highlights over a transparent surface (only the most limunous ones). A car glass is a good exemple of that. When sun reflects on it you can not see what is behind.

wireframe

wireframe: boolean

Sets the state of wireframe mode

zOffset

zOffset: number

Stores the z offset value

Static AttributesDirtyFlag

AttributesDirtyFlag: number

Returns the dirty attributes flag value

Static ClockWiseSideOrientation

ClockWiseSideOrientation: number

Returns the clock-wise side orientation

Static CounterClockWiseSideOrientation

CounterClockWiseSideOrientation: number

Returns the counter clock-wise side orientation

Static FresnelDirtyFlag

FresnelDirtyFlag: number

Returns the dirty fresnel flag value

Static LightDirtyFlag

LightDirtyFlag: number

Returns the dirty light flag value

Static LineListDrawMode

LineListDrawMode: number

Returns the line list draw mode

Static LineLoopDrawMode

LineLoopDrawMode: number

Returns the line loop draw mode

Static LineStripDrawMode

LineStripDrawMode: number

Returns the line strip draw mode

Static MiscDirtyFlag

MiscDirtyFlag: number

Returns the dirty misc flag value

Static PBRMATERIAL_ALPHABLEND

PBRMATERIAL_ALPHABLEND: number

PBRMaterialTransparencyMode: Pixels are blended (according to the alpha mode) with the already drawn pixels in the current frame buffer.

Static PBRMATERIAL_ALPHATEST

PBRMATERIAL_ALPHATEST: number

PBRMaterialTransparencyMode: Alpha Test mode, pixel are discarded below a certain threshold defined by the alpha cutoff value.

Static PBRMATERIAL_ALPHATESTANDBLEND

PBRMATERIAL_ALPHATESTANDBLEND: number

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 PBRMATERIAL_OPAQUE

PBRMATERIAL_OPAQUE: number

PBRMaterialTransparencyMode: No transparency mode, Alpha channel is not use.

Static PointFillMode

PointFillMode: number

Returns the point fill mode

Static PointListDrawMode

PointListDrawMode: number

Returns the point list draw mode

Static TextureDirtyFlag

TextureDirtyFlag: number

Returns the dirty texture flag value

Static TriangleFanDrawMode

TriangleFanDrawMode: number

Returns the triangle fan draw mode

Static TriangleFillMode

TriangleFillMode: number

Returns the triangle fill mode

Static TriangleStripDrawMode

TriangleStripDrawMode: number

Returns the triangle strip draw mode

Static WireFrameFillMode

WireFrameFillMode: number

Returns the wireframe mode

Methods

bind

bindForSubMesh

bindOnlyNormalMatrix

  • bindOnlyNormalMatrix(normalMatrix: Matrix): void

bindOnlyWorldMatrix

  • bindOnlyWorldMatrix(world: Matrix): void

bindSceneUniformBuffer

  • Binds the scene's uniform buffer to the effect.

    Parameters

    • effect: Effect

      defines the effect to bind to the scene uniform buffer

    • sceneUbo: UniformBuffer

      defines the uniform buffer storing scene data

    Returns void

bindView

  • bindView(effect: Effect): void
  • Binds the view matrix to the effect

    Parameters

    • effect: Effect

      defines the effect to bind the view matrix to

    Returns void

bindViewProjection

  • bindViewProjection(effect: Effect): void
  • Binds the view projection matrix to the effect

    Parameters

    • effect: Effect

      defines the effect to bind the view projection matrix to

    Returns void

buildUniformLayout

  • buildUniformLayout(): void

clone

  • Makes a duplicate of the current material.

    Parameters

    • name: string

      name to use for the new material.

    Returns PBRMaterial

dispose

  • dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void
  • Disposes the resources of the material.

    Parameters

    • Optional forceDisposeEffect: boolean

      Forces the disposal of effects.

    • Optional forceDisposeTextures: boolean

      Forces the disposal of all textures.

    Returns void

forceCompilation

  • forceCompilation(mesh: AbstractMesh, onCompiled?: function, options?: Partial<object>): void

forceCompilationAsync

  • forceCompilationAsync(mesh: AbstractMesh, options?: Partial<object>): Promise<void>
  • Force shader compilation

    Parameters

    • mesh: AbstractMesh

      defines the mesh that will use this material

    • Optional options: Partial<object>

      defines additional options for compiling the shaders

    Returns Promise<void>

    a promise that resolves when the compilation completes

freeze

  • freeze(): void
  • Locks updates for the material

    Returns void

getActiveTextures

getAlphaTestTexture

getAnimatables

getBindedMeshes

getClassName

  • getClassName(): string

getEffect

getScene

hasTexture

  • Checks to see if a texture is used in the material.

    Parameters

    Returns boolean

    • Boolean specifying if a texture is used in the material.

isMetallicWorkflow

  • isMetallicWorkflow(): boolean
  • Specifies if the material uses metallic roughness workflow.

    Returns boolean

    boolean specifiying if the material uses metallic roughness workflow.

isReady

  • isReady(mesh?: AbstractMesh, useInstances?: boolean): boolean

isReadyForSubMesh

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

    • Optional useInstances: boolean

      Specifies that instances should be used.

    Returns boolean

    • boolean indicating that the submesh is ready or not.

markAsDirty

  • markAsDirty(flag: number): void
  • 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

markDirty

  • markDirty(): void
  • Marks the material to indicate that it needs to be re-calculated

    Returns void

needAlphaBlending

  • needAlphaBlending(): boolean

needAlphaBlendingForMesh

needAlphaTesting

  • needAlphaTesting(): boolean

serialize

  • serialize(): any
  • Serializes this PBR Material.

    Returns any

    • An object with the serialized material.

toString

  • toString(fullDetails?: boolean): string
  • Returns a string representation of the current material

    Parameters

    • Optional fullDetails: boolean

      defines a boolean indicating which levels of logging is desired

    Returns string

    a string with material information

unbind

  • unbind(): void

unfreeze

  • unfreeze(): void
  • Unlocks updates for the material

    Returns void

Static Parse

  • 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 PBRMaterial

    • PBRMaterial

Static ParseMultiMaterial

  • Creates a MultiMaterial from parsed MultiMaterial data.

    Parameters

    • parsedMultiMaterial: any

      defines parsed MultiMaterial data.

    • scene: Scene

      defines the hosting scene

    Returns MultiMaterial

    a new MultiMaterial

Generated using TypeDoc