Skip to content

fix(extensions): FillStyleExtension pattern placement in GlobeView - #10658

Merged
chrisgervang merged 6 commits into
masterfrom
claude/fix-fill-style-globe-GveWO
Nov 3, 2026
Merged

chrisgervang merged 6 commits into
masterfrom
claude/fix-fill-style-globe-GveWO

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator

Follow up of #10657

Background

FillStyleExtension uses geometry.position.xy as the pattern coordinate and project.commonOrigin as uvCoordinateOrigin. Under GlobeView both are sphere-space values, so every pattern collapses into a uniform, nearly transparent dot haze (center alpha about 2/255).

Before After
polygon-pattern-globe: dots and cross-hatch atlas patterns on San Francisco polygons, zoom 11.5 before after
polygon-pattern-mask-globe: same with fillPatternMask: true over a light blue fill before after
fill-pattern-size-units-pixels-zoom-8-globe: procedural dots in pixel units at zoom 8 before after
fill-pattern-antimeridian-map-vs-globe: MapView left, GlobeView right, hatched rectangle across 180° before after

Standalone GlobeView. Before images are the same cases rendered on master; after images are the new goldens and match their MapView twins.

Change List

  • fill-style shader module: compute fill_flatPosition once in DECKGL_FILTER_GL_POSITION with project_common_position_to_flat_continuous(geometry.position, cameraFlatX) and use it for the procedural and raster fill_uv. On the globe the Mercator seam moves to the far side of the camera, so a polygon that spans the antimeridian stays continuous; flat maps are unchanged
  • getPatternUniforms: use getFlatCommonOrigin, which yields [0, 0] on GlobeViewport; period reduction and fp64LowPart unchanged
  • Render tests: polygon-pattern, polygon-pattern-mask and fill-pattern-size-units-pixels-zoom-8 also render under GlobeView via expandViewMatrix; 3 new -globe goldens, map goldens unchanged
  • New golden fill-pattern-antimeridian-map-vs-globe.png: MapView (left) and GlobeView (right) centred on 180°, a hatched rectangle from 150°E to 150°W. Look for evenly spaced hatching across the whole rectangle in both halves
  • Unit test: uvCoordinateOrigin on GlobeViewport and on WebMercatorViewport at zoom 14
  • Documentation: docs/whats-new.md notes GlobeView support; no Remarks added to the extension page

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


Note

Low Risk
Low risk bugfix localized to the FillStyleExtension shader module and uniform calculation, with no impact on existing flat viewport behavior.

Overview
Fixes pattern rendering in FillStyleExtension when using GlobeView, ensuring hatch, dot, and texture atlas patterns project correctly onto the globe surface instead of collapsing into artifacts.

In the vertex shader, vertex coordinates are now projected to flat continuous Mercator space via project_common_position_to_flat_continuous instead of reading 3D sphere coordinates from geometry.position.xy. On the CPU side, getPatternUniforms now uses getFlatCommonOrigin so that GlobeViewport resolves to [0, 0] rather than reusing the 3D spherical commonOrigin.

Also adds unit tests verifying pattern coordinate origin calculations under both WebMercatorViewport and GlobeViewport, along with render regression tests for map vs. globe rendering and antimeridian crossing.

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

@coveralls

coveralls commented Sep 7, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.456% (-0.001%) from 84.457% — claude/fix-fill-style-globe-GveWO into master

@chrisgervang
chrisgervang marked this pull request as ready for review September 20, 2026 21:08
@greptile-apps

greptile-apps Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking pattern jump when panning across 180°.

Findings

  1. P2 Patterns jump across 180° ▶

Summary

Fixes globe fill patterns by converting sphere positions into flat Mercator coordinates.

  • Fill patterns keep their placement when polygons appear on a globe.

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

