In December Cesium participated in the Open Geospatial Consortium (OGC) Testbed 13 Initiative. OGC Testbeds are fast-paced, multi-stakeholder collaborative efforts that bring together sponsoring organizations and participants. The goals of the testbed include design, development, and testing specifications. Participants also get to experiment with new architectural approaches. The testbed serves as a rapid prototyping environments for geospatial technological challenges.
Over the course of the Testbed 13 event, we added CityGML as a supported input format to our tiling pipeline for the upcoming Cesium ion. The tiling pipeline converts large city-scale geolocated datasets, including CityGML and KML/COLLADA, into 3D Tiles.
CityGML is an OGC standard for the modeling and exchange of 3D city and landscape information. It has been gaining significant popularity with governments and organizations across the world. The CityGML website lists over 15 cities that have created open CityGML data. Datasets like New York from DoITT and Berlin from Berlin Location Center are great examples.
While CityGML is a versatile and exhaustive data storage and exchange format for city infrastructure and landscapes, storing data in large XML files does not lend itself very well to high performance streaming and rendering.
This requires converting CityGML to a runtime format such as 3D Tiles. It is also crucial to not lose any semantic information during this conversion, as that is a key feature of CityGML.
An overview of the Cesium.com 3D Tiling pipeline.
The 3D Tiling pipeline supports regular CityGML models, such as buildings, as well as implicit models such as trees, lamps, city furniture, etc. For buildings and other regular models we use batched tiles (.b3dm), while implict models are converted to instanced tiles (.i3dm). This allows us to batch and combine the data into optimal tiles from both a streaming and a rendering perspective.
3D Tiles Batched 3D Model Tiles are used for CityGML buildings and other models in each tile. Each batched tile can contain numerous objects and their metadata. If each building’s glTF were to be stored independently per tile, this would significantly affected runtime performance and make it considerably slower. Combining buildings into a single model drastically improves runtime performance by reducing the rendering overhead.
Instanced trees and lamps from the GEORES CityGML LOD3 model.
The most efficient way to handle implicit models is to separate the model from the tile using3D Tiles Instanced 3D Model. This way, multiple tiles across the tileset can use the same model. It improves streaming by eliminating querying and transferring duplicate models, and also improves runtime performance by using the same model for rendering, which in turn reduces memory consumption.
Within the spatial bounding volume of each tile, there may be a batched tile for buildings and multiple instanced tiles. We can combine the batched and instanced tiles from the same bounding volume into a single composite tile (.cmpt). This results in fewer web requests per tile (i.e., 1 request per tile), significantly enhancing streaming performance by reducing the number of requests.
Once the models have been combined into batched and instanced tiles, the attribute information of each model is preserved using the 3D Tiles Batch and Feature tables. This allows picking, styling, and querying as if each building were its own model.
CityGML model of the Reichstag (left); Statue of Liberty with Properties displayed (right).
One aspect of generating building data for cities is placing the buildings on digital terrain models. Most CityGML datasets either do not map to any terrain or have pre-computed heights for a single terrain model.
The 3D Tiling pipeline makes it possible to place buildings on any terrain data. The terrain elevation at the location of the object can be applied as an offset to the models, thus presenting a realistic visualization of the CityGML data on any terrain.
The models are then further processed to add a skirt to enclose any gaps between the building and terrain due to elevation changes.
CityGML Datasets can be vastly different from one another. For example, a dataset with textures requires a very different approach than one without textures. Another example would be an urban area with dense data versus a dataset that consists mostly of sparse suburbs.
For this reason, the 3D Tiling pipeline has multiple tiling schemes to choose from. Adaptive tiling takes into account the spatial information as well as geometry, texture, and other information to create a tileset that has the best streaming and rendering performance. The adaptive tiler creates higher priorities for larger buildings that are visible from farther away and loads the smaller buildings only when required.
Other tiling schemes include uniform grid, non-uniform grid, georeferenced (based on WGS84), and TMS Web Mercator, which take spatial coherence into account and produce tilesets that line up with common tiling algorithms.
Performance is vital to a good experience of 3D data. To achieve this we optimize our 3D Tiling pipeline and produce tilesets that have the best runtime optimizations.
To improve offline conversion, we take full advantage of multithreading, using it to load CityGML files asynchronously and for multithreaded processing. This results in minimal latency between reading and processing. We also minimize disk IO to maintain a high throughput.
Runtime performance can be improved by choosing the right geometry and rendering optimizations and by reducing the tileset size, which in turn improves streaming performance.
On the rendering front, the key is to reduce the number of draw calls. The first optimization is to batch models so that multiple buildings can be rendered in a single draw call. We also create texture atlases so that we can reduce the number of draw calls potentially down to 1.
A texture atlas for tile containing the Reichstag building of the Berlin CityGML model.
Another challenge of textured models is that if the textures are of high quality, the memory available on the GPU becomes a significant cost. Textures in the Berlin dataset can easily run into hundreds of megabytes just for a few buildings.
To solve this problem, multiple levels of each tile were created, each with a different level of scaling applied to the textures. The tiles at a higher level were scaled down more than the leaf tiles, which were not scaled. Scaling down the textures made the GPU memory usage much more efficient while maintaining visual quality.
Comparison of visual quality with texture scaling on the Reichstag CityGML model.
To reduce tileset size and improve streaming performance, we use quantized vertices, oct-encoded normals, and compressed texture coordinates to reduce the footprint of each tile on the GPU as well as disk. Additionally, we gzip data, which reduces the size and the streaming overhead. All of these optimizations have little-to-no negative impact on runtime performance.
Combining these techniques, the size of non-gzipped New York 3D Tiles dataset was reduced from 3.01GB to 1.43GB a reduction of 53%. The gzipped dataset was reduced from 780MB to 483MB. There was no noticeable difference in processing for offline conversion.
A view of Manhattan from the New York City DoITT CityGML dataset in Cesium.
A bird's eye view of New York City and its boroughs.
Manhattan buildings colored based on height using 3D Tiles styling.
Textured CityGML model of the Reichstag (left); Menschen Museum and Fernsehturm (TV Tower) (right).
Untextured CityGML model of the Reichstag (left); Menschen Museum and Fernsehturm (TV Tower) (right).
Berlin buildings colored based on latitude using 3D Tiles styling.
Berlin colored using distance from the Reichstag (bottom center) using 3D Tiles styling.
We have a live demo of New York CityGML Dataset with STK World Terrain on Cesium.com that you can explore.
We are excited to add open standards like CityGML to our 3D Tiling pipeline. If you have any 3D geospatial data, CityGML, point clouds, photogrammetry or anything else, that you would like to visualize, get in touch with us!