Skip to content

fix(core): orient GlobeView meter offsets east, north and up (1/2) - #10914

Merged
chrisgervang merged 6 commits into
masterfrom
fix/globe-orientation-matrix
Nov 7, 2026
Merged

chrisgervang merged 6 commits into
masterfrom
fix/globe-orientation-matrix

Conversation

@charlieforward9

@charlieforward9 charlieforward9 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Follow up of #10252. Part 1 of 2: this PR orients globe meter offsets, and #10915 orients their normals.

Since #10791, GlobeViewport applies position east, north and up. The shader's project_get_orientation_matrix builds its x axis as normalize(vec3(uz.y, -uz.x, 0)), which points west, so its frame is west/south/up. Below zoom 12, offsets passed to project_position_to_clipspace are turned half a turn: SimpleMeshLayer and ScenegraphLayer meshes face backwards until GlobeView switches to Web Mercator and they flip. In WGSL, select() has its arguments swapped, so east is always +x and the poles give NaN.

Change List

  • project_get_orientation_matrix: return east, north and up columns
  • WGSL project_get_orientation_matrix: fix swapped select() arguments
  • Globe meter offsets: remove the compensating -xy
  • Poles: east is its limit along the position's longitude
  • @deck.gl/extensions, deck-gpu-layers frame mirrors: match the shader
  • Unit tests
  • Documentation
  • Upgrade guide
    • Apps that turned meshes 180° in GlobeView to compensate must remove that rotation

Verified with headless unit tests on WebGL2 and WebGPU (the new tests fail on master) and the globe render tests (no golden changes).


Note

Medium Risk
Modifies shader coordinate orientation for GlobeView meter offsets, which fixes backwards geometry but may alter rendering for applications that applied compensating rotations.

Overview
Corrects the orientation frame of project_get_orientation_matrix in both GLSL and WGSL shaders so that tangent vectors point east, north, and up (ENU) instead of west, south, and up in GlobeView.

This aligns meter offsets in GlobeView with MapView, eliminating mesh reversals below zoom 12 and removing the compensatory negation of horizontal coordinates in meter-offset projections. It also preserves longitude components at the poles to avoid cosine rounding issues on the GPU, and updates corresponding CPU projection utilities in @deck.gl/extensions and @deck.gl/proposals.

Comprehensive tests are added for WebGL and WebGPU shader projections across orientations and zoom transitions, along with migration guidance in the v9.4 upgrade guide.

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

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge with no new blocking findings.

Summary

Corrects globe meter offsets to point east, north and up in GLSL and WGSL.

  • GlobeView meter offsets now point east, north, and up.

No new actionable issues found. Tests were inspected but not run.

Reviews (8) · Last reviewed commit: "Merge branch 'master' into fix/globe-ori..." · Reviewed by Greptile

Comment thread docs/api-reference/core/project.md Resolved
@charlieforward9 charlieforward9 changed the title fix(core): orient GlobeView meter offsets east, north and up fix(core): orient GlobeView meter offsets east, north and up (1/2) Oct 26, 2026
@coveralls

coveralls commented Oct 26, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.706% (+0.01%) from 84.694% — fix/globe-orientation-matrix into master

@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 current head. CI passes, the prior review comments are resolved, and I found no remaining code blocker. This looks ready for approval once the reported merge conflict with master is resolved.

@chrisgervang chrisgervang mentioned this pull request Oct 29, 2026
29 of 30 tasks
Comment thread docs/upgrade-guide.md Resolved
@chrisgervang

Copy link
Copy Markdown
Collaborator

Do we have a before/after image of the scenegraoh layer?

charlieforward9 and others added 4 commits November 4, 2026 13:12
project_get_orientation_matrix returned columns pointing west and south.
project_position_to_clipspace and project_normal rotate meter offsets by
it, so below zoom 12 GlobeView turned every offset half a turn about the
local up direction: SimpleMeshLayer and ScenegraphLayer meshes, ColumnLayer
angles, and IconLayer and TextLayer with billboard: false. They turned back
at the zoom-12 switch to WebMercatorViewport. The meter-offsets projection
negated x and y to compensate, so it was already correct.

The matrix now returns east, north and up columns, and the meter-offsets
projection no longer negates. At the poles, east is +x, the limit of east
along longitude 0, so a meter-offset origin exactly at a pole now matches
its neighbours instead of being turned half a turn.

The WGSL version passed its select() arguments in the wrong order: away
from the poles x was always +x, and at the poles normalize(vec3(0.0))
gave NaN, including for normals that SimpleMeshLayer and ScenegraphLayer
project before setting geometry.position. It now matches the GLSL.

The CPU mirrors of the frame in @deck.gl/extensions and deck-gpu-layers
follow the new convention; their results are unchanged away from the
poles.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
At a pole, project_get_orientation_matrix returns the limit of east along
the longitude that up retains: GlobeViewport.projectPosition leaves a tiny
horizontal component, so an origin at [90, 90] has east +y. Only an up
exactly on the polar axis takes +x. Say so in the shader comments, the
project docs, the upgrade guide and the deck-gpu-layers mirror, and test
both poles at nonzero longitudes on WebGL and WebGPU. WGSL test literals
now use exponent notation so that those tiny components survive.

The GlobeView SimpleMeshLayer test now finalizes its Deck in a finally
block.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…device

A Deck created without a device builds its own WebGL device in the shared
headless page, which broke uniform block layouts for later test files
(ScreenGridLayer, BrushingExtension, ArcLayer and others). Use the shared
1x1 test device, center the view on each expected location, and keep the
mesh below the camera.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ibgreen
ibgreen force-pushed the fix/globe-orientation-matrix branch from 61d2db6 to 33058af Compare November 4, 2026 18:15

Copy link
Copy Markdown
Member Author

Yes, here’s a before/after comparison using the same ScenegraphLayer model, position and orientation, with matching cameras at each zoom.

Before the fix, the airplane points west at zoom 11.99 and flips east at 12.01. With this fix, it points east in both views, without a compensating rotation.

scenegraph-before-after

@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Nov 7, 2026
@chrisgervang
chrisgervang merged commit 382b739 into master Nov 7, 2026
9 checks passed
@chrisgervang
chrisgervang deleted the fix/globe-orientation-matrix branch November 7, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants