CesiumGS / cesium-unity

Bringing the 3D geospatial ecosystem to Unity
https://cesium.com/platform/cesium-for-unity/
Apache License 2.0
356 stars 85 forks source link

Support 3D Tiles 1.1 Implicit Tiling #148

Open bertt opened 1 year ago

bertt commented 1 year ago

When configuring a custom tileset (b3dm) from url I see the following error:

[2022-12-01 22:43:13.353] [error] [TilesetJsonLoader.cpp:804] Received status code 404 for tile content http://localhost/content/%7Blevel%7D_%7Bx%7D_%7By%7D.b3dm

UnityEngine.Debug:Log (object)
Reinterop.ReinteropInitializer:UnityEngine_Debug_CallLog_FA05wu8x__otZNsgdHTnU9A (intptr) (at Library/PackageCache/com.cesium.unity@0.1.1/Runtime/generated/Reinterop/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:23343)
Reinterop.ReinteropInitializer/ActionNativeFunction:Invoke () (at Library/PackageCache/com.cesium.unity@0.1.1/Runtime/generated/Reinterop/Reinterop.RoslynSourceGenerator/ReinteropInitializer.cs:21315)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Configuration:

image

bertt commented 1 year ago

note: issue should move to https://github.com/CesiumGS/cesium-unity/issues I guess

kring commented 1 year ago

Thanks for reporting this @bertt. I believe the reason it's not working is because cesium-native (and therefore Cesium for Unity), don't support the 3D Tiles 1.1 form of implicit tiling yet. They do support the 3D Tiles 1.0 3DTILES_implicit_tiling extension, though, which is very similar. We have a cesium-native issue to implement this: https://github.com/CesiumGS/cesium-native/issues/527

kring commented 1 year ago

Because it doesn't realize that this is an implicit tileset, it doesn't know that content/{level}_{x}_{y}.b3dm is supposed to be templatized URL. So it treats it as an ordinary URL, and resolves it relative to the tileset.json. But because { and } are invalid characters in a URL, the URL resolution fails, and so it falls back on using the original string verbatim. The original string is missing a host, so Unity's WebRequest apparently treats that as localhost.