How to add contours to cesium tiles?

464 views
Skip to first unread message

George Nicholas

unread,
Mar 16, 2018, 7:03:34 PM3/16/18
to cesium-dev
1. A concise explanation of the problem you're experiencing.
By going through an example in sandcastle, I've isolated code to add a material to terrain that adds contours.  However, when using it locally with my cesium tiles, the controus come up to the tiles and stop.  Basically, everything has contour lines except the thing that needs them, the tile set.  I don't imagine anything's wrong with Cesium, I just can't figure the right configuration.  Been working on this for a week. 


2. A minimal code example. If you've found a bug, this helps us reproduce and repair it.
On my local machine:
var Cesium = require('cesium/Cesium');
require('cesium/Widgets/widgets.css');
var viewer = new Cesium.Viewer('cesiumContainer', {
    terrainProvider: Cesium.createWorldTerrain({
        requestVertexNormals: true //Needed to visualize slope
    })
});

var tileset = new Cesium.Cesium3DTileset({
  });

viewer.scene.primitives.add(tileset);
viewer.zoomTo(tileset);


var contourColor = Cesium.Color.RED.clone();
var contourUniforms = {};


var globe = viewer.scene.globe;
var material;
material = Cesium.Material.fromType('ElevationContour');
contourUniforms = material.uniforms;
contourUniforms.width = 2.0;
contourUniforms.spacing = 5.0;
contourUniforms.color = contourColor;

globe.material = material;


3. Context. Why do you need to do this? We might know a better way to accomplish your goal.
Working on displaying 3d products for our customers in browser with cesium.  We're a photogrammetry company. 


4. The Cesium version you're using, your operating system and browser.
Cesium 1.43
Ubuntu 16.04


Screenshot from 2018-03-16 16-01-55.png

Gabby Getz

unread,
Mar 20, 2018, 9:33:52 AM3/20/18
to cesium-dev
Hi George,

I don't think what you are trying to do is possible, at least at the moment. While terrain can use custom materials (in this case to draw the contour lines), 3D Tiles do not. You can use 3D Tiles Declarative styling (like in this tutorial), but that is more intended for styling individual features.

More customization and more analytically powerful styling is something we are certainly trying to achieve in the future, as well as more closely aligning terrain with the 3D Tiles format.

Thanks,
Gabby

george....@striximaging.com

unread,
Mar 25, 2018, 6:21:19 PM3/25/18
to cesium-dev
Can the tiles be treated as terrain? Basically there would be nothing but the tiles in the model, no background terrain.

If not, I'll look into Declarative stylings in a few weeks, see what I can find out. Do you know of anyone in the cesium community who works on applying cesium to aerial mapping products who I could reach out to for advice?

Gabby Getz

unread,
Mar 27, 2018, 4:34:24 PM3/27/18
to cesium-dev
The globe's terrain and 3D Tiles are treated differently in the engine, so I don't think currently that approach will work.

I've reached out for a contact that could advise you, hopefully I can get back to you soon with that!

George Nicholas

unread,
Apr 4, 2018, 1:13:23 PM4/4/18
to cesium-dev
Thanks!

George Nicholas

unread,
May 3, 2018, 4:57:35 PM5/3/18
to cesium-dev
Hey Gabby, did you ever find out anything more about contour lines on tile sets?


On Tuesday, March 27, 2018 at 1:34:24 PM UTC-7, Gabby Getz wrote:
Reply all
Reply to author
Forward
0 new messages