I have converted UK lidar .tif files to WSG84.tif files and uploaded as cesium ion assets - I am able to use these to get 3d renderings in CesiumJS. I have also downloaded these from cesium ion assets to quantized mesh files and am able to use these with a local server. I now want to be able to produce these directly so have also have tried converting the WGS84.tif files to quantized mesh tiles fand layer.json following process outlined in GitHub - tum-gis/cesium-terrain-builder-docker: Dockerfile for the geo-data/cesium-terrain-builder app with quantized mesh support. - I seem to be loading these generated tiles into cesiumJs but they are not rendering in 3d - the file structure is also different between the versions generated from cesium ion download and ctb generated - any guidance on how I more directly replicate teh downlaod process from cesium ion with ctb would be appreiciated.
@andyp11 CTB is neither created nor maintained by the cesium. Its is developed based on the open source specification of quantized mesh GitHub - CesiumGS/quantized-mesh: Specification for streaming massive terrain datasets for 3D visualization.
I you have corroctly followed the instruction given in CTB to generate the quantized mesh then it should be visible.
Yes output(folder structure) of the both is different. One thing that worked for me is to copy 0-4 folder from cesium ion and paste replace it in CTB. Remember to first delete all the 0-4 in CTB genereated directly otherwise it will not work.
now you have to modify the layer.json file according to new folder structure.
ctb quantized mesh is in z/x/y directory structure
for each z value there is a row in layer.json file 0 to however zoom level(spatial resolution). replace first 5 row with correct startX, startY, endX, endY values.
it will look something like this
[
{
"startX": 0,
"startY": 0,
"endX": 1,
"endY": 0
},
{
"startX": 0,
"startY": 0,
"endX": 3,
"endY": 1
},
{
"startX": 0,
"startY": 0,
"endX": 7,
"endY": 3
},
{
"startX": 0,
"startY": 0,
"endX": 15,
"endY": 7
},
{
"startX": 0,
"startY": 0,
"endX": 31,
"endY": 15
}
]
now save and serve if you see any error in log it would be easier for me guide you.
another tool that I have discoverd for geotiff to qmesh is this GitHub - Gaia3D/mago-3d-terrainer: Official mago-3d-terrainer repository, Java Version of the quantized-mesh Generator
@Aankit_K many thanks for that - the ctb was producing [ { “startX”: 0, “startY”: 0, “endX”: 1, “endY”: 0 } ]
,[ { “startX”: 1, “startY”: 1, “endX”: 1, “endY”: 1 } ]
,[ { “startX”: 3, “startY”: 3, “endX”: 3, “endY”: 3 } ]
,[ { “startX”: 7, “startY”: 6, “endX”: 7, “endY”: 6 } ]
,[ { “startX”: 15, “startY”: 12, “endX”: 15, “endY”: 12 } ]
,[ { “startX”: 31, “startY”: 25, “endX”: 31, “endY”: 25 } ]
,[ { “startX”: 62, “startY”: 51, “endX”: 62, “endY”: 51 } ]
,[ { “startX”: 125, “startY”: 102, “endX”: 125, “endY”: 102 } ]
,[ { “startX”: 251, “startY”: 205, “endX”: 251, “endY”: 205 } ] whereas the cesium ion download was producing the first 5 layers exactly as you have above and then matched the ctb layers after that - when I replaced the first 5 layers with the cesium ion download as you suggested that worked. I used the layer.json that was produced from the cesium ion download. {“attribution”:“”,“bounds”:[-180,-90,180,90],“description”:“”,“extensions”:[“metadata”,“octvertexnormals”],“format”:“quantized-mesh-1.0”,“maxzoom”:17,“metadataAvailability”:10,“minzoom”:0,“name”:“”,“projection”:“EPSG:4326”,“scheme”:“tms”,“tiles”:[“{z}/{x}/{y}.terrain?v={version}”],“version”:“1.1.0”}. Can’t quite understand why the CTB produces a different 5 layers or whether there is a layer.json that would work with the CTB generated ones as per the above? I haven’t yet tried the other tool you suggested but will give it a go as well.
@andyp11 woderful. see zoom levels can go based on the spatial resolution of the tiff sometimes to add more detail upsampling is used. if saptial resolution lies between two fixed resolution as per the TMS cesium ion uses floor value whereas CTB uses ceil value so to my limited knowledge cesium ion and CTB always generates either equal when it spatial res exactly match with TMS or one less(z value) than CTB.
you can generate almost equal output for z directory by replacing ceil with floor hear cesium-terrain-builder/src/Grid.hpp at 455ce87e60302964ca3d4c340d16d80677364307 · ahuarte47/cesium-terrain-builder · GitHub
see cesium ion encodes the child tiles information in the .terrain files itself via extention so layer.json generated by the cesium ion does not have to specify its bound like we did in case of CTB(startX startY endX endY). so while parsing .terrain files generated by the CTB we have to somehow tell the engine that what are the bound of our data. its a old way of doing.