Cesium Buildings

12 May 2015

Cesium Buildings

Cesium Buildings started at the `OSGeo code sprint in Philadelphia. It is still at an early stage but already allows to display textured buildings on the Cesium globe.

After our Cuardo R&D project based on Three.js we wanted to apply the gained experience to this popular framework as an alternative for the top of Oslandia’s 3D stack.

The implementation is based on Cesium.QuadtreePrimitive that will call a tile provider when a terrain tile comes into view. We implemented a tile provider that delegates the actual loading of the geometries on the tile to a worker thread to keep the main thread responsive. Our tile provider is also responsible for tiles geometry caching to avoid unnecessary strain on the WFS server and faster display. The geometry caching mechanism takes advantage of the quad-tree nature of requests and of the vector nature of data. Texture loading and caching is already handled by Cesium.

The worker thread receives and url with the WFS request as input and returns several arrays (ArrayBuffer) that are transferable objects such that communication cost between the worker and the main thread is kept to a minimum. The arrays describe the vertices positions in Cesium cartesian reference frame, the triangle connectivity along with normals, tangents and bitangents (the latter two are not used by our tile provider for the moment).
A difficulty arises when you try to implement such a worker: it is not possible to importScripts (Cesium is, for the moment, quite monolithic and is meant to be used in the main thread (e.g. it depends on the window among other things)). As a result some Cesium code, needed for coordinates transformations, had to be copied in the worker code.

At this early stage, the plugin as a number of limitations that should be addressed in the future:

  • The geometries in the tile are not packed (i.e. there is one geometry per feature), because of the difficulty of packing the textures.
  • The worker is only able to transform wgg84 coordinates (epsg:4326), so a transformation may be required on the server side.
  • The geometry caching implementation does not provide a cache emptying strategy, therefore memory consumption will increase as the user explores the terrain and care should be taken with big datasets.
  • By oslandia  0 Comments 
  • 3D, Cesium, WFS