Bug in rendering GLB models with multiple meshes in Mapbox
TimoPIM opened this issue · 0 comments
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.
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.