Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GlowLayer

The glow layer Helps adding a glow effect around the emissive parts of a mesh.

Once instantiated in a scene, by default, all the emissive meshes will glow.

Documentation: https://doc.babylonjs.com/how_to/glow_layer

Hierarchy

Index

Constructors

constructor

  • Instantiates a new glow Layer and references it to the scene.

    Parameters

    • name: string

      The name of the layer

    • Optional scene: Scene

      The scene to use the layer in

    • Optional options: Partial<IGlowLayerOptions>

      Sets of none mandatory options to use with the layer (see IGlowLayerOptions for more information)

    Returns GlowLayer

Properties

customEmissiveColorSelectorSearch playground for customEmissiveColorSelector

customEmissiveColorSelector: (mesh: Mesh, subMesh: SubMesh, material: Material, result: Color4) => void

Callback used to let the user override the color selection on a per mesh basis

Type declaration

customEmissiveTextureSelectorSearch playground for customEmissiveTextureSelector

customEmissiveTextureSelector: (mesh: Mesh, subMesh: SubMesh, material: Material) => Texture

Callback used to let the user override the texture selection on a per mesh basis

Type declaration

disableBoundingBoxesFromEffectLayerSearch playground for disableBoundingBoxesFromEffectLayer

disableBoundingBoxesFromEffectLayer: boolean

Specifies if the bounding boxes should be rendered normally or if they should undergo the effect of the layer

isEnabledSearch playground for isEnabled

isEnabled: boolean

Specifies whether the highlight layer is enabled or not.

nameSearch playground for name

name: string

The name of the layer

neutralColorSearch playground for neutralColor

neutralColor: Color4

The clear color of the texture used to generate the glow map.

onAfterComposeObservableSearch playground for onAfterComposeObservable

onAfterComposeObservable: Observable<EffectLayer>

An event triggered when the generated texture has been merged in the scene.

onAfterRenderMeshToEffectSearch playground for onAfterRenderMeshToEffect

onAfterRenderMeshToEffect: Observable<AbstractMesh>

An event triggered after the mesh has been rendered into the effect render target.

onBeforeComposeObservableSearch playground for onBeforeComposeObservable

onBeforeComposeObservable: Observable<EffectLayer>

An event triggered when the generated texture is being merged in the scene.

onBeforeRenderMainTextureObservableSearch playground for onBeforeRenderMainTextureObservable

onBeforeRenderMainTextureObservable: Observable<EffectLayer>

An event triggered when the effect layer is about rendering the main texture with the glowy parts.

onBeforeRenderMeshToEffectSearch playground for onBeforeRenderMeshToEffect

onBeforeRenderMeshToEffect: Observable<AbstractMesh>

An event triggered when the mesh is rendered into the effect render target.

onDisposeObservableSearch playground for onDisposeObservable

onDisposeObservable: Observable<EffectLayer>

An event triggered when the effect layer has been disposed.

onSizeChangedObservableSearch playground for onSizeChangedObservable

onSizeChangedObservable: Observable<EffectLayer>

An event triggered when the effect layer changes its size.

Static DefaultBlurKernelSizeSearch playground for DefaultBlurKernelSize

DefaultBlurKernelSize: number

The default blur kernel size used for the glow.

Static DefaultTextureRatioSearch playground for DefaultTextureRatio

DefaultTextureRatio: number

The default texture size ratio used for the glow.

Static Readonly EffectNameSearch playground for EffectName

EffectName: "GlowLayer" = "GlowLayer"

Effect Name of the layer.

Accessors

blurKernelSize

  • get blurKernelSize(): number
  • set blurKernelSize(value: number): any
  • Gets the kernel size of the blur.

    Returns number

  • Sets the kernel size of the blur.

    Parameters

    • value: number

    Returns any

camera

intensity

  • get intensity(): number
  • set intensity(value: number): any
  • Gets the glow intensity.

    Returns number

  • Sets the glow intensity.

    Parameters

    • value: number

    Returns any

mainTexture

renderingGroupId

  • get renderingGroupId(): number
  • set renderingGroupId(renderingGroupId: number): any
  • Gets the rendering group id the layer should render in.

    Returns number

  • Gets the rendering group id the layer should render in.

    Parameters

    • renderingGroupId: number

    Returns any

Methods

