mapbox / mapbox/mapbox-gl-js

Building extrusion rendering bugs out when combined with 3D terrain and rasterarray

Open
#13,491 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :lady_beetle:
Dominant language
TypeScript
Stars
12.4k
Forks
2.4k
PR merge metrics
No merged PRs in 30d

Description

**mapbox-gl-js version**: 3.12.0

**browser**: Safari 18.5 and Firefox 138.0.4 on MacOS 15.5

### Steps to Trigger Behavior

1. Open the demo Map via the link below
2. Pan North (up) without zooming, at least a few full screen heights
3. Observe rendering glitches and subsequent failure to render building extrusions properly (see screenshots)

### Link to Demonstration

This map style is based on the Standard basemap. We modify only the terrain exaggeration to stay on through the upper zoom levels (default behavior is to enable only in the mid-range zoom levels). Then we add our rasterarray produced with Raster MTS.

[Demonstration map](https://api.mapbox.com/styles/v1/sphericalstudio/cmb8rudah00mt01rkfwdw2b02.html?title=view&access_token=pk.eyJ1Ijoic3BoZXJpY2Fsc3R1ZGlvIiwiYSI6ImNsMXZ3cWg1bzJtZzAzZm1vZmdrd25jNXUifQ.CzQEHB0ezuWYC7YsCirOPA&zoomwheel=true&fresh=true#15.78/34.032693/-118.244514/0/64)

### Expected Behavior

Users should be able to pan around the map at high zoom levels without any visual glitches. In a [duplicated demonstration](https://api.mapbox.com/styles/v1/sphericalstudio/cmb8rudah00mt01rkfwdw2b02.html?title=view&access_token=pk.eyJ1Ijoic3BoZXJpY2Fsc3R1ZGlvIiwiYSI6ImNsMXZ3cWg1bzJtZzAzZm1vZmdrd25jNXUifQ.CzQEHB0ezuWYC7YsCirOPA&zoomwheel=true&fresh=true#15.78/34.032693/-118.244514/0/64) map, we remove the rasterarray layer and observe normal behavior.

### Actual Behavior

Panning the map at high zoom levels (~z15.5) over terrain causes the elevation in some areas of the map to eventually "drop out". In Safari only, we see a telling console error and stacktrace. Subsequently, building extrusions fail to render properly for all/most of the map until a browser refresh.

Image

Image

Image

In Safari, the following error appears in the console at the onset of unexpected behavior.

```
[Error] WebGL: INVALID_OPERATION: texSubImage2D: pixels is not TypeUint8 or TypeUint8Clamped
texSubImage2D
update (mapbox-gl.js:40:89622)
Wo (mapbox-gl.js:44:500295)
_prepareDEMTextures (mapbox-gl.js:44:519721)
updateTileBinding (mapbox-gl.js:44:519000)
render (mapbox-gl.js:44:696187)
_render (mapbox-gl.js:44:819168)
(anonymous function) (mapbox-gl.js:44:826427)
```

The following networks errors were present, though they seem benign (chronological).

```
POST https://events.mapbox.com/events/v2
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/15/5623/13070.mrt
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/15/5623/13071.mrt
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/14/2811/6535.mrt
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/14/2809/6535.mrt
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/14/2810/6535.mrt
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/15/5623/13072.mrt
GET https://api.mapbox.com/rasterarrays/v1/sphericalstudio.prod-flood-risk/14/2810/6536.mrt
GET https://api.mapbox.com/v4/mapbox.mapbox-bathymetry-v2,mapbox.mapbox-streets-v8,mapbox.mapbox-terrain-v2,mapbox.mapbox-models-v1/15/5623/13080.vector.pbf
```

The GET requests for rasterarray tiles appear to be cancelled, rather than failed requests.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked demonstration and the Safari console stack trace in mapbox-gl.js, especially _prepareDEMTextures and updateTileBinding. Compare behavior with the rasterarray layer enabled and removed while panning at high zoom over terrain. Done means the reproduction no longer produces the texSubImage2D error, elevation dropout, or persistent building-extrusion failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
computer-graphics, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.