Open City Model / Ion, roof color, shadow z-fighting

I’ve started using the building models from Open City Model imported into Ion. The building models in Open City are not textured or colored.

I can randomly color individual buildings using this code:

var myrng = new Math.seedrandom(‘hello.’); // always use same random sequence (see seedrandom.js)

for (var i = 0; i < tileID.length; i++) {

tileset[i] = viewer.scene.primitives.add( // add my Open City Model assets

  new Cesium.Cesium3DTileset({

     shadows: Cesium.ShadowMode.RECEIVE_ONLY,       // workaround to avoid shadow z-fighting

     url: Cesium.IonResource.fromAssetId(tileID[i])         // tileID[ ] = my Ion assets



tileset[i].style = new Cesium.Cesium3DTileStyle();

tileset[i].style.color = {

  evaluateColor : function(feature, result) {

     return Cesium.Color.clone(Cesium.Color.GRAY.darken(myrng()*0.3+0.4, new Cesium.Color()), result);   // apply random color




  1. Is it possible to color the top plane of each building (like a roof) using .style?

  2. Is it possible to texture the buildings using .style?

  3. There is way too much z-fighting to make shadows useable in this case except in the RECEIVE_ONLY mode. Any suggestions?

The 3D Tiles styling language can let you color individual features, but to color just the top bit of a building you’d need to modify the fragment shader the buildings use, which the style won’t let you.

It sounds like for now you might need to pre-process your data to color/texture it before you tile it. One of the reasons this workflow is preferred is that textures often make up the largest percentage of the file-size of a tileset, so there’s a lot of optimizations that can be done on it while tiling/generated levels of detail. I wrote a bit about that here: