BackgroundMaterial

Background material used to create an efficient environement around your scene.

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

alpha

alpha: number

Sets the alpha value of the material

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

animations

animations: Array<Animation>

Stores the animations for the material

backFaceCulling

backFaceCulling: boolean

Sets the back-face culling state

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: float

Sets The camera contrast used on this material.

cameraExposure

cameraExposure: float

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

diffuseTexture

diffuseTexture: Nullable<BaseTexture>

Diffuse Texture used in the material. Should be author in a specific way for the best result (refer to the documentation).

disableDepthWrite

disableDepthWrite: boolean

Specifies if depth writing should be disabled

doNotSerialize

doNotSerialize: boolean

Specifies if the material should be serialized

enableNoise

enableNoise: boolean

This helps reducing the banding effect that could occur on the background.

fillMode

fillMode: number

Sets the material fill mode

fogEnabled

fogEnabled: boolean

Sets the state for enabling fog

forceDepthWrite

forceDepthWrite: boolean

Specifies if depth writing should be forced

fovMultiplier

fovMultiplier: number

The current fov(field of view) multiplier, 0.0 - 2.0. Defaults to 1.0. Lower values "zoom in" and higher values "zoom out". Best used when trying to implement visual zoom effects like fish-eye or binoculars while not adjusting camera fov. Recommended to be keep at 1.0 except for special cases.

getRenderTargetTextures

getRenderTargetTextures: function

Callback triggered to get the render target textures

id

id: string

The ID of the material

imageProcessingConfiguration

imageProcessingConfiguration: Nullable<ImageProcessingConfiguration>

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

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

isFrozen

isFrozen: boolean

Specifies if updates for the material been locked

maxSimultaneousLights

maxSimultaneousLights: int

Number of Simultaneous lights allowed on the material.

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

opacityFresnel

opacityFresnel: boolean

This helps specifying that the material is falling off to the sky box at grazing angle. This helps ensuring a nice transition when the camera goes under the ground.

pointSize

pointSize: number

Stores the size of points

pointsCloud

pointsCloud: boolean

Sets the state of point cloud mode

primaryColor

primaryColor: Color3

Key light Color (multiply against the environement texture)

primaryColorHighlightLevel

primaryColorHighlightLevel: float

Defines the level of the highliights (highlight area of the reflection map) in order to help scaling the colors. The primary color is used at the level chosen to define what the white area would look.

primaryColorShadowLevel

primaryColorShadowLevel: float

Defines the level of the shadows (dark area of the reflection map) in order to help scaling the colors. The color opposite to the primary color is used at the level chosen to define what the black area would look.

reflectionAmount

reflectionAmount: number

This specifies the weight of the reflection against the background in case of reflection Fresnel.

reflectionBlur

reflectionBlur: float

Reflection Texture level of blur.

Can be use to reuse an existing HDR Texture and target a specific LOD to prevent authoring the texture twice.

reflectionFalloffDistance

reflectionFalloffDistance: number

This helps specifying the falloff radius off the reflection texture from the sceneCenter. This helps adding a nice falloff effect to the reflection if used as a mirror for instance.

reflectionFresnel

reflectionFresnel: boolean

This helps specifying that the material is falling off from diffuse to the reflection texture at grazing angle. This helps adding a mirror texture on the ground.

reflectionReflectance0

reflectionReflectance0: number

This specifies the weight of the reflection at grazing angle.

reflectionReflectance90

reflectionReflectance90: number

This specifies the weight of the reflection at a perpendicular point of view.

reflectionStandardFresnelWeight

reflectionStandardFresnelWeight: number

Sets the reflection reflectance fresnel values according to the default standard empirically know to work well :-)

reflectionTexture

reflectionTexture: Nullable<BaseTexture>

Reflection Texture used in the material. Should be author in a specific way for the best result (refer to the documentation).

sceneCenter

sceneCenter: Vector3

