# GPU Picker: optional picked point and normal reconstruction

**URL:** <https://forum.babylonjs.com/t/gpu-picker-optional-picked-point-and-normal-reconstruction/63632>\
**Category:** Feature requests\
**Tags:** gpupicker\
**Created:** [June 12, 2026, 7:14am UTC](https://forum.babylonjs.com/t/gpu-picker-optional-picked-point-and-normal-reconstruction/63632 "2026-06-12T07:14:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Celeste-twinkle](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/celeste-twinkle/32/50761_2.png) [@Celeste-twinkle](https://forum.babylonjs.com/u/Celeste-twinkle)\
**Post date:** [June 12, 2026, 7:14am UTC](https://forum.babylonjs.com/t/gpu-picker-optional-picked-point-and-normal-reconstruction/63632/1 "2026-06-12T07:14:38Z")

</div>

Hi everyone,

I opened a PR that adds optional depth-based picked point and normal reconstruction to `GPUPicker`:

> <https://github.com/BabylonJS/Babylon.js/pull/18572>
>
> \## Summary
> \- Add optional depth-based pickedPoint and normal reconstruction to G…PUPicker.
> \- Use a MultiRenderTarget depth attachment when depth picking is enabled, with shader macro guards so the default color-only path is unchanged when disabled.
> \- Extend pickAsync, multiPickAsync, and boxPickAsync to return depth-derived point/normal data where available.
> \- Add adaptive multiPickAsync readback options for rectangle vs individual point readbacks.
> 
> \## Context
> This PR follows up on the GPU picking point/normal discussion and example:
> https://forum.babylonjs.com/t/gpu-picking-point-and-normal-example/40965/34
> 
> \## Coordinate scaling note
> \- GPUPicker now maps input/canvas CSS pixel coordinates to render-target pixels using the input element client rect when available, falling back to hardware scaling for non-DOM engines. This preserves the existing default-canvas behavior while improving picking on CSS-scaled canvases.
> 
> \## Validation
> \- npx tsc -p packages/dev/core/tsconfig.build.json --noEmit --pretty false
> \- npm run compile:assets -w @dev/core
> \- npx vitest run packages/dev/core/test/unit/Collisions/babylon.gpuPicker.test.ts --project=unit
> \- npm run test:visualization -- --project=webgl2 --grep "GPUPicker Depth Point and Normal" --update-snapshots

This is based on the idea discussed in the GPU picking point/normal example thread:

> [@GPU picking point and normal example](https://forum.babylonjs.com/t/gpu-picking-point-and-normal-example/40965):
>
> This is an example of using depth textures to pick up world coordinates and normals： [GPU picking point and normal | Babylon.js Playground (babylonjs.com)](https://playground.babylonjs.com/#01U4D7#155) Combined with GPU object pickup, the capability of near ray pickup can be realized： [GPU picking demo - Demos and projects - Babylon.js (babylonjs.com)](https://forum.babylonjs.com/t/gpu-picking-demo/30507) GPU pickup can save CPU performance in complex scenarios. But compared with ray picking, there is a problem of accuracy error. In order to reduce the impact of accuracy errors on the normal…

The feature adds an `enableDepthPicking` switch to `GPUPicker`. When disabled, the existing color-only picking path remains unchanged. When enabled, the default picking shader writes both the picking id and screen-space depth through a `MultiRenderTarget`, allowing the picker to reconstruct:

- `pickedPoint` in world space
- `normal` reconstructed from neighboring depth samples

The new data is available from:

- `pickAsync`
- `multiPickAsync`
- `boxPickAsync`

For `multiPickAsync`, I also added optional readback tuning:

```auto
gpuPicker.multiPickAsync(points, false, {
    readbackStrategy: 0,
    maxIndividualReadbackCount: 32,
    individualReadbackAreaRatio: 16,
});

```

This lets callers choose between a full bounding-rectangle readback and per-point readbacks. The default `auto` mode uses a conservative heuristic, while `rectangle` and `individual` can be forced for profiling or platform-specific tuning.

A few notes:

- The depth path is macro guarded, so depth rendering is not compiled into the default path unless enabled.
- Depth picking uses WebGL2 / WebGPU / Native-capable MRT paths.
- Custom picking materials and special material plugins can return missing or inaccurate point/normal data unless they also write the depth attachment.
- Normals are reconstructed from depth, so they represent the visible depth surface rather than material-authored vertex normals.

I would love feedback on API shape, naming, readback heuristics, and whether the behavior fits Babylon.js expectations.

---

<div class="post-metadata">

**Author:** ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)\
**Post date:** [June 12, 2026, 3:16pm UTC](https://forum.babylonjs.com/t/gpu-picker-optional-picked-point-and-normal-reconstruction/63632/2 "2026-06-12T15:16:56Z")

</div>

Looking at it!!
