CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.91k stars 3.48k forks source link

OSM Buildings broken with multiple viewers #11484

Open ggetz opened 1 year ago

ggetz commented 1 year ago

Originally reported on the forum.

If i create two viewers on the same page and add Osm Buildings to both of them, lots of the building’s polygons get stretched and misplaced, creating a “blob” that covers the entire map.

Sandcastle example

Notes:

  • If you comment out either one of the viewXX.scene.primitives.add(await Cesium.createOsmBuildingsAsync()); lines, the other viewer works perfectly fine.
  • Sometimes, the bug occours on only one of the two viewers, but it never happened to me that both viewers work fine at the same time.
  • I got a similar bug on an old version of cesium when loading OSM Buildings twice in the same viewer, but i can’t manage reproduce consistently.

image

ggetz commented 12 months ago

Also reported in https://github.com/CesiumGS/cesium/issues/11606

ptrgags commented 10 months ago

In #11341 I ran into this when making a Sandcastle.

I determined that it has to do with the CESIUM_primitive_outline extension (which does modify the index buffer). It seems like applying the outlines to the first copy of the tileset messes up the indices for the second copy.

See This Sandcastle

with enableShowOutlines: true on the first tileset copy (messy geometry): image

with enableShowOutlines: false on the second tileset copy (no artifacts): image