glTF settings for setting color

Which settings for a glTF-Object created from Blender are needed to assign the object loaded within a 3D Tileset with another color in Cesium.
Is any special material assignment in Blender required for this?

How are you converting the glTF to 3D Tiles? The material you set in Blender should come out on the other end.

Does the glTF have the material you set it to when loading it with something like the gltf viewer here?

https://gltf-viewer.donmccurdy.com/

Yes, the Material (and color) assigned in Blender is visible in the glTF-Viewer and in my CesiumJS-Application. But when I set the color property in the 3DTileset object (e.g ```JavaScript Cesium.Color.BLUE```), I can see it is set in the console, but the appearance in the viewer doesn't change.

Oh, I see what you mean now. Can you show the CesiumJS code you’re using to set the color? A Sandcastle example would be great but even just seeing the code helps.

We recently fixed a bug with applying colors to tilesets with no features:

I wonder if this is related.

Hmm.. if i try it here in the sandcastel. it works just fine (don't mind the shape of the tileset)..

But in the applcation on my desktop the tiles don't change color.
Maybe there is something else wrong with it.

I am calling it in nearly the same way in my application:

tileset[0].readyPromise.then(function (tileset) {
            tileset.root.children[0].color = Cesium.Color.BLUE;
            tileset.root.transform = Cesium.Matrix4.setScale(tileset.root.transform, new Cesium.Cartesian3(1, 1, scale), tileset.root.transform);
            console.log(tileset.root.children[0]);
        });

The transform and the print out works fine, even the color properties are alle set to alpha 1 and blue 1. But the object won't change the color (using Cesium 1.54)

That does sound very strange.I’m not sure why it would work in Sandcastle and not in your app. I would keep trying to put more of your application on Sandcastle until you see if there’s a specific piece that breaks it.

Glitch (https://glitch.com/) might also be another way to try and test this. It might be easier to put your full application there since that’s more of a complete developer environment. If you can recreate the issue there I can try to take a look.

Does setting debugColorizeTiles work for you?

https://cesiumjs.org/Cesium/Build/Documentation/Cesium3DTileset.html?classFilter=Cesium3dT#debugColorizeTiles

It works, when I set the color on the deepest child of tileset.root.children[this.state.node_index].children[0].
DebugColor works fine. But still I get differences in the color displayed on the 3D object if it has a color assigned by blender.

The only way I figured out today is to assign the Material there to double sided without adding a color to it.

I get strange behavior from Cesium processing 3D object colors in a tileset. The object was generated in Blender with the color rgb(102,51,153), a hue in purple (https://drive.google.com/file/d/1tBMoTi3h3oJERb76G4Q7vVMc85n7WWHM/view?usp=sharing). When loaded into the Asset Controller, the color in the display here is still very close to the original color (https://drive.google.com/open?id=12I-prD4AikgaUNnZN5UHsDgNbnJJzpv9). But as soon as the Tileset is loaded in the Cesium Viewer (on my local application or in the Sandcastle), the hue changes, it somehow brightens, as if the object's color in CesiumJS is mixed with another (possibly white) color (https://drive.google.com/open?id=1bvxoEcntjMTHQf2DL7MwHnncCraK9qds).
I know that the color may change due to lighting, but these changes seem too strong to me from the original color.
All images were shot on my desktop and I have created a sandcastel for it here: https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/index.html#c=lVPRbtowFP0Vi5cGCTkERre2tFoXVhZE6NqmbI3yEhxDDI5NbScUqv77bhLa0e5pliL72ufee86xY9toqGJhkEs1y7PRHYoJoVojI9FW5goxKVCsNTU6EjUGe1LghM7jnJvLChzIFRXoHB3R7SidDQm7ZiPvfuc5E+ZpT9z2iOsde6v176k7OsEAekyGKwB5G/9XuPKXCQ+Zkz7sUj4Obp78gWcelrfp5K7dC4PJMhzedMIBfMGKjd3ROoRik4G/8d0NI51JQYbTnbdcz7zsakfKhlmy9HgbZp4mgPWD+7Y/uHH85X3H/9HG3W7sp1N3dXIchr3YdTqT0VL6+bVgj+6nE+NfET3tyCe3Z74cnUUiEkWsUMHohirQKOhm7xWeVnvWEalCVwoTM0HVUQs9RwLBMFQp2PqpZMESyD49zK6n4D3E2meWI1f8FP21/JZquA9C8VzJ7LK8ES+xnGaNf4H5pQlsa55YEyooXnA5o3BVa5MGVJvLBXTSZt8StBiV0zeFhnEKRWH7XY21YhkzrKAax0li1e3+kdEdBHX6fws4bvc+H4hoVnxsG7lpLBYUmZQiIrlUSM5RXJFEwD1+pRuJ/QKX81jGSUnze0GFGTNtQIGy5rkgBt6xVUKa6BlBO9suA1yXPn8TU4YVv29bQ7XltDutntNyet3mGaocRpVdtUE7KbNAWnsCexFYAmW1YZq+9UUWOC5VEx14Q6TQEghwudifnr2aAItGq9HXZsvpRb35lWVrqUzpqIWxbWi25jEQtGc5WYF2onWZ1rdfk/oJKxBLzqPGh8cZNRDh8D/DyTzn/I7taNS46NuAf5fGwUkmFtcFVTzeAqQm0k+di3F9hDHu2xCWbT9mGyn5LFYHlf8A

When line 19 is commented out, I add the original color to the tile. However, I would have hoped that the color generated in Blender will be taken over.

Just as background info: 3DTile Style does not work, because the object does not have any features and in my end application and I am merging several tiles in a tileset to which all one clippingPlane should be applied. With 3D Style, alle Tiles in the Tileset would be colored in th same color.

I do think it is still the lighting. If I move the timeline slider to control the sun position, I can see the the color changing into the very bright color and then back to the original. Are you seeing this too?

Yes, I see it, too. Isn't the lighting turned off if the timeline is set to false?
But are there other settings to make in order to deactivate the lighing to see the real color of the object except:
viewer.scene.globe.enableLighting = false;
viewer.scene.globe.showGroundAtmosphere = false;

I tried a bit with the timeline feature, and yes, there are some changes in lighting while movinge the time slider. But the color mixing I've experienced on my desktop can't assigned to this functionality.
The initial color of the gltf object here (https://drive.google.com/open?id=1e34mVtUZT-yehIGzistMyxPhEHXuDzz-) is set by Blender to #663399 or rgb(102,51,153). This color can be achieved by adjusting the lighting, yes. But when I change the color by picking e.g. this color (https://drive.google.com/open?id=1wwCW7RjupDpyTc9MlM6Ro9XzAyUry7yD) the resulting color of the object looks like this: https://drive.google.com/open?id=10jYYyKwIAXvJyf3M-bd3hHu7cV8vr2al .
The console says the selected color is set (https://drive.google.com/open?id=1PZwQ2WFNhlhR8sSs6xeoFArsRQhcLVEt) and assigned to the 3D Tile (https://drive.google.com/open?id=1o496hQ8_bythAAIJjpy3QL5W2xOP45Os). But the displayed color is definitely not the selected color, even though the values in the console are set.

You can see this behaviour in the modified sandcastle, if you uncomment or commend line 34 there:

One thing I just thought of, I think giving the glTF an unlit material should fix this. There’s some discussion and examples here:

https://groups.google.com/d/msg/cesium-dev/GMZkSjUUSAo/GFq47cadBwAJ

This is the glTF extension for unlit:

Which CesiumJS does support, but I think the tool you’re using to convert glTF -> 3D Tiles would need to add it in, or at least leave it in if you can generate a glTF with that extension.