Quantized-Mesh worked well in UE4 but failed in CesiumJS

We maked a set of terrain produced by CTB,and it’s worked well in UE4,which used Cesium for Unreal 1.12.1,but failed in CesiumJS 1.89.

We have compared this terrain data and Cesium World Terrain of ion,and found that,our data has metadata extension in every terrain file,but in Cesium World Terrain,it’s metadata extension only emerged in level0 and level10.

So may we need to change our terrain metadata extension rules to ion’s rule.But when we try to find the ion’s rule,we only found serval post says “The availability structure is not well documented” or some else like.

Is there anyone know the rules?

Hi @zhangister,

our app also uses terrain data produced with CTB and everything is working (Cesium 1.92 for now). What error logs/alerts do you get? How do you “host” the data? Do you have root tiles in your data (tiles 0-0 and 0-1)? Please provide a little bit more information, so that maybe I can help you.

Best, Lennart

Hi @lennart.imberg
Yes, we have 0/0/0.terrain and 0/1/0.terrain.and there has no error or warning info ,we used IIS provide terrain service.our layer.json is:

Have you specified the mimeType and gzip-header for the terrain data?

Look at this code snipped from a web.config file:

<?xml version="1.0" encoding="UTF-8"?>
      <mimeMap fileExtension=".terrain" mimeType="application/octet-stream" />
        <rule name="Rewrite TERRAIN header" preCondition="IsTERRAIN" stopProcessing="true">
          <match serverVariable="RESPONSE_Content_Encoding" pattern=".*" />
          <action type="Rewrite" value="gzip" />
          <preCondition name="IsTERRAIN">
            <add input="{PATH_INFO}" pattern="\.terrain$" />

We have such a file with some additional code at the root-directory of our app and also using IIS

Hi @lennart.imberg
Yes,we specified the mimeType but not gzip-header , our data is not ziped,so HttpResponseHeader is also not have " content-encoding:gzip" .And when resolved 0/1/0.terrain,we traced to https://github.com/CesiumGS/cesium/blob/7d7c5d06e712e71b7002f70100da8689080a3144/Source/Core/CesiumTerrainProvider.js#L308-L354,console.log the availableTiles ,and get:

but when resolved 0/1/0.terrain from ion,it’s like this:


As far as I understand the produced data by the quantized-mesh branch of CTB is already gziped, so you have to add that header (you are using this branch by ahuarte47, right? Cause your response contained “format: quantized-mesh-1.0”).

But take everything I tell/write with a grain of salt, I am NOT! an expert with (web)-servers and stuff.

I really don’t know quantized-mesh-1.0 means already gziped,i’ll try it later.Thank you very much @lennart.imberg

I just confirmed from my group member who modified CTB source code,the terrain is not gziped.I also tryed specified gzip-header in web.config,and cesium tell me a error

An error occurred in “CesiumTerrainProvider” : Failed to obtain terrain tile X:0 Y:0 Level: 0.
GET 0/0/0.terrain?v=1.1.0 net::ERR_CONTENT_DECODING_FAILED 200 (OK)

So the statement has been verified,the terrain data is really not gziped.
So the key point is my metadata of 0/0/0.terrain or 0/1/0.terrain was wrong? I’ve no idea.

ok, so my first guess is not the problem. Maybe it is the metadata as you already thought about. But I dont know either, because our terrain data has no metadata for now and we use an unmodified CTB from ahuarte47 (link). Maybe you can talk with your group member, what modifications he did and if they concern the metadata.

Sadly I can’t help you with this problem.

Thank you anyway! But what you just said shocked me!

Does this means your terrain data has no metadata at level0 and level10 ? Why i asked this because i found Cesium World Terrain from ion has metadata only at level0 and level10.


just to add info…I load the terrain data with the parameter requestMetadata: false. The data is created from a plain digital elevation model (geotiff), so there is absolutly no source for metadata in my situation

I have tried set “requestMetadata: false” to request Cesium World Terrain of ion,and then traced the cesium,yes,this time there has no metadata,but there also has no ups and downs in the map,the gound is horizontal.
That’s really a strange problem.

I must tell you a good news . I modified the metadata of 0/0/0.terrain and 0/1/0.terrain, and now it’s rules looks like Cesium World Terrain.For example,when comes to level5, the 0/0/0.terrain will get 1024 child terrain, Cesium World Terrain divide it into three areas:

{endX: 21, endY: 31, startX: 0, startY: 0}
{endX: 31, endY: 5, startX: 22, startY: 0}
{endX: 31, endY: 31, startX: 22, startY: 6}

But i divide it into two areas:

{startX: 0, endX: 31, startY: 0, endY: 15}
{startX: 0, endX: 31, startY: 16, endY: 31}

And now it working.hahaha…
Thanks a lot!