Skip to content

fix(extensions): support MaskExtension in GlobeView - #10654

Merged
chrisgervang merged 5 commits into
masterfrom
claude/fix-deckgl-globe-extensions-GveWO
Nov 3, 2026
Merged

chrisgervang merged 5 commits into
masterfrom
claude/fix-deckgl-globe-extensions-GveWO

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Sep 6, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #10657

Background

MaskExtension bails out with a warning when the viewport is a GlobeViewport. The mask texture is rendered into a flat WebMercatorViewport, but under GlobeView geometry.position and Layer.projectPosition() are sphere XYZ, so the bounds uniform and the texture lookup live in different spaces. This PR routes both through the flat common-space helpers.

Before After
mask-effect-globe: green polygons and blue points masked by a rotated quad over a red base, San Francisco at zoom 11.5 before after
mask-effect-inverted-globe: same scene with maskInverted: true before after
mask-effect-globe-world: whole globe at zoom 0.5, blue points masked to the North America quad over a red grid before after

Standalone GlobeView. Before images are the same cases rendered on master, where the mask is a no-op and the masked layers cover everything; after images are the new goldens.

Change List

  • MaskEffect: remove the GlobeView bail-out; join layer bounds through getMercatorReferenceViewport()
  • MaskExtension: flatten the mask viewport bounds like project_common_position_to_flat() (offset-relative on MapView at zoom 12 and above, absolute Mercator on the globe, cartesian on OrthographicView)
  • mask shader module: flatten the sampled position with project_common_position_to_flat(); instance anchors now also honor modelMatrix and non-lng/lat coordinate systems on the globe
  • Render tests: mask-effect and mask-effect-inverted also render under GlobeView, plus a whole-globe case mask-effect-globe-world (3 new goldens, map goldens unchanged). Thin seams between overlapping ScatterplotLayer discs in the globe goldens also appear without the extension; they are a depth interaction with the tessellated polygon on the sphere
  • Unit test: MaskEffect renders a Mercator-fitted mask channel under a real GlobeViewport instead of returning early
  • Documentation: mask-extension.md limitation now describes Web Mercator evaluation; globe-view.md no longer lists MaskExtension as unsupported; docs/whats-new.md GlobeView compatibility bullet

Ran the render spec headless on WebGL, the unit spec, tsc and lint.


Generated by Claude Code


Note

Low Risk
Adds GlobeView support to MaskExtension with no breaking changes to existing MapView masking, backed by unit and render tests.

Overview
Enables MaskExtension to function within GlobeView by evaluating masks in flat Web Mercator space instead of bailing out on geocentric viewports.

MaskEffect now computes layer bounds using a reference Mercator viewport for geospatial views, and MaskExtension projects bounding coordinates into flat common space. The mask shader module flattens vertex and instance anchor positions via project_common_position_to_flat prior to sampling the mask texture.

Documentation and limitations are updated accordingly, and tests are added for mask generation under GlobeViewport as well as visual regression across globe view presets.

Reviewed by Cursor Bugbot for commit 2ac70c9. Bugbot is set up for automated code reviews on this repo. Configure here.

@greptile-apps

greptile-apps Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects the MaskExtension workflow across globe and flat views.

Do not merge until globe lines stop sampling distant masks and the required expected-image descriptions are added.

Findings

  1. P1 Lines sample distant masks ▶
  2. P2 Expected images are not described ▶

Summary

Adds MaskExtension support to GlobeView by rendering masks and looking them up in flat Mercator coordinates.

  • Masks now work on globe layers by using flat Mercator coordinates.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Mask layers] --> B[Mercator bounds]
  B --> C[Flat mask texture]
  D[Globe positions] --> E[Flat Mercator coordinates]
  C --> F[Sample mask]
  E --> F
  F --> G[Keep or discard pixels]
Loading

Reviews (11) · Last reviewed commit: "Merge branch 'master' into claude/fix-de..." · Reviewed by Greptile

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit e68b918. Configure here.

@coveralls

coveralls commented Sep 6, 2026 •

Copy link
Copy Markdown

Coverage Status

No base build to compare — claude/fix-deckgl-globe-extensions-GveWO into master

