Display planar vector data on terrain

1. A concise explanation of the problem you’re experiencing.

Hello,

I am trying to display a GeoJSON containing planar data on terrain. If I set clampToGround, GeoJSON fits nicely to ground, but when I zoom-in, the app starts to lag. Moreover, If I add 3D Tiles, the GeoJson is clamped onto 3D tiles instead of terrain.

Lots of vectors containing map data are naturally planar, so I was wondering how to solve this - having the vectors on the terrain but preferably not with the performance penalty.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Sandcastle app: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=ZVRdb9owFP0rFi+EFmwoZV2BVpNaqdLUadNabQ/LHkx8SVwcO7OdoKzqf9/NJ9DlJfH1/Tj33HtScEsKCXuw5IZo2JM7cDJP6Y/aFgyj+nhntOdSgx2OX0NN8LHwJwfnv4MWYL8YAWRJvM1h3Fx7sBYDvllTSHRYdmkjC9zDT2OVeG5cglGo30arUIeanRWIxksFDvwpnOY1v39uLoMWRW7VkoSDxPvMLRmLhKYpKLPXNDIpm4s6F2tMbAOa+1050VxMXuRfsCZnbTH64owOBz2SzoxoRYlNpNIB9QnoYJvryEujg9ZlRFooDYnURaCBZlam0ssCHOVC9L6rusAZq0qEum3tAcxnrH7PPX8yuY2AKsNF0GStnmHXnuV7Gkuf5JvcgY1wJqB93aniQjrFi8TYXck23HsFE7OdzMXE1hOSOp44z6OdY3EyyXiMtHCl8AsLKlf3P8TZvR7KRoqn2bN5QJq0aKdb4X/Hg+hx91Qc0XG4bZg48q6J7twZe8CRY2bCcStKYrYEe0MKwR3lxO3orLgeh1y0s9KCK1zLk9RbY0lQhUqMma7wte6zUAU69gkaz89Hh5CjPhpwTy24BGSceMKRkOqY4i5byVUNl0cJyYwqFerkNL7HXSKCrvQv+Xt16nZ6agLoRiq1MdyKSg+5UsetvfX72rId8RQsp7hqlXw7kQjUqcTVx2mRXoh33Hr84npOt7jf9xBbABfMLunHi8V8sbi6WnwYL6b04np2OcPz9eJyOiazKT502kh2MB6snS8V3DZ1Psk0M9ZXogwoZR7STCFBjm3yaIdiipyr0K5ZF7QWsiBS3ISDd3+ZcFBtn3N4s8Wen1Cs4eB2zdD/JKwSCm721wKs4mXlksxuHxsjpXTN8Ph/lDdGbbg9yvgP

Thanks,

Ladislav

You can tell the polylines (or anything that clamps to ground) to only clamp to either 3D Tiles, terrain, or both. By default it’s both. You can override this with:

entity.polyline.classificationType = Cesium.ClassificationType.TERRAIN;

``

Here’s your Sandcastle modified to do this. We’ve got a blogpost that talks a bit more about the classification system here:

https://cesium.com/blog/2018/11/05/dynamic-3d-tiles-annotations/

I think the long term solution to performance issues with vector data on terrain is to create a “vector 3D Tiles” format which is planned but doesn’t exist yet (see https://github.com/AnalyticalGraphicsInc/3d-tiles#future-work). For now you could try to changing the granularity on the polyline so it creates less segments. It would be less accurate but would improve performance. See:

https://cesiumjs.org/Cesium/Build/Documentation/PolylineGraphics.html?classFilter=PolylineGra#granularity

Hello Omar,

polylines are now correctly clamped to terrain but now they are not visible through the model even if they have entity.polyline.depthFailMaterial set, which confuses me a little.

The depthFailMaterial worked with manually heightcoded data and no clampToGround. I guess I will stay with manually heightcoded JSON for now even though the heightcoding is a little bit inconvenient.

The classification stuff looks cool though.

Thanks, L.

po 25. 3. 2019 v 14:27 odesílatel Omar Shehata omar.sameh.shehata@gmail.com napsal: