Skip to main content

Water World

Update: STK World Terrain has been deprecated, see Introducing Cesium World Terrain

The Cesium API supports several streaming terrain providers, enabling global 3D terrain visualization in just a few simple lines of code. Two of Cesium’s publicly available terrain tilesets, the STK World Terrain and smallterrain, are produced and maintained by Analytical Graphics Inc (AGI), the founders and core maintainers of Cesium.

Previously, we could use the smallterrain tileset for water effects, or use the STK World Terrain tileset for access to high resolution terrain and terrain lighting. I’m happy to announce that the STK World Terrain tileset now supports the Watermask feature, previously only available in smallterrain. Here’s a view of Vancouver to see terrain lighting paired with the water effect.

Vancouver

This terrain feature can be enabled in the CesiumTerrainProvider, starting in Cesium 1.7. Turning this feature on follows the same pattern as enabling terrain lighting. When constructing a CesiumTerrainProvider, request the watermask extension from the server, as shown below.

var terrainProvider = new Cesium.CesiumTerrainProvider({
    url : '//assets.agi.com/stk-terrain/world',
    requestWaterMask : true
});
viewer.terrainProvider = terrainProvider;

In addition to gaining more flexibility in generating higher resolution watermasks, we’ve also added antialiasing to produce smoother coastlines. Here’s a side-by-side of the two tilesets with watermasks.

smallterrain

smallterrain

STK World Terrain

STK World Terrain

AGI produces the STK World Terrain tileset using our commercially available product, the STK Terrain Server, developed for creating and hosting streaming terrain in an efficient runtime format. By adding watermask generation to the STK Terrain Server, we are now able to easily produce high resolution tilesets that contain the superset of all terrain visualization features available to Cesium, currently terrain lighting and water effects.

If you’d like to get your feet wet with this new feature, have a look at the updated Cesium Terrain and Water Tutorial or head over to the Sandcastle Terrain example for some live coding.