API

Class DepthOfFieldBlurPostProcess

The DepthOfFieldBlurPostProcess applied a blur in a give direction. This blur differs from the standard BlurPostProcess as it attempts to avoid blurring pixels based on samples that have a large difference in distance than the center pixel. See section 2.6.2 http://fileadmin.cs.lth.se/cs/education/edan35/lectures/12dof.pdf

Hierarchy (View Summary)

Index
  • Creates a new instance DepthOfFieldBlurPostProcess

    Parameters

    • name: string

      The name of the effect.

    • _scene: Nullable<Scene>

      The scene the effect belongs to (not used, you can pass null)

    • direction: Vector2

      The direction the blur should be applied.

    • kernel: number

      The size of the kernel used to blur.

    • options: number | PostProcessOptions

      The required width/height ratio to downsize to before computing the render pass.

    • camera: Nullable<Camera>

      The camera to apply the render pass to.

    • circleOfConfusion: PostProcess

      The circle of confusion + depth map to be used to avoid blurring across edges

    • imageToBlur: Nullable<PostProcess> = null

      The image to apply the blur to (default: Current rendered frame)

    • samplingMode: number = Texture.BILINEAR_SAMPLINGMODE

      The sampling mode to be used when computing the pass. (default: 0)

    • Optionalengine: any

      The engine which the post process will be applied. (default: current engine)

    • Optionalreusable: boolean

      If the post process can be reused on the same frame. (default: false)

    • textureType: number = Constants.TEXTURETYPE_UNSIGNED_BYTE

      Type of textures used when performing the post process. (default: 0)

    • blockCompilation: boolean = false

      If compilation of the shader should not be done in the constructor. The updateEffect method can be used to compile the shader at a later time. (default: false)

    • textureFormat: number = Constants.TEXTUREFORMAT_RGBA

      Format of textures used when performing the post process. (default: TEXTUREFORMAT_RGBA)

    Returns DepthOfFieldBlurPostProcess

adaptScaleToCurrentViewport: boolean = false

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

alphaConstants: Color4

Sets the setAlphaBlendConstants of the babylon engine

alwaysForcePOT: boolean = false

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

animations: Animation[] = []

Animations to be used for the post processing

autoClear: boolean = true

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

Clear color to use when screen clearing

doNotSerialize: boolean = false

Specifies if the post process should be serialized

enablePixelPerfectMode: boolean = false

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)

externalTextureSamplerBinding: boolean = false

if externalTextureSamplerBinding is true, the "apply" method won't bind the textureSampler texture, it is expected to be done by the "outside" (by the onApplyObservable observer most probably). counter-productive in some cases because if the texture bound by "apply" is different from the currently texture bound, (the one set by the onApplyObservable observer, for eg) some internal structures (materialContext) will be dirtified, which may impact performances

forceAutoClearInAlphaMode: boolean = false

If clearing the buffer should be forced in autoClear mode, even when alpha mode is enabled (default: false). By default, the buffer will only be cleared if alpha mode is disabled (and autoClear is true).

forceFullscreenViewport: boolean = true

Force the postprocess to be applied without taking in account viewport

height: number = -1

Height of the texture to apply the post process on

inspectableCustomProperties: IInspectable[]

List of inspectable custom properties (used by the Inspector)

nodeMaterialSource: Nullable<NodeMaterial> = null

Gets the node material used to create this postprocess (null if the postprocess was manually created)

onActivateObservable: Observable<Camera> = ...

An event triggered when the postprocess is activated.

onAfterRenderObservable: Observable<Effect> = ...

An event triggered after rendering the postprocess

onApplyObservable: Observable<Effect> = ...

An event triggered when the postprocess applies its effect.

onBeforeRenderObservable: Observable<Effect> = ...

An event triggered before rendering the postprocess

onDisposeObservable: Observable<void> = ...

An event triggered when the post-process is disposed

onEffectCreatedObservable: Observable<Effect>

Executed when the effect was created

effect that was created for this post process

onSizeChangedObservable: Observable<PostProcess> = ...

An event triggered when the postprocess changes its size.

renderTargetSamplingMode: number

Sampling mode used by the shader

scaleMode: number = Constants.SCALEMODE_FLOOR

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

ValueTypeDescription
1SCALEMODE_FLOORengine.scalemode_floor
2SCALEMODE_NEARESTengine.scalemode_nearest
3SCALEMODE_CEILINGengine.scalemode_ceiling
uniqueId: number

Gets or sets the unique id of the post process

width: number = -1

Width of the texture to apply the post process on

  • 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

    • cameraOrScene: Scene | Nullable<Camera>

      The camera that will be used in the post process. This camera will be used when calling onActivateObservable. You can also pass the scene if no camera is available.

    • sourceTexture: Nullable<InternalTexture> = null

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

    • OptionalforceDepthStencil: boolean

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

    Returns RenderTargetWrapper

    The render target wrapper that was bound to be written to.

  • Resizes the post-process texture

    Parameters

    • width: number

      Width of the texture

    • height: number

      Height of the texture

    • camera: Nullable<Camera> = null

      The camera this post-process is applied to. Pass null if the post-process is used outside the context of a camera post-process chain (default: null)

    • needMipMaps: boolean = false

      True if mip maps need to be generated after render (default: false)

    • forceDepthStencil: boolean = false

      True to force post-process texture creation with stencil depth and buffer (default: false)

    Returns void

  • Updates the effect with the current post process compile time values and recompiles the shader

    Parameters

    • _defines: Nullable<string> = null

      the post process defines

    • _uniforms: Nullable<string[]> = null

      the post process uniforms

    • _samplers: Nullable<string[]> = null

      the post process samplers

    • Optional_indexParameters: any

      the index parameters

    • OptionalonCompiled: (effect: Effect) => void

      callback called when the shader is compiled

    • OptionalonError: (effect: Effect, errors: string) => void

      callback called if there is an error

    Returns void