Options
All
  • Public
  • Public/Protected
  • All
Menu

This represents a depth renderer in Babylon. A depth renderer will render to it's depth map every frame which can be displayed or used in post processing

Hierarchy

  • DepthRenderer

Index

Constructors

  • new DepthRenderer(scene: Scene, type?: number, camera?: Nullable<Camera>, storeNonLinearDepth?: boolean, samplingMode?: number, storeCameraSpaceZ?: boolean, name?: string): DepthRenderer
  • Instantiates a depth renderer

    Parameters

    • scene: Scene

      The scene the renderer belongs to

    • Optional type: number

      The texture type of the depth map (default: Engine.TEXTURETYPE_FLOAT)

    • Optional camera: Nullable<Camera>

      The camera to be used to render the depth map (default: scene's active camera)

    • Optional storeNonLinearDepth: boolean

      Defines whether the depth is stored linearly like in Babylon Shadows or directly like glFragCoord.z

    • Optional samplingMode: number

      The sampling mode to be used with the render target (Linear, Nearest...) (default: TRILINEAR_SAMPLINGMODE)

    • Optional storeCameraSpaceZ: boolean

      Defines whether the depth stored is the Z coordinate in camera space. If true, storeNonLinearDepth has no effect. (Default: false)

    • Optional name: string

      Name of the render target (default: DepthRenderer)

    Returns DepthRenderer

Properties

clearColor: Color4

Color used to clear the depth texture. Default: (1,0,0,1)

enabled: boolean

Enable or disable the depth renderer. When disabled, the depth texture is not updated

forceDepthWriteTransparentMeshes: boolean

Force writing the transparent objects into the depth map

isPacked: boolean

Get if the depth renderer is using packed depth or not

reverseCulling: boolean

If true, reverse the culling of materials before writing to the depth texture. So, basically, when "true", back facing instead of front facing faces are rasterized into the texture

useOnlyInActiveCamera: boolean

Specifies that the depth renderer will only be used within the camera it is created for. This can help forcing its rendering during the camera processing.

Methods

  • dispose(): void
  • Disposes of the depth renderer.

    Returns void

  • Gets the texture which the depth map will be written to.

    Returns RenderTargetTexture

    The depth map texture

  • isReady(subMesh: SubMesh, useInstances: boolean): boolean
  • Creates the depth rendering effect and checks if the effect is ready.

    Parameters

    • subMesh: SubMesh

      The submesh to be used to render the depth map of

    • useInstances: boolean

      If multiple world instances should be used

    Returns boolean

    if the depth renderer is ready to render the depth map

  • Sets a specific material to be used to render a mesh/a list of meshes by the depth renderer

    Parameters

    • mesh: AbstractMesh | AbstractMesh[]

      mesh or array of meshes

    • Optional material: Material

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

    Returns void

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static method

Settings

Theme