In case of opacity Fresnel or reflection falloff, this is use as a scene center. It is usually zero but might be interesting to modify according to your setup.

separateCullingPass

separateCullingPass: boolean

Specifies if there should be a separate pass for culling

shadowLevel

shadowLevel: float

Helps adjusting the shadow to a softer level if required. 0 means black shadows and 1 means no shadows.

shadowLights

shadowLights: Nullable<IShadowLight[]>

Specify the list of lights casting shadow on the material. All scene shadow lights will be included if null.

sideOrientation

sideOrientation: number

Stores the value for side orientation

state

state: string

The state of the material

storeEffectOnSubMeshes

storeEffectOnSubMeshes: boolean

Specifies if the effect should be stored on sub meshes

switchToBGR

switchToBGR: boolean

Due to a bug in iOS10, video tags (which are using the background material) are in BGR and not RGB. Setting this flag to true (not done automatically!) will convert it back to RGB.

useEquirectangularFOV

useEquirectangularFOV: boolean

Enable the FOV adjustment feature controlled by fovMultiplier.

useRGBColor

useRGBColor: boolean

Helps to directly use the maps channels instead of their level.

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 PointFillMode

PointFillMode: number

Returns the point fill mode

Static PointListDrawMode

PointListDrawMode: number

Returns the point list draw mode

Static StandardReflectance0

StandardReflectance0: number

Standard reflectance value at parallel view angle.

Static StandardReflectance90

StandardReflectance90: number

Standard reflectance value at grazing angle.

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

  • Bind the material for a dedicated submeh (every used meshes will be considered opaque).

    Parameters

    • world: Matrix

      The world matrix to bind.

    • mesh: Mesh
    • subMesh: SubMesh

      The submesh to bind for.

    Returns void

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
  • Build the uniform buffer used in the material.

    Returns void

clone

dispose

  • dispose(forceDisposeEffect?: boolean, forceDisposeTextures?: boolean): void
  • Dispose the material.

    Parameters

    • Optional forceDisposeEffect: boolean

      Force disposal of the associated effect.

    • Optional forceDisposeTextures: boolean

      Force disposal of the associated textures.

    Returns void

forceCompilation

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

    Parameters

    • mesh: AbstractMesh

      defines the mesh associated with this material

    • Optional onCompiled: function

      defines a function to execute once the material is compiled

    • Optional options: Partial<object>

      defines the options to configure the compilation

    Returns 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

getBindedMeshes

getClassName

  • getClassName(): string
  • Gets the class name of the material

    Returns string

    "BackgroundMaterial"

getEffect

getScene

hasTexture

  • Specifies if the material uses a texture

    Parameters

    • texture: BaseTexture

      defines the texture to check against the material

    Returns boolean

    a boolean specifying if the material uses the texture

isReady

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

isReadyForSubMesh

  • Checks wether the material is ready to be rendered for a given mesh.

    Parameters

    • mesh: AbstractMesh

      The mesh to render

    • subMesh: SubMesh

      The submesh to check against

    • Optional useInstances: boolean

      Specify wether or not the material is used with instances

    Returns boolean

    true if all the dependencies are ready (Textures, Effects...)

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
  • The entire material has been created in order to prevent overdraw.

    Returns boolean

    true if blending is enable

needAlphaBlendingForMesh

  • Specifies if the mesh will require alpha blending

    Parameters

    Returns boolean

    a boolean specifying if alpha blending is needed for the mesh

needAlphaTesting

  • needAlphaTesting(): boolean
  • The entire material has been created in order to prevent overdraw.

    Returns boolean

    false

serialize

  • serialize(): any
  • Serializes the current material to its JSON representation.

    Returns any

    The JSON representation.

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

  • Parse a JSON input to create back a background material.

    Parameters

    • source: any

      The JSON data to parse

    • scene: Scene

      The scene to create the parsed material in

    • rootUrl: string

      The root url of the assets the material depends upon

    Returns BackgroundMaterial

    the instantiated BackgroundMaterial.

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