@chrisgervang
chrisgervang force-pushed the claude/fix-deckgl-globe-extensions-GveWO branch from e68b918 to 631eee4 Compare September 7, 2026 03:39
@chrisgervang
chrisgervang force-pushed the claude/fix-deckgl-globe-extensions-GveWO branch 2 times, most recently from 6d53df6 to c32932e Compare September 25, 2026 17:37
@chrisgervang
chrisgervang force-pushed the claude/fix-deckgl-globe-extensions-GveWO branch from c32932e to 5fb05b1 Compare October 3, 2026 22:10
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 10, 2026
@chrisgervang
chrisgervang force-pushed the claude/fix-deckgl-globe-extensions-GveWO branch from 5fb05b1 to ced7925 Compare October 23, 2026 00:21
vec4 mask_common_position = mask.maskByInstance
? project_position(vec4(geometry.worldPosition, 1.0))
: geometry.position;
mask_texCoords = mask_getCoords(project_common_position_to_flat(mask_common_position));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Lines sample distant masks

On GlobeView, a LineLayer segment from [179, 0] to [181, 0] gets flat coordinates near opposite ends of the Mercator world. Interpolating those coordinates makes the segment's middle sample a mask near Greenwich, even though the line is near the antimeridian. The mask itself need not cross the antimeridian.

Convert the interpolated globe position to Mercator in the fragment shader, or split the geometry at the longitude seam before interpolating.

MaskExtension bailed out with a warning whenever the active viewport was a
GlobeViewport. Root cause: the mask texture is always rendered into a flat
WebMercatorViewport, but under GlobeView `geometry.position` (and
`Layer.projectPosition`) are sphere XYZ, so mask bounds and texture lookups
lived in different coordinate spaces.

Build on the flat common-space helpers from the framework branch so every
side of the mask pipeline agrees on flat (Mercator) common space:

- mask-effect: drop the GlobeView bail-out; join layer bounds through
  getMercatorReferenceViewport(). getRenderBounds()/makeViewport() already
  branch internally for non-flat viewports.
- mask-extension: compute the bounds uniform with projectBoundsToFlatCommon(),
  the CPU twin of the shader's project_common_position_to_flat().
- mask shader: flatten the common-space position (instance anchor via
  project_position, or geometry.position) with
  project_common_position_to_flat() before deriving texture coordinates. No
  projection-mode branch in the extension; the switch point is in core.

Tests: effects.spec.ts renders both mask cases under MapView and GlobeView
via expandViewMatrix (existing map goldens unchanged; +mask-effect-globe,
+mask-effect-inverted-globe) and adds a whole-globe case at zoom 0.5
(+mask-effect-globe-world). mask-effect.spec.ts gains a GlobeViewport case
asserting the effect renders a Mercator-fitted mask (mask.spec.ts is excluded
in vitest.config.ts).

Docs: mask-extension.md describes Mercator evaluation and its limits
(>~70 deg latitude, antimeridian); globe-view.md no longer lists
MaskExtension as unsupported.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
@chrisgervang
chrisgervang force-pushed the claude/fix-deckgl-globe-extensions-GveWO branch from ced7925 to 3bc3360 Compare October 30, 2026 02:33
…lobe-extensions-GveWO

# Conflicts:
#	test/render/test-cases/effects.spec.ts
Comment on lines +336 to +337
// Most of the globe is visible: the mask must still only hide points inside the quad
name: 'mask-effect-globe-world',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Expected images are not described

The new globe render cases lack // Golden: comments. AGENTS.md requires each case to describe what its image should show, so reviewers can check the saved image by eye. Add these descriptions to the expanded mask cases and the whole-globe case before merging.

Context Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@chrisgervang
chrisgervang requested a review from ibgreen November 3, 2026 00:44
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

@greptile re-review

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the Mercator mask bounds and flattened shader lookup, including instance anchors, GlobeViewport unit coverage and normal/inverted render cases. No blocking findings. Current GitHub Actions test workflow passes. Review based on source and CI; tests were not run locally.

@chrisgervang
chrisgervang merged commit b0cd51f into master Nov 3, 2026
9 checks passed
@chrisgervang
chrisgervang deleted the claude/fix-deckgl-globe-extensions-GveWO branch November 3, 2026 19:33
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.

4 participants