Constructs a new depth picking pass.
Optional
options: { The options.
Optional
depthThe depth packing.
Optional
mode?: numberThe depth copy mode.
Protected
cameraThe camera.
Indicates whether this pass is enabled.
The name of this pass.
Only relevant for subclassing.
Indicates whether the EffectComposer should prepare a depth texture for this pass.
Set this to true
if this pass relies on depth information from a preceding RenderPass.
Only relevant for subclassing.
Indicates whether the EffectComposer should swap the frame buffers after this pass has finished
rendering. Set this to false
if this pass doesn't render to the output buffer or the screen. Otherwise, the
contents of the input buffer will be lost.
Protected
rendererThe renderer.
Protected
sceneThe scene to render.
The output depth packing.
The fullscreen material.
Sets the main camera.
Sets the main scene.
Indicates whether this pass should render to screen.
Sets the render to screen flag.
If this flag is changed, the fullscreen material will be updated as well.
The output depth texture.
Performs a shallow search for disposable properties and deletes them.
The EffectComposer calls this method when it is being destroyed. You can use it independently to free memory when you're certain that you don't need this pass anymore.
Performs initialization tasks.
This method is called when this pass is added to an EffectComposer.
The renderer.
Whether the renderer uses the alpha channel or not.
The type of the main frame buffers.
Reads depth at a specific screen position.
Only one depth value can be picked per frame. Calling this method multiple times per frame will overwrite the picking coordinates. Unresolved promises will be abandoned.
Normalized device coordinates. Only X and Y are relevant.
A promise that returns the depth on the next frame.
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);
Copies depth and resolves depth picking promises.
The renderer.
A frame buffer that contains the result of the previous pass.
A frame buffer that serves as the output render target unless this pass renders to screen.
Optional
deltaTime: numberThe time between the last frame and the current one in seconds.
Optional
stencilTest: booleanIndicates whether a stencil mask is active.
Sets the depth texture.
This method will be called automatically by the EffectComposer. You may override this method if your pass relies on the depth information of a preceding RenderPass.
A depth texture.
Optional
depthPacking: DepthPackingStrategiesThe depth packing.
Protected
setSets the size.
You may override this method if you want to be informed about the size of the backbuffer/canvas. This method is called before initialize and every time the size of the EffectComposer changes.
The width.
The height.
A depth picking pass.