addExcludedMeshSearch playground for addExcludedMesh

  • addExcludedMesh(mesh: Mesh): void
  • Add a mesh in the exclusion list to prevent it to impact or being impacted by the glow layer.

    Parameters

    • mesh: Mesh

      The mesh to exclude from the glow layer

    Returns void

addIncludedOnlyMeshSearch playground for addIncludedOnlyMesh

  • addIncludedOnlyMesh(mesh: Mesh): void
  • Add a mesh in the inclusion list to impact or being impacted by the glow layer.

    Parameters

    • mesh: Mesh

      The mesh to include in the glow layer

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Dispose the highlight layer and free resources.

    Returns void

getClassNameSearch playground for getClassName

  • getClassName(): string
  • Gets the class name of the effect layer

    Returns string

    the string with the class name of the effect layer

getEffectNameSearch playground for getEffectName

  • getEffectName(): string
  • Get the effect name of the layer.

    Returns string

    The effect name

hasMeshSearch playground for hasMesh

  • Determine if a given mesh will be used in the glow layer

    Parameters

    Returns boolean

    true if the mesh will be highlighted by the current glow layer

isReadySearch playground for isReady

  • isReady(subMesh: SubMesh, useInstances: boolean): boolean
  • Checks for the readiness of the element composing the layer.

    Parameters

    • subMesh: SubMesh

      the mesh to check for

    • useInstances: boolean

      specify whether or not to use instances to render the mesh

    Returns boolean

    true if ready otherwise, false

needStencilSearch playground for needStencil

  • needStencil(): boolean
  • Returns whether or not the layer needs stencil enabled during the mesh rendering.

    Returns boolean

referenceMeshToUseItsOwnMaterialSearch playground for referenceMeshToUseItsOwnMaterial

  • referenceMeshToUseItsOwnMaterial(mesh: AbstractMesh): void
  • Add a mesh to be rendered through its own material and not with emissive only.

    Parameters

    • mesh: AbstractMesh

      The mesh for which we need to use its material

    Returns void

removeExcludedMeshSearch playground for removeExcludedMesh

  • removeExcludedMesh(mesh: Mesh): void
  • Remove a mesh from the exclusion list to let it impact or being impacted by the glow layer.

    Parameters

    • mesh: Mesh

      The mesh to remove

    Returns void

removeIncludedOnlyMeshSearch playground for removeIncludedOnlyMesh

  • removeIncludedOnlyMesh(mesh: Mesh): void
  • Remove a mesh from the Inclusion list to prevent it to impact or being impacted by the glow layer.

    Parameters

    • mesh: Mesh

      The mesh to remove

    Returns void

renderSearch playground for render

  • render(): void
  • Renders the glowing part of the scene by blending the blurred glowing meshes on top of the rendered scene.

    Returns void

serializeSearch playground for serialize

  • serialize(): any
  • Serializes this glow layer

    Returns any

    a serialized glow layer object

setMaterialForRenderingSearch playground for setMaterialForRendering

  • Sets a specific material to be used to render a mesh/a list of meshes in the layer

    Parameters

    • mesh: AbstractMesh | AbstractMesh[]

      mesh or array of meshes

    • Optional material: Material

      material to use by the layer when rendering the mesh(es). If undefined is passed, the specific material created by the layer will be used.

    Returns void

shouldRenderSearch playground for shouldRender

  • shouldRender(): boolean
  • Returns true if the layer contains information to display, otherwise false.

    Returns boolean

    true if the glow layer should be rendered

unReferenceMeshFromUsingItsOwnMaterialSearch playground for unReferenceMeshFromUsingItsOwnMaterial

  • unReferenceMeshFromUsingItsOwnMaterial(mesh: AbstractMesh): void
  • Remove a mesh from being rendered through its own material and not with emissive only.

    Parameters

    • mesh: AbstractMesh

      The mesh for which we need to not use its material

    Returns void

Static ParseSearch playground for Parse

  • Parse(parsedGlowLayer: any, scene: Scene, rootUrl: string): GlowLayer
  • Creates a Glow Layer from parsed glow layer data

    Parameters

    • parsedGlowLayer: any

      defines glow layer data

    • scene: Scene

      defines the current scene

    • rootUrl: string

      defines the root URL containing the glow layer information

    Returns GlowLayer

    a parsed Glow Layer

Legend

  • Constructor
  • Property
  • Method
  • Accessor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Property
  • Method
  • Static property
  • Static method