Access and modify OSM buildings

I wonder if it is possible to access and modify the OSM buildings data that are (without photogrammetry “just poor grey boxes”).
From OSM building web site it seems possible to modify individually each building (Data Tiles • OSM Buildings) using its ID and then changing the properties (like roof material or even height of the building).
It seems that this is possible in CesiumJS, and to some extent in Cesium for Unreal (I’ve seen a new procedural way to add windows to facades of buildings Cesium Releases in February 2023 – Cesium )
But this feature is not yet present for Cesium for Unity. However I wonder if it would be possible to give it a try by modifying the original script to access the OSM data and modify them before Cesium import them into the 3D scene to render them. If yes in which script should I look ?

If you submit modifications to the actual OSM data, Cesium OSM Buildings will eventually pick up those changes. There’s currently no other way to modify the dataset. Modifying a building’s “height” property at runtime will not automatically change the geometry to match that height.

Cesium for Unity will eventually gain the ability to access feature metadata from materials, which should then allow a “window” material like the one in Unreal to be developed.

Hello and thanks for your reply.
So modifying the OSM data is not the key if I want to modify the Unity meshes created by Cesium OSM Buildings. I suppose I should play directly at the level of the Unity meshes to change for instances vertices and eventually add a UVmap to cover the faces of cubes with a texture.

I have found the way to access the OSM buildings Unity meshes by ticking the Debug option “Show Tiles in Hierarchy” which makes appearing childrens that contains MeshFilter and MeshRenderer for a group of building. However I’d like to post-process the meshes to generate procedurally 3D mesh building (based on 3D models stored as prefabs in Unity project). In Blender OSM add-on you can import the OSM data as 2D polygons rather than 3D meshes, so that you get only the “basement” polygon of the ground which I could then use to generate 3D building with my own assets.
My question is : Do you think it would be possible to import this 2D polygons instead of the 3D meshes (so a 2D version of the “Cesium OSM buildings” asset which would be also faster in terms of loading I suppose).
Best regards

If you’re happy with the Blender workflow and results, perhaps try using the Cesium ion Blender plugin to export the results to Cesium ion to create 3D Tiles. From there you can easily visualize it in Cesium for Unity.

Thanks for your reply,
I am not looking for an alternative Blender add on. Actually, I’d like to avoid having to use Blender because I’d like to do everything in Unity (at runtime). I just mentioned Blender osm add-on because it contains the 2D (flat) version of OSM buildings.
According to this page what I am looking for is the LOD 0.1 (or LOD 0.2) while I suppose you are using for the moment LOD 1.1 (or LOD 1.2)

We don’t currently have a way for applications to modify the 3D Tiles geometry on-the-fly at runtime. I can certainly imagine adding something like that in the future, but we don’t have any near-term plans.

Even if we did, though, there would also be the problem that Cesium OSM Buildings is inherently 3D geometry. I don’t think it makes a lot of sense for the workflow you’re describing to start with Cesium OSM Buildings, because:

  1. The client would need to download and parse a bunch of geometry that you don’t really need, wasting bandwidth and CPU time.
  2. You’d have to somehow derive 2D footprints from the 3D data, which may not be terribly hard but it’s also not trivial.
  3. Then you’d have to rebuild the geometry from the footprints according to your own algorithm. This sounds very similar to what our Cesium OSM Buildings tiler does, except it uses more than just fooprints. For example, it creates shaped roof geometry for buildings that have that information.

Perhaps Cesium could provide a different dataset in the future that would be more suitable. But for a 2D use-case like this, you might find alternative tools in the OSM ecosystem to be more suitable. For example, there are tools to load OSM data into PostGIS databses, which you could query at runtime. That’s just one idea, there are lots of other formats that might work.

If the resulting model from this whole pipeline is quite complicated - too big to render as one model - then the next step will be to tile it. If you can do it offline (rather than at runtime), then Cesium ion will definitely help. If not, you could either create a server that generates 3D Tiles on-the-fly (presumably from a pre-tiled 2D dataset), or you could extend Cesium for Unreal by plugging into cesium-native’s TilesetContentLoader interface. Definitely getting into some advanced stuff here, but it’s possible.