How to get the color of the model(3dtiles)?

I only found how to set the color of the model, but I didn’t find a way to get the color of the model. Thank you for your help!

Depends totally on the model. Most models I work with are colored as they are in the real-world, so there’s at least 16M colors to choose from, 24M with opacity. So the answer is that there’s no simple way to get this.

Now, maybe you work with only single-colored models, but that, I suspect, is perhaps a bit of an exception. Your best bet is to write some kind of parser to read the model file directly, I don’t think there’s a viable API access point for this … unless you have specified that the model is colored to something specific (you can look in the style section of the 3DTileset object).

Unless you provide a bit more info on what you’re trying to do with what data?



Thank you, Alex,

I think this is really a thorny problem. In my current work, I need to click to obtain the color of the model. I feel that this color is only the material of the model, not an attribute of the model object in Cesium. Can I understand this? I tried to find the color description from the attribute on the Cesium Cesium3DTileFeature object, but the RGBA value obtained is (red: 1, green: 1, blue: 1, alpha: 1). I don’t know the source of this value, or this is the default value set by Cesium?

The model I deal with is indeed a simple model, but it is not a single color model, and it is difficult to read the model file directly.

Thank you again for your help.


Hmm. Yeah, a bit tricky, there’s no pickers that will give you color values for where you picked, at least not by default. You could try to create your own ray and intersect on where you want to pick, but the info returned might be hard to interpret.

To be honest, I would reverse the logic of this a bit, and put into the model itself properties for identification (whatever it is, or even a specific color), and tile the model with those properties built in. Tough luck if you’re not in charge of those models, not entirely sure how to pick a color then. And keep in mind that a color returned isn’t absolute; diffraction, opacity, shadows and light all contribute to the returned value.

What are you trying to do, though? Why do you need the color on a specific tile?



Hi, Alex,

My current work is to process and analyze the stratum model. As shown in the picture, the earth is divided into many layers, which may be different soil or rock, etc. they are represented by different colors. The model in the picture is relatively clear. In the actual model, there is no detailed texture as in the picture, but different colors are used to distinguish.


My initial idea was to get the color of the model to classify different layers, but this idea is difficult to achieve at present.

Now I’m thinking about adding a classification attribute to different layers of the model when designing the model, so that the attribute can be obtained in InfoBox and Cesium3DTileFeature object, so that the classification operation can be completed.

I’m still a novice using cesium and don’t know much about many attributes. I’ve observed the attributes of Cesium3DTileFeature object. At present, I haven’t found any attributes that can be classified. I’m not sure whether the above methods are feasible. Maybe you have better suggestions. Thank you very much!

1 Like


Looks pretty cool. There’s a couple of things to note;

  1. Properties for picking is always better handled through the tile properties

Just get them in there, picking and sampling heights and the rest is a tedious task at the best of times with lots of room for mistakes, so just make sure your streaming tiles have feature tables with the data you’re after in them. Also, if you’re using pointclouds, picking becomes a much harder task, but we can talk about that later if needed.

On picking in general, a scene.pick() or scene.drillPick() will give you the objects, and to see the attributes for that tile (or whatever you hit), there’s a simple property API (ie.

  1. Going underground through globe transparency has implications for picking and navigation

Unless you’re doing fancy stuff like colorising and / or changing the opacity of the streamed tiles, once you go globe transparent you also let go of the surface stabilising; dragging the ground to navigate, or right-click and drag to rotate goes out the window, and you might consider some navigation panel. Picking of the globe is also disabled, so that might incur some odd behaviour for things like “show coordinates at the cursor” type application.

Happy hunting!