Repository navigation
Conversation
Since the viewport center is the geospatial origin of 'cartesian' positions below zoom 12, their second-order z correction (commonUnitsPerWorldUnit2) is no longer zero away from the equator. project_offset_ multiplies it by the y offset from the origin, but WEB_MERCATOR mode does not offset positions, so below zoom 12 it used the absolute common y: 1,000 m at the viewport center was drawn as 1,000.40 m at latitude 80 and 999.95 m at latitude -80, and as 1,000.00 m from zoom 12. Apply the correction in WEB_MERCATOR_AUTO_OFFSET mode only. A GPU test projects 1,000 m at the viewport center at zoom 11.99 and 12, at latitudes 80, 46.2, 0, -46.2 and -80.
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryRemoves the second-order elevation correction for
Reviews (3) · Last reviewed commit: "fix(core): drop the cartesian second-ord..." · Reviewed by Greptile |
16 of 47 tasks
unitsPerMeter2 is the change of the z scale per meter of y offset, but 'cartesian' offsets are in common units, so from zoom 12 the term changed z by less than a millionth across the view, and the CPU projectPosition never applied it. Drop it in every mode rather than below zoom 12 only, which also removes the second check for offset mode. The CPU continuity test checks the uniform, on WebGPU too.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For #7064. Follow-up to #10790, from ibgreen's note.
Background
Since #10790,
'cartesian'positions below zoom 12 use the viewport center as geospatial origin, so their second-order z correction is nonzero away from the equator. InWEB_MERCATORmode,project_offset_multiplies it by the absolute common y instead of the offset from the center: below zoom 12, 1,000 m at the viewport center is drawn as 1,000.40 m at latitude 80 and 999.95 m at latitude -80, from zoom 12 as 1,000.00 m.Change List
calculateViewportUniforms: no second-order z correction for cartesian positionsunitsPerMeter2is per meter, but cartesian y offsets are in common units, so from zoom 12 it changed z by less than a millionth across the viewRan lint, build, the core shaderlib and viewport, extensions and TerrainLayer headless tests, and the terrain render tests on WebGL.
Note
Low Risk
Low risk adjustment to viewport uniforms for cartesian coordinate systems with comprehensive GPU and uniform tests.
Overview
Removes the second-order z correction (
commonUnitsPerWorldUnit2) forcartesiancoordinates in viewport projection uniforms.Previously, using
unitsPerMeter2for cartesian coordinates scaled with absolute y coordinates below zoom 12, producing an elevation step discontinuity when transitioning to offset mode at zoom 12. Setting this correction to zero ensures continuous z scaling across zoom levels with negligible effect on projection accuracy.Reviewed by Cursor Bugbot for commit 1dec866. Bugbot is set up for automated code reviews on this repo. Configure here.