Skip to content

feat: Row index based picking#10302

Open
ibgreen-openai wants to merge 1 commit into
masterfrom
ib/row-index-based-picking
Open

feat: Row index based picking#10302
ibgreen-openai wants to merge 1 commit into
masterfrom
ib/row-index-based-picking

Conversation

@ibgreen-openai
Copy link
Copy Markdown
Collaborator

@ibgreen-openai ibgreen-openai commented May 14, 2026

row-index based picking

Summary

This PR replaces remaining explicit color-encoded picking buffers with semantic rowIndexes uint32 buffers.

All custom picking attributes are now called rowIndexes and contain canonical uint32 row/feature ids rather than obscure picking colors.

Instead of storing pre-encoded RGB picking colors in pickingColors / instancePickingColors, layers that need custom vertex/instance to row mappings now store the logical object or feature id directly in rowIndexes, and the shader derives the picking color with picking_getPickingColorFromIndex(rowIndexes).

image

Why

rowIndexes are a more natural representation than encoded color bytes:

  • they directly express the logical row/object/feature id used for picking
  • they avoid CPU-side RGB color encoding for explicit picking buffers
  • they use one uint32 value instead of RGB/RGBA byte tuples
  • they are useful beyond picking, for example as indexes into storage buffers or metadata tables

Built-in one-instance-per-object layers still use gl_InstanceID / instance_index. Explicit rowIndexes are only used where the logical picking id differs from the rendered instance id.

What Changed

  • Added rowIndexes as the unified explicit picking-index attribute.
  • Converted special built-in layers from explicit picking color buffers to rowIndexes.
  • Updated GLSL/WGSL shaders to derive picking colors from row indexes.
  • Kept legacy explicit pickingColors / instancePickingColors support in core for compatibility.
  • Updated binary GeoJSON picking helpers from color arrays to uint32 index arrays.
  • Updated custom layer docs and upgrade notes to recommend rowIndexes.

Layer Cases

Layer / Path rowIndexes Represents
PathLayer source path row for each generated segment/joint instance
MultiIconLayer source text row for each generated character instance
SolidPolygonLayer source polygon row, including __source.index for composite data
Binary GeoJSON/MVT points global feature id for rendered point geometry
Binary GeoJSON/MVT lines global feature id for rendered path geometry
Binary GeoJSON/MVT polygons global feature id for rendered polygon geometry
Binary GeoJSON/MVT polygon outlines global feature id for rendered outline geometry
IconLayer / ScatterplotLayer binary hooks caller-provided logical picking index per instance
MeshLayer feature-id picking feature id for each mesh vertex

Testing

  • npx tsc -p modules/core/tsconfig.json --noEmit
  • npx tsc -p modules/layers/tsconfig.json --noEmit
  • `npx t

@ibgreen-openai ibgreen-openai force-pushed the ib/row-index-based-picking branch from 02043f3 to e00bb1f Compare May 14, 2026 22:27
@ibgreen-openai ibgreen-openai force-pushed the ib/row-index-based-picking branch from e00bb1f to f86a146 Compare May 14, 2026 22:58
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 83.384% (-0.03%) from 83.416% — ib/row-index-based-picking into master

@ibgreen-openai ibgreen-openai marked this pull request as ready for review May 15, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants