Quantized Mesh/Heightmap example print out?

First, great job with Cesium. I really like it and begun to become rather active with exploration and usage.

I was wondering if it’s possible to get a print out of the what the values of a tile are prior to being processed by Cesium. I’ve been working on a project where i am attempting to realize some custom terrain data, and it would be nice to know whether or not my reading/writing code is correct, and Cesium will process terrain data correctly.

If i download the two Quantized Mesh root tiles, and run them through my decoding process. I get a lot of information obviously. However i’m not sure if the information is correct.

An example of questionable data is negative numbers within the Vertex Data u array, and no 0 or 32797. Based on the documentation, and the fact that the two tiles are roots, i’m assuming that this information should be present.

Ultimately it would be helpful if there was a simple print out/sheet that displayed what the values are for example .terrain tiles. Below is an example of what i’m looking for/requesting.

EXAMPLE:

**Header: **

centerX=3.905482530786651E-10, centerY=-6378137.0, centerZ=0.0

minimumHeight=-618.6792

maximumHeight=6960.123

boundingSphereCenterX=788.9053541063862

boundingSphereCenterY=-2659.5192093672244

boundingSphereCenterZ=-752.0032882889122

boundingSphereRadius=6381064.568493615

horizonOcclusionPointX=6.0778941306355275E7

horizonOcclusionPointY=-9.925954381079006E23

horizonOcclusionPointZ=0.0

Vertex Data:

Vertex Count: 222

[0/222] U [248] V [248] Height [248]

[1/222] U [624] V [624] Height [624]

[2/222] U [624] V [624] Height [624]

[3/222] U [752] V [752] Height [752]

[4/222] U [792] V [792] Height [792]

[5/222] U [896] V [896] Height [896]

[6/222] U [1264] V [1264] Height [1264]

[7/222] U [1504] V [1504] Height [1504]

[8/222] U [1512] V [1512] Height [1512]

[9/222] U [1572] V [1572] Height [1572]

[10/222] U [1664] V [1664] Height [1664]

[11/222] U [1784] V [1784] Height [1784]

[12/222] U [1872] V [1872] Height [1872]

[13/222] U [1984] V [1984] Height [1984]

[14/222] U [2080] V [2080] Height [2080]

[15/222] U [2192] V [2192] Height [2192]

[16/222] U [2232] V [2232] Height [2232]

[17/222] U [2344] V [2344] Height [2344]

[18/222] U [2432] V [2432] Height [2432]

[19/222] U [2550] V [2550] Height [2550]

[20/222] U [2672] V [2672] Height [2672]

[21/222] U [2784] V [2784] Height [2784]

[22/222] U [2903] V [2903] Height [2903]

[23/222] U [3280] V [3280] Height [3280]

[24/222] U [3280] V [3280] Height [3280]

[25/222] U [3520] V [3520] Height [3520]

[26/222] U [3526] V [3526] Height [3526]

[27/222] U [3532] V [3532] Height [3532]

[28/222] U [3540] V [3540] Height [3540]

[29/222] U [3546] V [3546] Height [3546]

[30/222] U [3556] V [3556] Height [3556]

[31/222] U [3560] V [3560] Height [3560]

[32/222] U [3574] V [3574] Height [3574]

[33/222] U [3590] V [3590] Height [3590]

[34/222] U [3691] V [3691] Height [3691]

[35/222] U [3704] V [3704] Height [3704]

[36/222] U [3712] V [3712] Height [3712]

[37/222] U [3804] V [3804] Height [3804]

[38/222] U [3808] V [3808] Height [3808]

[39/222] U [3928] V [3928] Height [3928]

[40/222] U [4048] V [4048] Height [4048]

[41/222] U [4168] V [4168] Height [4168]

[42/222] U [4280] V [4280] Height [4280]

[43/222] U [4288] V [4288] Height [4288]

[44/222] U [4656] V [4656] Height [4656]

[45/222] U [4656] V [4656] Height [4656]

[46/222] U [4902] V [4902] Height [4902]

[47/222] U [4910] V [4910] Height [4910]

[48/222] U [4918] V [4918] Height [4918]

[49/222] U [4924] V [4924] Height [4924]

[50/222] U [4936] V [4936] Height [4936]

[51/222] U [4948] V [4948] Height [4948]

[52/222] U [4952] V [4952] Height [4952]

[53/222] U [4956] V [4956] Height [4956]

[54/222] U [4960] V [4960] Height [4960]

[55/222] U [5084] V [5084] Height [5084]

[56/222] U [5196] V [5196] Height [5196]

[57/222] U [5216] V [5216] Height [5216]

[58/222] U [5332] V [5332] Height [5332]

[59/222] U [5444] V [5444] Height [5444]

[60/222] U [5564] V [5564] Height [5564]

[61/222] U [5684] V [5684] Height [5684]

[62/222] U [5804] V [5804] Height [5804]

[63/222] U [5924] V [5924] Height [5924]

[64/222] U [6300] V [6300] Height [6300]

[65/222] U [6300] V [6300] Height [6300]

[66/222] U [6540] V [6540] Height [6540]

[67/222] U [6660] V [6660] Height [6660]

[68/222] U [6676] V [6676] Height [6676]

[69/222] U [6684] V [6684] Height [6684]

[70/222] U [6692] V [6692] Height [6692]

[71/222] U [6696] V [6696] Height [6696]

[72/222] U [6704] V [6704] Height [6704]

[73/222] U [6716] V [6716] Height [6716]

[74/222] U [6828] V [6828] Height [6828]

[75/222] U [6840] V [6840] Height [6840]

[76/222] U [6948] V [6948] Height [6948]

[77/222] U [7068] V [7068] Height [7068]

[78/222] U [7188] V [7188] Height [7188]

[79/222] U [7300] V [7300] Height [7300]

[80/222] U [7308] V [7308] Height [7308]

[81/222] U [7676] V [7676] Height [7676]

[82/222] U [7916] V [7916] Height [7916]

[83/222] U [8284] V [8284] Height [8284]

[84/222] U [8532] V [8532] Height [8532]

[85/222] U [8548] V [8548] Height [8548]

[86/222] U [8556] V [8556] Height [8556]

[87/222] U [8564] V [8564] Height [8564]

[88/222] U [22371] V [22371] Height [22371]

[89/222] U [36314] V [36314] Height [36314]

[90/222] U [36334] V [36334] Height [36334]

[91/222] U [36334] V [36334] Height [36334]

[92/222] U [33769] V [33769] Height [33769]

[93/222] U [37101] V [37101] Height [37101]

[94/222] U [31340] V [31340] Height [31340]

[95/222] U [31464] V [31464] Height [31464]

[96/222] U [31584] V [31584] Height [31584]

[97/222] U [31704] V [31704] Height [31704]

[98/222] U [31828] V [31828] Height [31828]

[99/222] U [35277] V [35277] Height [35277]

[100/222] U [38486] V [38486] Height [38486]

[101/222] U [38602] V [38602] Height [38602]

[102/222] U [38722] V [38722] Height [38722]

[103/222] U [38738] V [38738] Height [38738]

[104/222] U [38850] V [38850] Height [38850]

[105/222] U [38858] V [38858] Height [38858]

[106/222] U [38874] V [38874] Height [38874]

[107/222] U [38882] V [38882] Height [38882]

[108/222] U [38898] V [38898] Height [38898]

[109/222] U [39018] V [39018] Height [39018]

[110/222] U [39026] V [39026] Height [39026]

[111/222] U [39042] V [39042] Height [39042]

[112/222] U [39162] V [39162] Height [39162]

[113/222] U [39162] V [39162] Height [39162]

[114/222] U [39282] V [39282] Height [39282]

[115/222] U [39390] V [39390] Height [39390]

[116/222] U [39402] V [39402] Height [39402]

[117/222] U [39514] V [39514] Height [39514]

[118/222] U [39634] V [39634] Height [39634]

[119/222] U [39750] V [39750] Height [39750]

[120/222] U [39866] V [39866] Height [39866]

[121/222] U [39866] V [39866] Height [39866]

[122/222] U [33213] V [33213] Height [33213]

[123/222] U [26184] V [26184] Height [26184]

[124/222] U [26184] V [26184] Height [26184]

[125/222] U [26184] V [26184] Height [26184]

[126/222] U [26424] V [26424] Height [26424]

[127/222] U [26544] V [26544] Height [26544]

[128/222] U [26572] V [26572] Height [26572]

[129/222] U [26576] V [26576] Height [26576]

[130/222] U [26584] V [26584] Height [26584]

[131/222] U [26600] V [26600] Height [26600]

[132/222] U [26720] V [26720] Height [26720]

[133/222] U [26840] V [26840] Height [26840]

[134/222] U [26928] V [26928] Height [26928]

[135/222] U [26928] V [26928] Height [26928]

[136/222] U [27304] V [27304] Height [27304]

[137/222] U [27304] V [27304] Height [27304]

[138/222] U [27304] V [27304] Height [27304]

[139/222] U [27480] V [27480] Height [27480]

[140/222] U [27606] V [27606] Height [27606]

[141/222] U [27732] V [27732] Height [27732]

[142/222] U [27744] V [27744] Height [27744]

[143/222] U [27868] V [27868] Height [27868]

[144/222] U [27912] V [27912] Height [27912]

[145/222] U [28024] V [28024] Height [28024]

[146/222] U [28136] V [28136] Height [28136]

[147/222] U [28256] V [28256] Height [28256]

[148/222] U [28376] V [28376] Height [28376]

[149/222] U [28388] V [28388] Height [28388]

[150/222] U [28392] V [28392] Height [28392]

[151/222] U [28404] V [28404] Height [28404]

[152/222] U [28408] V [28408] Height [28408]

[153/222] U [28416] V [28416] Height [28416]

[154/222] U [28424] V [28424] Height [28424]

[155/222] U [28540] V [28540] Height [28540]

[156/222] U [28656] V [28656] Height [28656]

[157/222] U [28664] V [28664] Height [28664]

[158/222] U [28780] V [28780] Height [28780]

[159/222] U [28900] V [28900] Height [28900]

[160/222] U [29020] V [29020] Height [29020]

[161/222] U [29020] V [29020] Height [29020]

[162/222] U [29028] V [29028] Height [29028]

[163/222] U [29036] V [29036] Height [29036]

[164/222] U [29044] V [29044] Height [29044]

[165/222] U [29056] V [29056] Height [29056]

[166/222] U [29056] V [29056] Height [29056]

[167/222] U [29064] V [29064] Height [29064]

[168/222] U [29064] V [29064] Height [29064]

[169/222] U [29064] V [29064] Height [29064]

[170/222] U [29064] V [29064] Height [29064]

[171/222] U [29180] V [29180] Height [29180]

[172/222] U [29192] V [29192] Height [29192]

[173/222] U [29300] V [29300] Height [29300]

[174/222] U [29420] V [29420] Height [29420]

[175/222] U [29540] V [29540] Height [29540]

[176/222] U [25068] V [25068] Height [25068]

[177/222] U [20728] V [20728] Height [20728]

[178/222] U [20848] V [20848] Height [20848]

[179/222] U [20868] V [20868] Height [20868]

[180/222] U [20988] V [20988] Height [20988]

[181/222] U [20996] V [20996] Height [20996]

[182/222] U [21004] V [21004] Height [21004]

[183/222] U [21008] V [21008] Height [21008]

[184/222] U [21016] V [21016] Height [21016]

[185/222] U [21136] V [21136] Height [21136]

[186/222] U [21260] V [21260] Height [21260]

[187/222] U [21372] V [21372] Height [21372]

[188/222] U [21380] V [21380] Height [21380]

[189/222] U [21496] V [21496] Height [21496]

[190/222] U [21616] V [21616] Height [21616]

[191/222] U [21736] V [21736] Height [21736]

[192/222] U [21736] V [21736] Height [21736]

[193/222] U [9569] V [9569] Height [9569]

[194/222] U [-2720] V [-2720] Height [-2720]

[195/222] U [344] V [344] Height [344]

[196/222] U [3424] V [3424] Height [3424]

[197/222] U [3434] V [3434] Height [3434]

[198/222] U [3438] V [3438] Height [3438]

[199/222] U [3448] V [3448] Height [3448]

[200/222] U [3454] V [3454] Height [3454]

[201/222] U [3462] V [3462] Height [3462]

[202/222] U [3462] V [3462] Height [3462]

[203/222] U [3462] V [3462] Height [3462]

