Building extrusion rendering bugs out when combined with 3D terrain and rasterarray
Nobody has claimed this yet.
- 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.
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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