Skip to content

fix(layers): keep IconLayer and TextLayer visible on globe projections - #10822

Closed
wldalx wants to merge 2 commits into
visgl:masterfrom
hulaearth:fix/icon-layer-globe
Closed

wldalx wants to merge 2 commits into
visgl:masterfrom
hulaearth:fix/icon-layer-globe

Conversation

@wldalx

@wldalx wldalx commented Oct 9, 2026 •

Copy link
Copy Markdown

Closes #9777

Background

Globe back-face culling incorrectly hides icons, text glyphs and text backgrounds because their shaders flip Y, reversing triangle winding.

Change List

  • Correct IconLayer winding for icons and text glyphs
  • Correct TextBackgroundLayer GLSL/WGSL winding, preserving content-box backgrounds
  • Add text-layer-globe golden image for background visibility
  • Release test WebGL contexts to prevent context exhaustion
  • Unit tests: MapLibre projections, overlay modes, billboarding and picking
  • Render tests: globe text and backgrounds on WebGL/WebGPU

Note

Medium Risk
Shader and geometry winding changes affect all IconLayer and text-background rendering paths; behavior is intentionally scoped but could alter edge-case appearance outside globe view.

Overview
Fixes icons and text backgrounds disappearing on globe projections when back-face culling is enabled. Vertex shaders flip Y, which had reversed triangle winding so quads were treated as back-facing.

IconLayer reorders the shared quad positions triangle-strip so winding stays front-facing after the Y flip. TextBackgroundLayer (GLSL and WGSL) derives a corner UV that mirrors Y only for natural-bounds paths (instanceClipRect.w < 0), keeping content-box backgrounds unchanged while fixing winding for the flip-Y path.

Adds MapLibre integration tests (mercator and globe, interleaved overlays, billboard on/off) that assert label pixels, text background visibility, and picking; non-interleaved runs explicitly release WebGL contexts to avoid exhausting browser limits.

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

Reverse icon quad winding to account for the vertex shader's y-axis flip so globe back-face culling preserves visible icons.

Add MapLibre 5 and 6 regression coverage for Mercator and globe rendering, overlaid and interleaved modes, billboard settings, and picking.
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

This PR corrects triangle winding so globe back-face culling keeps icons, text glyphs, and text backgrounds visible.

  • Reorders the IconLayer quad without changing its texture mapping.
  • Updates both background shaders while preserving content-box bounds.
  • Adds MapLibre checks for projection, overlay mode, billboarding, visibility, and picking.
  • Releases separate WebGL contexts after each overlay test.

The current head does not descend from the previous reviewed commit, so the full PR diff was reviewed. No previous review threads were supplied. Tests and visual captures were not run; dependencies are not installed.

Reviews (3) · Last reviewed commit: "fix(layers): keep TextLayer backgrounds ..." · Reviewed by Greptile

Correct background winding for automatic and content-box bounds in GLSL and WGSL. Extend the MapLibre regression to text glyphs and backgrounds, and add a GlobeView render test.

Refs visgl#9777
@wldalx
wldalx force-pushed the fix/icon-layer-globe branch from 9b94c78 to 56d078a Compare October 9, 2026 11:47
@wldalx wldalx changed the title fix(layers): keep IconLayer visible on globe projections fix(layers): keep IconLayer and TextLayer visible on globe projections Oct 9, 2026
@chrisgervang

Copy link
Copy Markdown
Collaborator

Thanks for working on this! Closing as a duplicate of #10750, which addresses #9777 along with #9592 and #9554. It includes the same IconLayer winding change, fixes MultiIconLayer glyphs and text backgrounds, and also hides billboarded icons, text and points on the far side of the globe. Without that last part, they would render through the globe once culling no longer removes them.

chrisgervang added a commit that referenced this pull request Oct 10, 2026
Checks that labels, text backgrounds and picking survive back-face culling
under MapLibre's mercator and globe projections, overlaid and interleaved,
on MapLibre 5 and 6. Fails without the front-facing quad order from this PR.

Adapted from #10822 by @wldalx.
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.

IconLayer / TextLayer not rendering under GlobeView (non-Mercator projection)

2 participants