Access b3dm metadata in materials?

Hi @v12424124_34,

It should be possible, but I haven’t had time to sit down and figure it out properly. There’s a few different things complicating it, and I can let you know what I’ve found so you can try to work off of that. If you haven’t yet, I recommend getting familiar with accessing metadata in Blueprints (Visualize Metadata – Cesium)

Using the tutorial and the Cesium for Unreal Samples level 06, you can apply materials to sections of a tileset based on the metadata value. Here’s an example blueprint I created - it’s sandwiched right after the Line Trace in Samples level 06. (This is by no means the best way to do this, just what I could come up with quickly.)


This blueprint gets a selected building/element from the tileset. I know exactly what the metadata properties are for this tileset, so I know that all buildings have a “Year” property. I can get the value of the Year property as an integer and compare it with a set value (in this case 1920). Then, it sets the color of the material based on whether the year is greater or less than 1920.

However, the big limitation of this is that it won’t just set the material for that building, it will set it for the entire tile containing the building, which also generally contains other buildings. In the image below, I’ve only selected the building directly under the crosshair, but it also changed the color of the surrounding buildings.

So depending on your specific tileset and the property you’re trying to visualize, this approach may or may not work for you.

I don’t know if you can apply a material per-primitive component and not per-tile, but it doesn’t seem feasible from what I’ve read so far. I also don’t know if you can get all the primitive components of a tileset at once, rather than selecting a component with a line trace - I’ll ask the team about that. Ideally you would be able to assign the materials at or before runtime for the entire tileset rather than clicking on each element.

The next option is to set the Vertex Color of the tileset based on metadata values, and then read from the Vertex Color to style the buildings. I haven’t experimented with this at all, but this might be a good read to start you off. It also uses C++ rather than Blueprint, which is likely going to be necessary for its greater flexibility.

Styling from metadata is definitely something we want to enable in the future. To that end, if you make any progress with this, please share it back to the community or to the plugin directly!

Best of luck,
Alex

1 Like