Quantized Mesh Serving / SceneMode

Hi,

I’m trying to tile and serve quantized mesh terrain data to Cesium JS.

So far, for tiling I have used GitHub - heremaps/tin-terrain: A command-line tool for converting heightmaps in GeoTIFF format into tiled optimized meshes. to create quantized mesh terrain tile pyramid. And for serving up tiles I’m using GitHub - heremaps/quantized-mesh-viewer: Render custom quantized mesh tiles in Cesium.js and debug individual tiles using THREE.js renderer. to view the terrrain.

This is my index.js code:

import { WebMercatorTilingScheme, GeographicTilingScheme, Viewer, WebMercatorProjection, SceneMode, viewerCesiumInspectorMixin, Cartesian3, Math, GeographicProjection} from ‘cesium’
import SurfaceProvider from ‘./surface-provider’

const container = document.getElementById(‘cesium-container’)
const tilingScheme = new GeographicTilingScheme()

const terrainProvider = new SurfaceProvider({
getUrl: (x, y, level) => {
const column = x
const row = tilingScheme.getNumberOfYTilesAtLevel(level) - y - 1

let url = `/example-tiles/${level}/${column}/${row}.terrain`

return url

}
})

const viewer = new Viewer(container, {
mapProjection: new GeographicProjection(),
sceneMode: SceneMode.COLUMBUS_VIEW,
terrainProvider
})

viewer.extend(viewerCesiumInspectorMixin)

viewer.camera.setView({
destination: Cartesian3.fromDegrees(
151.68831554657135,
-32.95005374931968,
20000
),
orientation: {
heading: 0.0,
pitch: -Math.PI_OVER_TWO, // top down view
roll: 0.0
}
})

I’m trying to integrate this into another piece of Cesium JS code which is using SceneMode of SCENE3D. However, it seems changing the SceneMode from COLUMBUS_VIEW to SCENE3D while loading this terrain seems to crash the app.

Does anyone have an idea who to work around this? Thanks!