Repository navigation
fix(extensions): support MaskExtension in GlobeView - #10654
Conversation
[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. FindingsSummaryAdds
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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.
e68b918 to
631eee4
Compare
6d53df6 to
c32932e
Compare
c32932e to
5fb05b1
Compare
5fb05b1 to
ced7925
Compare
| 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)); |
There was a problem hiding this comment.
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
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
ced7925 to
3bc3360
Compare
…lobe-extensions-GveWO # Conflicts: # test/render/test-cases/effects.spec.ts
| // Most of the globe is visible: the mask must still only hide points inside the quad | ||
| name: 'mask-effect-globe-world', |
There was a problem hiding this comment.
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!
|
@greptile re-review |
ibgreen
left a comment
There was a problem hiding this comment.
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.

Follow up of #10657
Background
MaskExtensionbails out with a warning when the viewport is aGlobeViewport. The mask texture is rendered into a flatWebMercatorViewport, but underGlobeViewgeometry.positionandLayer.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.mask-effect-globe: green polygons and blue points masked by a rotated quad over a red base, San Francisco at zoom 11.5mask-effect-inverted-globe: same scene withmaskInverted: truemask-effect-globe-world: whole globe at zoom 0.5, blue points masked to the North America quad over a red gridStandalone
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 throughgetMercatorReferenceViewport()MaskExtension: flatten the mask viewport bounds likeproject_common_position_to_flat()(offset-relative onMapViewat zoom 12 and above, absolute Mercator on the globe, cartesian onOrthographicView)maskshader module: flatten the sampled position withproject_common_position_to_flat(); instance anchors now also honormodelMatrixand non-lng/lat coordinate systems on the globemask-effectandmask-effect-invertedalso render underGlobeView, plus a whole-globe casemask-effect-globe-world(3 new goldens, map goldens unchanged). Thin seams between overlappingScatterplotLayerdiscs in the globe goldens also appear without the extension; they are a depth interaction with the tessellated polygon on the sphereMaskEffectrenders a Mercator-fitted mask channel under a realGlobeViewportinstead of returning earlymask-extension.mdlimitation now describes Web Mercator evaluation;globe-view.mdno longer lists MaskExtension as unsupported;docs/whats-new.mdGlobeView compatibility bulletRan the render spec headless on WebGL, the unit spec,
tscand 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
MaskExtensionto function withinGlobeViewby evaluating masks in flat Web Mercator space instead of bailing out on geocentric viewports.MaskEffectnow computes layer bounds using a reference Mercator viewport for geospatial views, andMaskExtensionprojects bounding coordinates into flat common space. Themaskshader module flattens vertex and instance anchor positions viaproject_common_position_to_flatprior to sampling the mask texture.Documentation and limitations are updated accordingly, and tests are added for mask generation under
GlobeViewportas 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.