Skip to content

Fix Picker depth clear decoding#8651

Merged
mvaligursky merged 1 commit intoplaycanvas:mainfrom
slimbuck:picker-dev
Apr 27, 2026
Merged

Fix Picker depth clear decoding#8651
mvaligursky merged 1 commit intoplaycanvas:mainfrom
slimbuck:picker-dev

Conversation

@slimbuck
Copy link
Copy Markdown
Member

Summary

  • Fixes Picker#getPointDepthAsync() so RGBA8 depth bits are reconstructed as an unsigned 32-bit value.
  • Ensures cleared depth pixels (0xFFFFFFFF) are correctly treated as “no hit” instead of being reinterpreted as NaN.

Details

JavaScript bitwise operations produce signed 32-bit integers. For a cleared depth pixel [255, 255, 255, 255], the previous decode produced -1, so the 0xFFFFFFFF no-depth check failed. This could cause background picks to return a NaN world point.

The fix applies >>> 0 after reconstructing the integer bits.

Test Plan

  • Verified background picks return null instead of a NaN world point.
  • Verified valid object/gsplat picks still return a world-space point.

@slimbuck slimbuck requested review from a team and Copilot April 25, 2026 16:20
@slimbuck slimbuck self-assigned this Apr 25, 2026
@slimbuck slimbuck added the area: graphics Graphics related issue label Apr 25, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes depth decoding in Picker#getPointDepthAsync() so RGBA8-packed float bits are reconstructed as an unsigned 32-bit integer, ensuring cleared depth pixels (0xFFFFFFFF) are correctly treated as “no hit” and do not produce NaN world points.

Changes:

  • Reconstruct RGBA8 depth bits as an unsigned 32-bit value using >>> 0.
  • Restore the intended 0xFFFFFFFF cleared-depth sentinel behavior (returns null).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mvaligursky mvaligursky merged commit 4c9d0cc into playcanvas:main Apr 27, 2026
10 of 12 checks passed
mvaligursky pushed a commit that referenced this pull request Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: graphics Graphics related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants