Cesium for Unity - Textured buildings question


We are interested in using the Cesium for Unity plugin, but we are having some difficulties displaying textures on our buildings.

I have been supplied a .json file in which there should be textured buildings in the city Rotterdam, Netherlands:

But if I go to www.3drotterdam.nl I can select different building sets under the button “Content” (see screenshot, to the left are the options to see different LOD’s or levels of the data set):

Is this something I can achieve in Unity as well?

Thanks in advance!

Hi @Ruard_Veerman,

Can you share what version of the Cesium for Unity plugin you’re using? We had a bug in Cesium for Unity v0.3.1 where KTX2 textures with pre-existing mipmaps wouldn’t render with textures. So maybe this is related?

If so, the bug was fixed in v1.0.0. But if that doesn’t help, please let me know.

I don’t think that’s it sadly.
We are currently using unity version 2021.3.18f1 with Cesium for Unity Version 1.0.0 - April 03, 2023.

Hm, okay. Are you able to share a part of the tileset (e.g. one of the building models)? We can take a closer look and see if there’s something we aren’t handling properly in Cesium for Unity.

I’m definitely okay with that; would you like to receive the unity project or will this link to the dataset of the buildings suffice?

I’m trying to use your URL but it’s not loading in my own project for some reason. I assume you just used the “From URL” property on the Cesium3DTileset, and pasted your URL in? Maybe it’s a security setting on my computer I need to hunt down…

That’s odd, I’m indeed using the From URL option on the Cesium3DTileset. Screenshot below:

EDIT: uploaded a new screenshot where I have the buildings object selected instead of the terrain

Hi Janine,

Had any luck in loading the URL/textures so far?
I don’t mean to push of course, but we are eager to get textured buildings working for our prototype.

Hi @Ruard_Veerman,

Sorry for the delay. We found that your tileset uses the KHR_techniques_webgl extension, which is not supported by Cesium for Unity. In fact, I believe it’s officially archived and shouldn’t be used for future assets.

There was a similar post with the same problem (B3dm files with texture data issue), but I’ll echo what @Marco13 said on that issue. It may be possible to update the tileset to no longer use this extension, but the details for the update process depend on the dataset. So we would need to look more deeply to determine how to best replace the extension.

To add some details: We’re currently in the process of improving the tooling for updating tilesets that use this “legacy” extension, to no longer use it. There are some caveats (roughly speaking: depending on how exactly the KHR_techniques_webgl extension was used, this may not always be possible).

I had a short look at one B3DM of that data set, and it seems like it is “invalid”, strictly speaking, because of some invalid byte length, but it might be possibe to work around that. (On a second look, that may be wrong. I think that the data is valid)

Depending on the size of the data set, if you want to share it as a whole, I might have a closer look and see whether it can be upgraded with reasonable effort.

Thank you for coming back to me.
Unfortunately aside from the previously supplied link I don’t have access to the full dataset as of yet.
I will contact the company who owns the dataset and share the information you found. I believe the company is closed this week due to vacation, but I will get back to you as soon as I can.

Again thanks for the help so far, I appreciate it!

Just a short note: Based on the comments above, it should be possible to update that data set, to no longer use the KHR_techniques_webgl extension. For this, you can use the upgrade command of the 3d-tiles-tools.

Note: The current version is not yet released into npm, but should be released soon (it will probably be version 0.2.1).

To apply that command to your tileset, you can use

  • git clone https://github.com/CesiumGS/3d-tiles-tools.git
  • cd 3d-tiles-tools
  • npm install
  • npx ts-node ./src/main.ts upgrade -i ./example/tileset.json -o ./example-upgraded/tileset.json