Atlaslog
Atlaslog / Cesium / Tutorial / Terrain and imagery layers
Cesium · Tutorial

Terrain and imagery layers

Quick answer

This tutorial treats imagery and terrain as two independent pipelines in CesiumJS and shows how to configure both. It covers ImageryLayerCollection ordering, raiseToTop, alpha, brightness and splitDirection, then compares UrlTemplateImageryProvider, WebMapServiceImageryProvider and WebMapTileServiceImageryProvider. It sets CesiumTerrainProvider.fromUrl with requestVertexNormals, applies terrainExaggeration, and fixes clamped entities with depthTestAgainstTerrain. Readers can assemble a consistent, correctly ordered basemap and terrain stack.

Last verified 2026-11-03 · CesiumJS 1.121 · Cite this page
Key points
Example
var layers = viewer.imageryLayers;
var grid = layers.add(new Cesium.GridImageryProvider({
  color: Cesium.Color.WHITE.withAlpha(0.4),
  glowColor: Cesium.Color.TRANSPARENT,
  backgroundColor: Cesium.Color.fromCssColorString('#16324a').withAlpha(0.5),
  cells: 4
}));

grid.alpha = 0.6;
layers.raiseToTop(grid);
var terrain = await Cesium.CesiumTerrainProvider.fromUrl(
  'https://your-host/terrain/',
  { requestVertexNormals: true, requestWaterMask: false }
);
viewer.terrainProvider = terrain;
viewer.terrainProvider = new Cesium.CustomHeightmapTerrainProvider({
  width: 32,
  height: 32,
  tilingScheme: new Cesium.GeographicTilingScheme(),
  callback: function (x, y, level) {
    var map = new Float32Array(32 * 32);
    return map;
  }
});
Notes
Runnable examplesChinese originalAll Tutorials
English edition written for Atlaslog. Code is taken from the original Chinese page and runs unchanged.
Cite this page

Atlaslog (2026). Terrain and imagery layers. https://www.jingweizhi.com/en/cesium/tutorials/terrain-imagery.html (accessed 2026-11-03).