Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in rendering GLB models with multiple meshes in Mapbox #13341

Open
TimoPIM opened this issue Dec 4, 2024 · 0 comments
Open

Bug in rendering GLB models with multiple meshes in Mapbox #13341

TimoPIM opened this issue Dec 4, 2024 · 0 comments
Labels

Comments

@TimoPIM
Copy link

TimoPIM commented Dec 4, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants