CLASSES
TagsA - Z

PostProcess

PostProcess

Description

class PostProcess

Postprocesses allow you to create 2D effects on top of your scene.

A postprocess is linked to a camera and can be part of a chain of postprocesss where each postprocess use the result of the previous one as input for its own processing.

A tutorial about post process can be found here : https://doc.babylonjs.com/tutorials/how_to_use_postprocessrenderpipeline

Constructor

new PostProcess(name, fragmentUrl, parameters, samplers, options, PostProcessOptions, camera, samplingMode, engine, reusable, defines, textureType, vertexUrl, indexParameters, blockCompilation)

Parameters

Name Type Description
name string The postprocess name
fragmentUrl string The URL of .fragment.fx file where you will code the GLSL shader used for every pixel of the screen
parameters string[] A list of your uniforms parameters
samplers string[] A list of additionnal samplers
options number or PostProcessOptions
camera Camera The given camera
optional samplingMode number Texture.NEAREST_SAMPLINGMODE, Texture.BILINEAR_SAMPLINGMODE or Texture.TRILINEAR_SAMPLINGMODE
optional engine Engine The engine to attach the postprocess.
optional reusable boolean Indicates if the postprocess can be reused multiple times on the same camera
optional defines string
optional textureType number
optional vertexUrl string
optional indexParameters any

Members

name : string

width : number

default : -1

height : number

default : -1

renderTargetSamplingMode : number

default : Texture.NEAREST_SAMPLINGMODE

Other possible values : Texture.BILINEAR_SAMPLINGMODE, Texture.TRILINEAR_SAMPLINGMODE

clearColor : Color4

autoClear : boolean

alphaMode : number

alphaConstants : Color4

enablePixelPerfectMode : boolean

scaleMode : number

alwaysForcePOT : boolean

samples : number

onActivateObservable : Observable<Camera>

An event triggered when the postprocess is activated.

@type {BABYLON.Observable}

onActivate : (camera: Camera) => void

Action to execute just before the postprocess is activated

onSizeChangedObservable : Observable<PostProcess>

An event triggered when the postprocess changes its size.

@type {BABYLON.Observable}

onSizeChanged : (postProcess: PostProcess) => void

Action to execute just before the postprocess' size is changed

onApplyObservable : Observable<Effect>

An event triggered when the postprocess applies its effect.

@type {BABYLON.Observable}

onApply : (effect: Effect) => void

Action to execute just before the postprocess is applied

onBeforeRenderObservable : Observable<Effect>

An event triggered before rendering the postprocess

@type {BABYLON.Observable}

onBeforeRender : (effect: Effect) => void

Action to execute just before the postprocess is rendered

onAfterRenderObservable : Observable<Effect>

An event triggered after rendering the postprocess

@type {BABYLON.Observable}

onAfterRender : (efect: Effect) => void

outputTexture : WebGLTexture

texelSize : Vector2

isSupported : boolean

aspectRatio : number

Methods

getCamera() → Camera

getEngine() → Engine

shareOutputWith(postProcess) → PostProcess

Parameters

Name Type Description
postProcess PostProcess

updateEffect(defines, uniforms, samplers, indexParameters) → void

Parameters

Name Type Description
optional defines string
optional uniforms string[]
optional samplers string[] A list of additionnal samplers

isReusable() → boolean

Tests if the Postprocess is set to reusable

markTextureDirty() → void

activate(camera, sourceTexture, forceDepthStencil) → void

Parameters

Name Type Description
camera Camera The given camera
optional sourceTexture WebGLTexture Optional textures to add
optional forceDepthStencil boolean

apply() → Effect

Applies this postprocess

dispose(camera) → void

Parameters

Name Type Description
optional camera Camera The given camera