[204/222] U [3582] V [3582] Height [3582]

[205/222] U [3706] V [3706] Height [3706]

[206/222] U [3810] V [3810] Height [3810]

[207/222] U [3818] V [3818] Height [3818]

[208/222] U [3826] V [3826] Height [3826]

[209/222] U [-4012] V [-4012] Height [-4012]

[210/222] U [-11966] V [-11966] Height [-11966]

[211/222] U [-11960] V [-11960] Height [-11960]

[212/222] U [-11946] V [-11946] Height [-11946]

[213/222] U [-11822] V [-11822] Height [-11822]

[214/222] U [-11806] V [-11806] Height [-11806]

[215/222] U [-11806] V [-11806] Height [-11806]

[216/222] U [-11683] V [-11683] Height [-11683]

[217/222] U [-11566] V [-11566] Height [-11566]

[218/222] U [-11446] V [-11446] Height [-11446]

[219/222] U [-11432] V [-11432] Height [-11432]

[220/222] U [-11422] V [-11422] Height [-11422]

[221/222] U [-11422] V [-11422] Height [-11422]

etc.

Thanks!

K

I’m also a bit curious about this specification https://cesiumjs.org/data-and-assets/terrain/formats/quantized-mesh-1.0.html

  • Does the tile center reside halfway between MinimumHeight and MaximumHeight?
  • Vertex height is in relation to these 2 values, but what are these 2 values themselves in relation to? The reference ellipsoid surface?
  • Is height scaled along the surface normal (Geodetic) or scaled along a planet center spoke (Geocentric) ?
  • Does the tile center reside halfway between Western edge and Eastern edge longitude lines?
  • Does the tile center reside halfway between Northern edge and Southern edge latitude lines? Geodetic or Geocentric?
  • Since u,v,height are unsigned shorts, why are they 0 to 32767 rather than 0 to 65536? Is a bit lost due to encoding?

If everything was Geocentric it would be easy to do Polar-Cartesian conversions, unless there’s a good Geodetic<->Geocentric latitude formula to use.

Kenneth,

There’s nothing built in to dump out terrain stats. I suggest you take a look at how CesiumTerrainProvider does the decoding:

https://github.com/AnalyticalGraphicsInc/cesium/blob/master/Source/Core/CesiumTerrainProvider.js#L276

Hyper Sonic,

Does the tile center reside halfway between MinimumHeight and MaximumHeight?

It’s up to whoever created the terrain tiles, but proably not.

Vertex height is in relation to these 2 values, but what are these 2 values themselves in relation to? The reference ellipsoid surface?

Yes, WGS84.

Is height scaled along the surface normal (Geodetic) or scaled along a planet center spoke (Geocentric) ?

Geodetic.

Does the tile center reside halfway between Western edge and Eastern edge longitude lines?

Does the tile center reside halfway between Northern edge and Southern edge latitude lines? Geodetic or Geocentric?

Again, it’s up to whoever created the tiles.

Since u,v,height are unsigned shorts, why are they 0 to 32767 rather than 0 to 65536? Is a bit lost due to encoding?

Right, the delta encoding was simpler without using that bit. I’m not sure if there’s a stronger reason that that.

Kevin

Thanks for all of the explanations Kevin! 0 to 32767 seems like sufficient precision. If Challenger Deep and Mount Everest happened to be in the same tile you’d still get sub-meter vertical precision.

Mount Everest relative to it’s surrounding base isn’t terribly impressive, rising 12,000’ over a 17,000’ base. Mount McKinley is probably more impressive in this respect, rising 14,000’ over a 6,000’ base. For tiles including Mount McKinley’s summit and base you’d still get roughly a half foot vertical precision, which is probably the worst case scenario for tiles just a few miles wide (Mount McKinley’s north face drops ~14,000’ during just a ~18,000’ horizontal travel.)

I was wondering if it's possible to get a print out of the what the values of a tile are prior to being processed by Cesium. I've been working on a project where i am attempting to realize some custom terrain data, and it would be nice to know whether or not my reading/writing code is correct, and Cesium will process terrain data correctly.

Hey Kenneth,

I had the same problem you had and I wrote a quick and dirty tool:

Maybe it's useful for those who are decoding mesh terrain data

Regards!

Thanks for sharing your tool