Please tell us how to improve the terrain relief ?

1. A concise explanation of the problem you’re experiencing.

We have accomplished a Cesium display of this rather large model of a proposed power substation in Wales:

We are asking for your help to use the DEM data that we have (OR the existing Cesium terrain) to show these areas of higher and lower elevation in the terrain relief.

I have run the models through the Cesium Ion tile set creator and that works great.

I also have pushed the DEMs up through Cesium Ion tile set creator, but I do not understand how to use the DEMs in this display.

Could you please show me the code required to add the DEM tile set to the existing display ?

Thank you !

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Here is the code we are using for the viewer:

Hey Kent,

This seems like a really cool application! I hope you succeed in saving the view corridors of this locality.

Terrain exaggeration can definitely help here. All you have to do is pass it to the viewer, so in this example it will multiply all heights by 2:

var viewer = new Cesium.Viewer(‘cesiumContainer’, {

terrainExaggeration : 2.0,

terrainProvider: Cesium.createWorldTerrain()



Taken from this example (

For creating a “tour”, make sure to check out the camera demo ( You should be able to do this really easily using the camera flyTo methods, and it’ll look nice and smooth.

Let me know if that helps!

Thanks very much for this reply !

I have incorporated the suggested string for terrain exaggeration.

The terrain does indeed seem to be enhanced in the vertical dimension, to better show the terrain relief.

The tile set is now buried below the terrain, and is not visible.

Should I add variable(s) to raise the tile set ? If so, please suggest the proper code.

OR is this method of creating a tile set from the model (which has the geo-location in it) not going to work with terrain exaggeration ?

Please let me know.

Kent Morrison


Also, I am trying to figure out the sequence of code required to combine the tile set viewer and the camera fly-to.

Please tell me how to use a camera fly-to sequence such as this one from the demo:

That’s an interesting edge case! I think you might need to get the terrain height yourself and push the tileset accordingly.

You can adjust the height of a tileset by changing its model matrix:

var height = 20; // Push it 20 meters up

var cartographic = Cesium.Cartographic.fromCartesian(;

var surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0.0);

var offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height);

var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());

tileset.modelMatrix = Cesium.Matrix4.fromTranslation(translation);


This is taken from this Sandcastle example:

To get terrain height you can use sampleTerrainMostDetailed like in this example , but it looks like it doesn’t take into account the terrain exaggeration, so you might have to multiply that to the height you get yourself. Does that make sense?

Finally, for the fly camera sequences, here’s an example I had from a different thread, to fly to a box, and then tilt. It’s a bit simpler and it shows you how you can string along these various flyTo commands to create a smooth tour.

Let me know if that helps!

We are excited to show you this hybrid visualization.

We dloaded DEM data for the region and pushed that through the Cesium Ion tile set creator.

And we also made a tile set using the 3D model.

In the course of testing them both together, we have achieved a degree of success.

There are adjustments to make, but this is the furthest that wee have gotten with this project, so far.

Please comment and tell us if you have suggestions for improving this viewer ?

We will eventually have two views of this, one in the higher location proposed by the power project developer, and one in a lower location that we believe will be much less visually obtrusive.

I can’t properly express our gratitude for your help with getting this stuff to work.


Kent Morrison


SORRY I intended to also show you the viewer code:

This is looking great Kent!

One thing I noticed is that you can see the atmosphere flashing while the the terrain loads. This is a bug with logarithmic depth:

Until that gets fixed, you can disable log depth with:

viewer.scene.logarithmicDepthBuffer = false


And that should make the initial smoother. The other thing is that it seems to take a while to load your custom terrain under the buildings. I think that’s because it’s loading terrain far in the distance before the one under the buildings. It makes it load much faster if the camera is facing down, so it might be worth starting the initial camera view to be tilted more downwards, and then maybe after a few seconds delay it can tilt back?

This is looking really great so far! I think your trick with the terrain exaggeration so you can put your own local terrain is pretty clever. I don’t remember if I already suggested this, but did you try combining your terrain with Cesium World Terrain in ion? You can do that when uploading your terrain and choosing Cesium World Terrain as your “base terrain”. I haven’t tried this myself but it might be more efficient/worth a shot. I’m just curious if you already tried that and ran into problems with it?

I’m excited to see where this goes! You should be able to add HTML buttons that trigger JavaScript code to set a view, or add/remove buildings. You could also potentially do something like this 2 synced views demo:

Although I think if the two proposals are in different locations, having a button that flies to each site would work better.

Yes I was thrilled with this level of success !

And I want to provide you with effective feedback and answers to your questions, so that incorporate our trial and error results into your knowledge.

  1. I added the code to turn of depth buffer, that is live and seems to work.

  2. I tilted the “pitch” of the camera from -9 to -18 and that seems to change the view a bit and it does load the foreground terrain better !

  3. I cannot remember if I merged the uploaded DEM with default or Cesium terrain, and I do not know how to determine that from the assets list in Cesium Ion.

Biggest problem is that we are going back to the default Cesium terrain with no DEM added because the terrain is WAY too hilly (not at all realistic) with the DEM in place.

I’ll still be using the methods for other viewers on other projects, but I think for this one we are going back to the default Cesium terrain with some exaggeration.

There will be a slightly more elaborate model in the final product.

HERE is the demo viewer style that we are probably going with, it will be used on a different website by Monday.

Thanks again for providing this feedback of your experience Kent, it’s definitely super valuable to us!