mapbox / mapbox/mapbox-gl-js

Bug in rendering GLB models with multiple meshes in Mapbox

Open
#13,341 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

mapbox-gl-js version: v3.8.0

browser: Chrome

Steps to Trigger Behavior
Add a GLB model with multiple meshes using the new model type in Mapbox.
Observe the rendering result at zoom level 15 or above.
trees-model.zip

Example used: https://docs.mapbox.com/mapbox-gl-js/example/clip-layer-building/

Expected Behavior
The GLB model with multiple meshes should render with the individual meshes correctly, as they would appear in a standard GLTF viewer (like the third image attached).

Actual Behavior
The GLB model renders incorrectly, with all meshes connected and merged improperly, leading to visual glitches.
image

This happens when using the following configuration:

map.addSource(`model-${modelName}-${modelCounter}`, {
  type: 'geojson',
  data: {
    type: 'Feature',
    properties: {
      'model-uri': modelUrl //Put the glb model here
    },
    geometry: {
      coordinates: modelOrigin,
      type: 'Point'
    }
  }
});

map.addLayer({
  id: `layer-${modelName}-${modelCounter}`,
  type: 'model',
  slot: 'middle',
  source: `model-${modelName}-${modelCounter}`,
  minzoom: 15,
  layout: {
    'model-id': ['get', 'model-uri']
  },
  paint: {
    'model-opacity': 1,
    'model-rotation': [0.0, 0.0, 0.0],
    'model-translation': [0, 0, modelAltitude],
    'model-scale': [1, 1, 1],
    'model-color-mix-intensity': 0,
    'model-cast-shadows': true,
    'model-emissive-strength': 0.8
  }
});

The issue only occurs when adding GLB models containing a high number of meshes. Simple GLB's do upload without problems in meshes. The same model appears correctly when viewed in other GLTF viewers.

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

Reproduce the issue with trees-model.zip using the clip-layer-building example and the provided model source and layer configuration at zoom 15 or above. Compare the multi-mesh GLB with a standard GLTF viewer and a simpler GLB. Done means the individual meshes render correctly in Mapbox without the reported merging or visual glitches.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.