VolumetricLightScatteringPostProcess

Hierarchy

Index

Constructors

constructor

  • constructor

    Parameters

    • name: string

      The post-process name

    • ratio: any

      The size of the post-process and/or internal pass (0.5 means that your postprocess will have a width = canvas.width 0.5 and a height = canvas.height 0.5)

    • camera: Camera

      The camera that the post-process will be attached to

    • Optional mesh: Mesh

      The mesh used to create the light scattering

    • Optional samples: number

      The post-process quality, default 100

    • Optional samplingMode: number

      The post-process filtering mode

    • Optional engine: Engine

      The babylon engine

    • Optional reusable: boolean

      If the post-process is reusable

    • Optional scene: Scene

      The constructor needs a scene reference to initialize internal components. If "camera" is null (RenderPipelineà, "scene" must be provided

    Returns VolumetricLightScatteringPostProcess

Properties

adaptScaleToCurrentViewport

adaptScaleToCurrentViewport: boolean

Modify the scale of the post process to be the same as the viewport (default: false)

alphaConstants

alphaConstants: Color4

Sets the setAlphaBlendConstants of the babylon engine

alphaMode

alphaMode: number

Type of alpha mode to use when performing the post process (default: Engine.ALPHA_DISABLE)

alwaysForcePOT

alwaysForcePOT: boolean

Force textures to be a power of two (default: false)

animations

animations: Animation[]

Animations to be used for the post processing

aspectRatio

aspectRatio: number

The aspect ratio of the output texture.

attachedNode

attachedNode: object

If not undefined, the mesh position is computed from the attached node position

Type declaration

autoClear

autoClear: boolean

If the buffer needs to be cleared before applying the post process. (default: true) Should be set to false if shader will overwrite all previous pixels.

clearColor

clearColor: Color4

Clear color to use when screen clearing

customMeshPosition

customMeshPosition: Vector3

Custom position of the mesh. Used if "useCustomMeshPosition" is set to "true"

decay

decay: number

Dissipates each sample's contribution in range [0, 1]

density

density: number

Controls the density of each sample

enablePixelPerfectMode

enablePixelPerfectMode: boolean

Enable Pixel Perfect mode where texture is not scaled to be power of 2. Can only be used on a single postprocess or on the last one of a chain. (default: false)

excludedMeshes

excludedMeshes: AbstractMesh[]

Array containing the excluded meshes not rendered in the internal pass

exposure

exposure: number

Controls the overall intensity of the post-process

forceFullscreenViewport

forceFullscreenViewport: boolean

Force the postprocess to be applied without taking in account viewport

height

height: number

Height of the texture to apply the post process on

inputTexture

inputTexture: InternalTexture

The input texture for this post process and the output texture of the previous post process. When added to a pipeline the previous post process will render it's output into this texture and this texture will be used as textureSampler in the fragment shader of this post process.

invert

invert: boolean

If the post-process should inverse the light scattering direction

isSupported

isSupported: boolean

If the post process is supported.

mesh

mesh: Mesh

The internal mesh used by the post-process

name

name: string

Name of the PostProcess.

onActivate

onActivate: Nullable<function>

A function that is added to the onActivateObservable

onActivateObservable

onActivateObservable: Observable<Camera>

An event triggered when the postprocess is activated.

onAfterRender

onAfterRender: function

A function that is added to the onAfterRenderObservable

Type declaration

    • Parameters

      Returns void

onAfterRenderObservable

onAfterRenderObservable: Observable<Effect>

An event triggered after rendering the postprocess

onApply

onApply: function

A function that is added to the onApplyObservable

Type declaration

    • Parameters

      Returns void

onApplyObservable

onApplyObservable: Observable<Effect>

An event triggered when the postprocess applies its effect.

onBeforeRender

onBeforeRender: function

A function that is added to the onBeforeRenderObservable

Type declaration

    • Parameters

      Returns void

onBeforeRenderObservable

onBeforeRenderObservable: Observable<Effect>

An event triggered before rendering the postprocess

onSizeChanged

onSizeChanged: function

A function that is added to the onSizeChangedObservable

Type declaration

onSizeChangedObservable

onSizeChangedObservable: Observable<PostProcess>

An event triggered when the postprocess changes its size.

renderTargetSamplingMode

renderTargetSamplingMode: number

Sampling mode used by the shader See https://doc.babylonjs.com/classes/3.1/texture

samples

samples: number

Number of sample textures (default: 1)

scaleMode

scaleMode: number

Scale mode for the post process (default: Engine.SCALEMODE_FLOOR)

texelSize

texelSize: Vector2

Gets the texel size of the postprocess. See https://en.wikipedia.org/wiki/Texel_(graphics)

useCustomMeshPosition

useCustomMeshPosition: boolean

Set if the post-process should use a custom position for the light source (true) or the internal mesh position (false)

useDiffuseColor

useDiffuseColor: boolean

weight

weight: number

Controls the overall intensity of each sample

width

width: number

Width of the texture to apply the post process on

Methods

activate

  • Activates the post process by intializing the textures to be used when executed. Notifies onActivateObservable. When this post process is used in a pipeline, this is call will bind the input texture of this post process to the output of the previous.

    Parameters

    • camera: Nullable<Camera>

      The camera that will be used in the post process. This camera will be used when calling onActivateObservable.

    • Optional sourceTexture: Nullable<InternalTexture>

      The source texture to be inspected to get the width and height if not specified in the post process constructor. (default: null)

    • Optional forceDepthStencil: boolean

      If true, a depth and stencil buffer will be generated. (default: false)

    Returns InternalTexture

    The target texture that was bound to be written to.

apply

  • Binds all textures and uniforms to the shader, this will be run on every pass.

    Returns Nullable<Effect>

    the effect corrisponding to this post process. Null if not compiled or not ready.

dispose

  • dispose(camera: Camera): void
  • Disposes the internal assets and detaches the post-process from the camera

    Parameters

    Returns void

getCamera

  • Gets the camera which post process is applied to.

    Returns Camera

    The camera the post process is applied to.

getClassName

  • getClassName(): string
  • Returns string

getCustomMeshPosition

  • Returns the light position for light scattering effect

    Returns Vector3

    The custom light position

getEffect

  • The effect that is created when initializing the post process.

    Returns Effect

    The created effect corrisponding the the postprocess.

getEngine

  • Gets the engine which this post process belongs to.

    Returns Engine

    The engine the post process was enabled with.

getPass

  • Returns the render target texture used by the post-process

    Returns RenderTargetTexture

    The render target texture used by the post-process

isReady

  • isReady(): boolean
  • Get a value indicating if the post-process is ready to be used

    Returns boolean

    true if the post-process is ready (shader is compiled)

isReusable

  • isReusable(): boolean
  • The post process is reusable if it can be used multiple times within one frame.

    Returns boolean

    If the post process is reusable

markTextureDirty

  • markTextureDirty(): void

setCustomMeshPosition

  • setCustomMeshPosition(position: Vector3): void
  • Sets the new light position for light scattering effect

    Parameters

    Returns void

shareOutputWith

  • To avoid multiple redundant textures for multiple post process, the output the output texture for this post process can be shared with another.

    Parameters

    • postProcess: PostProcess

      The post process to share the output with.

    Returns PostProcess

    This post process.

updateEffect

  • updateEffect(defines?: Nullable<string>, uniforms?: Nullable<string[]>, samplers?: Nullable<string[]>, indexParameters?: any, onCompiled?: function, onError?: function): void
  • Updates the effect with the current post process compile time values and recompiles the shader.

    Parameters

    • Optional defines: Nullable<string>

      Define statements that should be added at the beginning of the shader. (default: null)

    • Optional uniforms: Nullable<string[]>

      Set of uniform variables that will be passed to the shader. (default: null)

    • Optional samplers: Nullable<string[]>

      Set of Texture2D variables that will be passed to the shader. (default: null)

    • Optional indexParameters: any

      The index parameters to be used for babylons include syntax "#include[0..varyingCount]". (default: undefined) See usage in babylon.blurPostProcess.ts and kernelBlur.vertex.fx

    • Optional onCompiled: function

      Called when the shader has been compiled.

        • Parameters

          Returns void

    • Optional onError: function

      Called if there is an error when compiling a shader.

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

          • effect: Effect
          • errors: string

          Returns void

    Returns void

useOwnOutput

  • useOwnOutput(): void
  • Reverses the effect of calling shareOutputWith and returns the post process back to its original state. This should be called if the post process that shares output with this post process is disabled/disposed.

    Returns void

Static CreateDefaultMesh

  • CreateDefaultMesh(name: string, scene: Scene): Mesh
  • Creates a default mesh for the Volumeric Light Scattering post-process

    Parameters

    • name: string
    • scene: Scene

    Returns Mesh

    the default mesh

Generated using TypeDoc