postprocessing - v7.0.0-beta.16
    Preparing search index...

    Class DepthPickingPass

    A depth picking pass.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    disposables: Set<Disposable>

    A collection of objects that will be disposed when this pass is disposed.

    IO resources, materials and subpasses will be disposed separately and don't need to be added.

    id: number

    An identifier.

    input: Input

    The input resources of this pass.

    A collection of fullscreen materials that are used by this pass.

    This only needs to be filled if multiple fullscreen materials are used. The initial fullscreenMaterial will automatically be added.

    output: Output

    The output resources of this pass.

    resolution: Resolution

    The current resolution.

    scissor: Scissor

    A rectangular area inside the viewport. Fragments that are outside the area will not be rendered.

    Scissor.enabled to enable the scissor.

    viewport: Viewport

    The viewport.

    Viewport.enabled to enable the viewport.

    Accessors

    • get attached(): boolean

      Indicates whether this pass is currently attached to another pass or a render pipeline.

      Returns boolean

    • set attached(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get autoSRGB(): boolean

      Controls automatic sRGB encoding for low precision output buffers.

      Returns boolean

      true
      
    • set autoSRGB(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get autoSyncDefaultBuffers(): boolean

      Controls whether the settings of the input and output default buffers should be synchronized.

      Returns boolean

      true
      
    • set autoSyncDefaultBuffers(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get enabled(): boolean

      Indicates whether this pass is enabled.

      Returns boolean

      true
      
    • set enabled(value: boolean): void

      Parameters

      • value: boolean

      Returns void

    • get subpasses(): readonly Pass<Material | null>[]

      A list of subpasses.

      Subpasses are included in automatic resource optimizations and will be disposed when the parent pass is disposed. The resolution, viewport and scissor of the subpasses are also kept in sync with the parent pass.

      They also gain access to the following data:

      Returns readonly Pass<Material | null>[]

    • set subpasses(value: Pass<Material | null>[]): void

      Parameters

      Returns void

    Methods

    • Checks if the current renderer supports all features that are required by this pass.

      Override this method to check if the current device supports the necessary features. This method should throw an error if the requirements are not met.

      Returns void

      If the device doesn't meet the requirements.

    • Checks if this pass uses convolution shaders.

      Only works on passes that use a FullscreenMaterial.

      Parameters

      • recursive: boolean

        Controls whether subpasses should be checked recursively.

      Returns boolean

      True if the pass uses convolution shaders.

    • Reads depth at a specific screen position.

      If the mode is set to DepthCopyMode.SINGLE, only one depth value can be picked per frame. Calling this method multiple times per frame will then overwrite the picking coordinates. Unresolved promises will be abandoned.

      Parameters

      • ndc: Vector3 | Vector2

        Normalized device coordinates. Only X and Y are relevant.

      Returns Promise<number>

      A promise that returns the depth.

      const ndc = new Vector3();
      const clientRect = myViewport.getBoundingClientRect();
      const clientX = pointerEvent.clientX - clientRect.left;
      const clientY = pointerEvent.clientY - clientRect.top;
      ndc.x = (clientX / myViewport.clientWidth) * 2.0 - 1.0;
      ndc.y = -(clientY / myViewport.clientHeight) * 2.0 + 1.0;
      const depth = await depthPickingPass.readDepth(ndc);
      ndc.z = depth * 2.0 - 1.0;
      const worldPosition = ndc.unproject(camera);