function createElevationBandMaterial(options) {
  const { scene, layers } = options ?? Frozen.EMPTY_OBJECT;

  //>>includeStart('debug', pragmas.debug);
  Check.typeOf.object("options.scene", scene);
  Check.defined("options.layers", layers);
  Check.typeOf.number.greaterThan("options.layers.length", layers.length, 0);
  //>>includeEnd('debug');

  const { context } = scene;
  const entries = createLayeredEntries(layers);
  const entriesLength = entries.length;

  let heightTexBuffer;
  let heightTexDatatype;
  let heightTexFormat;

  const isPackedHeight = !createElevationBandMaterial._useFloatTexture(context);
  if (isPackedHeight) {
    heightTexDatatype = PixelDatatype.UNSIGNED_BYTE;
    heightTexFormat = PixelFormat.RGBA;
    heightTexBuffer = new Uint8Array(entriesLength * 4);
    for (let i = 0; i < entriesLength; i++) {
      Cartesian4.packFloat(entries[i].height, scratchPackedFloat);
      Cartesian4.pack(scratchPackedFloat, heightTexBuffer, i * 4);
    }
  } else {
    heightTexDatatype = PixelDatatype.FLOAT;
    heightTexFormat = context.webgl2 ? PixelFormat.RED : PixelFormat.LUMINANCE;
    heightTexBuffer = new Float32Array(entriesLength);
    for (let i = 0; i < entriesLength; i++) {
      heightTexBuffer[i] = entries[i].height;
    }
  }

  const heightsTex = Texture.create({
    context: context,
    pixelFormat: heightTexFormat,
    pixelDatatype: heightTexDatatype,
    source: {
      arrayBufferView: heightTexBuffer,
      width: entriesLength,
      height: 1,
    },
    sampler: new Sampler({
      wrapS: TextureWrap.CLAMP_TO_EDGE,
      wrapT: TextureWrap.CLAMP_TO_EDGE,
      minificationFilter: TextureMinificationFilter.NEAREST,
      magnificationFilter: TextureMagnificationFilter.NEAREST,
    }),
  });

  const colorsArray = new Uint8Array(entriesLength * 4);
  for (let i = 0; i < entriesLength; i++) {
    const color = entries[i].color;
    color.toBytes(scratchColorBytes);
    colorsArray[i * 4 + 0] = scratchColorBytes[0];
    colorsArray[i * 4 + 1] = scratchColorBytes[1];
    colorsArray[i * 4 + 2] = scratchColorBytes[2];
    colorsArray[i * 4 + 3] = scratchColorBytes[3];
  }

  const colorsTex = Texture.create({
    context: context,
    pixelFormat: PixelFormat.RGBA,
    pixelDatatype: PixelDatatype.UNSIGNED_BYTE,
    source: {
      arrayBufferView: colorsArray,
      width: entriesLength,
      height: 1,
    },
    sampler: new Sampler({
      wrapS: TextureWrap.CLAMP_TO_EDGE,
      wrapT: TextureWrap.CLAMP_TO_EDGE,
      minificationFilter: TextureMinificationFilter.LINEAR,
      magnificationFilter: TextureMagnificationFilter.LINEAR,
    }),
  });

  return Material.fromType("ElevationBand", {
    heights: heightsTex,
    colors: colorsTex,
  });
}
Creates a {@link Material} that combines multiple layers of color/gradient bands and maps them to terrain heights.

The shader does a binary search over all the heights to find out which colors are above and below a given height, and
interpolates between them for the final color. This material supports hundreds of entries relatively cheaply.

@function createElevationBandMaterial

@param {object} options Object with the following properties:
@param {Scene} options.scene The scene where the visualization is taking place.
@param {createElevationBandMaterialBand[]} options.layers A list of bands ordered from lowest to highest precedence.
@returns {Material} A new {@link Material} instance.

@demo {@link https://sandcastle.cesium.com/index.html?src=Elevation%20Band%20Material.html|Cesium Sandcastle Elevation Band Demo}

@example
scene.globe.material = Cesium.createElevationBandMaterial({
    scene : scene,
    layers : [{
        entries : [{
            height : 4200.0,
            color : new Cesium.Color(0.0, 0.0, 0.0, 1.0)
        }, {
            height : 8848.0,
            color : new Cesium.Color(1.0, 1.0, 1.0, 1.0)
        }],
        extendDownwards : true,
        extendUpwards : true,
    }, {
        entries : [{
            height : 7000.0,
            color : new Cesium.Color(1.0, 0.0, 0.0, 0.5)
        }, {
            height : 7100.0,
            color : new Cesium.Color(1.0, 0.0, 0.0, 0.5)
        }]
    }]
});