@chrisgervang
chrisgervang force-pushed the claude/fix-fill-style-globe-GveWO branch 3 times, most recently from cdad5eb to ae8efe9 Compare September 20, 2026 21:53
Comment thread docs/whats-new.md Resolved
@chrisgervang
chrisgervang force-pushed the claude/fix-fill-style-globe-GveWO branch from 0d368b2 to 75da022 Compare September 23, 2026 15:32
Base automatically changed from claude/globe-flat-common-helpers-GveWO to master September 25, 2026 17:34
@chrisgervang
chrisgervang force-pushed the claude/fix-fill-style-globe-GveWO branch from 75da022 to d1d9eea Compare September 25, 2026 17:37
@chrisgervang
chrisgervang force-pushed the claude/fix-fill-style-globe-GveWO branch from d1d9eea to 2eb21e3 Compare October 3, 2026 22:10
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 4, 2026
@chrisgervang
chrisgervang force-pushed the claude/fix-fill-style-globe-GveWO branch from 2eb21e3 to 35b6c24 Compare October 23, 2026 00:22
Fill patterns tile a flat plane, but the shader used geometry.position.xy
directly as the pattern coordinate. Under GlobeView that is the x/y of a
sphere position (radius 256), so raster atlases and procedural patterns
collapsed into a uniform near-transparent haze (centre alpha ~2/255 in the
probe render) instead of alternating per polygon. The CPU side had the
matching bug: uvCoordinateOrigin was taken from project.commonOrigin, which
on the globe is also a sphere-space position.

Fix, on top of the flat common-space helpers from the framework branch:
- shader-module.ts: compute
  `vec2 fill_flatPosition = project_common_position_to_flat(geometry.position)`
  once in vs:DECKGL_FILTER_GL_POSITION and use it for both the procedural
  and the raster fill_uv. Identity for flat projections (no change on
  MapView / OrthographicView), absolute Mercator on the globe.
- getPatternUniforms: `getFlatCommonOrigin(projectUniforms, viewport)` in
  place of commonOrigin, so the origin is [0, 0] on GlobeViewport where the
  flat position is absolute; the period reduction and fp64LowPart are kept.

getPatternUnitScale needs no change: 'pixels' uses viewport.zoom, which
GlobeViewport calibrates against Mercator, and 'meters' uses the constant
Mercator FILL_UV_SCALE, which is the space fill_uv now lives in for both
projections.

Tests:
- fill-pattern.spec.ts: polygon-pattern, polygon-pattern-mask (raster) and
  fill-pattern-size-units-pixels-zoom-8 (procedural) render under MapView
  and GlobeView via expandViewMatrix. The existing map goldens are passed
  through unchanged; +3 globe goldens (threshold 0.985, webgpu skipped).
- fill-style.spec.ts: new #uvCoordinateOrigin test asserting [0, 0] on a
  GlobeViewport and the period-reduced commonOrigin (plus its fp64 low part)
  on a WebMercatorViewport at zoom 14.

Docs: fill-style-extension.md gains a Remarks section on GlobeView support.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
…n on GlobeView

Flatten the pattern coordinate with project_common_position_to_flat_wrapped
around the camera, so a polygon that spans 180 degrees longitude on the
globe no longer interpolates its pattern across a whole world width.
Adds a side-by-side MapView/GlobeView render case centred on the
antimeridian.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FyzWaF5TmQPmGjh3Zr3XL9
@chrisgervang
chrisgervang force-pushed the claude/fix-fill-style-globe-GveWO branch from ed129f1 to 1a03d35 Compare October 23, 2026 00:24
@chrisgervang
chrisgervang requested a review from ibgreen November 3, 2026 17:10

@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 flat pattern coordinates, matching origin handling and camera-relative antimeridian continuity, with raster/procedural render coverage and high-zoom origin assertions. No blocking findings. Current GitHub Actions test workflow passes. Review based on source and CI; tests were not run locally.

@chrisgervang
chrisgervang merged commit 88cfef7 into master Nov 3, 2026
9 checks passed
@chrisgervang
chrisgervang deleted the claude/fix-fill-style-globe-GveWO branch November 3, 2026 18:51
@chrisgervang chrisgervang mentioned this pull request Nov 7, 2026
29 of 30 tasks
chrisgervang added a commit that referenced this pull request Nov 7, 2026
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Released in deck.gl 9.4.2, as #11056 on 9.4.

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