Terrain Lightning for custom 3D quantized-mesh

Hello all,

recently switch from “default” STK Terrain Server to my custom made q-m terrain ( with Cesium Terrain Builder using Docker image) and everything works just fine, except Terrain Lightning.

As far as I understood ( forgive me if I’m wrong ), that Terrain Lightning data for STK terrain are pre-computed and user only have to choose whether to use it or not.

My question is,
is it, and how, is possible to create Terrain Lightning for custom q-m DEM?

Here is a part of code:

*** ON/OFF Lightning button ***
var light = true;
function lights() {
if (light) {

viewer.scene.globe.enableLighting = true;
} else {
viewer.scene.globe.enableLighting = false;}
light = !light
};

*** Terrain provider ***
var terrainProvider = new Cesium.CesiumTerrainProvider({
// url : ‘//assets.agi.com/stk-terrain/world’, ------------------------------------------- Lightning working
url : ‘http://xxx.xxx.x.xx/Cesium/Apps/ctbtiles/tiles’, ------------------------- Lightning not working
requestVertexNormals: true
});
viewer.terrainProvider = terrainProvider;

Thanks in advance for any help/hint,
Davor

If you haven’t already, check to make sure that your server is serving tiles with vertex normals

Dana subota, 11. ožujka 2017. u 01:58:13 UTC+1, korisnik Sean Lilley napisao je:

If you haven’t already, check to make sure that your server is serving tiles with vertex normals.

Thx for the reply Sean,
unfortunately I have no idea whether the Cesium Terrain Builder generate tiles with vertex normals…

Also I would like to correct myself,
it is not about q-m but about heightmap terrain tiles (!)

Uh… are you sure that’s correct? Last I checked, CTB only supports generating files in the heightmap format, not Q-M. See https://github.com/geo-data/cesium-terrain-builder/issues/29 for the relevant issue, and links to some other tools that have some form of Q-M support.

Drat, my bad. Didn’t read your comment all the way to the end. Yeah, sorry :slight_smile:

Terrain lighting is only possible with quantized mesh as of now.

If your terrain data doesn’t include vertex normals, lighting will not work.

You could modify Cesium’s HeightmapTessellator to compute normals on the fly (it can be done), but that adds computational overhead that is not ideal.

Thank you all !

Manage to override this issue with adding hillshade - generated in QGIS - as layer in WMS.
Not so good in terms of quality, but it’s working…