[Color Model] Same color for all models

Hi !
First of all, happy new year ! I hope cesium will continue this year, as great as years passed !

I’ve just updated Cesium to 1.29

I’m trying to color a list of 3D models.

I use the Entities with modelGraphics.

The issue i run into is that when i create multiple 3D Models, they will all take the last model color i create.

I want 1 red, 1 blue, 1 green.

In this order.

They are all green.

here’s the code in sandcastle:

var viewer = new Cesium.Viewer(‘cesiumContainer’);

var position = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 250000.0);

var heading = Cesium.Math.toRadians(135);

var pitch = 0;

var roll = 0;

var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);

var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, hpr);

var modelBlue = viewer.entities.add({

name : ‘…/…/SampleData/models/CesiumAir/Cesium_Air.glb’,

position : position,

orientation : orientation,

model : {

uri : ‘…/…/SampleData/models/CesiumAir/Cesium_Air.glb’,

minimumPixelSize : 128,

maximumScale : 20000,

color : Cesium.Color.BLUE,

colorBlendMode : Cesium.ColorBlendMode.MIX

}

});

var position2 = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 280000.0);

var heading2 = Cesium.Math.toRadians(135);

var pitch2 = 0;

var roll2 = 0;

var hpr2 = new Cesium.HeadingPitchRoll(heading2, pitch2, roll2);

var orientation2 = Cesium.Transforms.headingPitchRollQuaternion(position2, hpr2);

var modelRed = viewer.entities.add({

name : ‘…/…/SampleData/models/CesiumAir/Cesium_Air.glb’,

position : position2,

orientation : orientation2,

model : {

uri : ‘…/…/SampleData/models/CesiumGround/Cesium_Ground.glb’,

minimumPixelSize : 128,

maximumScale : 20000,

color : Cesium.Color.RED,

colorBlendMode : Cesium.ColorBlendMode.MIX

}

});

var position3 = Cesium.Cartesian3.fromDegrees(-95.0, 40.0, 260000.0);

var heading3 = Cesium.Math.toRadians(135);

var pitch3 = 0;

var roll3 = 0;

var hpr3 = new Cesium.HeadingPitchRoll(heading3, pitch3, roll3);

var orientation3 = Cesium.Transforms.headingPitchRollQuaternion(position3, hpr3);

var modelGreen = viewer.entities.add({

name : ‘…/…/SampleData/models/CesiumAir/Cesium_Air.glb’,

position : position3,

orientation : orientation3,

model : {

uri : ‘…/…/SampleData/models/CesiumGround/Cesium_Ground.glb’,

minimumPixelSize : 128,

maximumScale : 20000,

color : Cesium.Color.GREEN,

colorBlendMode : Cesium.ColorBlendMode.MIX

}

});

viewer.zoomTo(viewer.entities);

What can i do?

Is this really a bug ?

Thanks in advance.

Hello,

This is a known issue. We have a bug report filed here: https://github.com/AnalyticalGraphicsInc/cesium/issues/4797

We have it labeled ‘next release’ so it should be fixed in the 1.30 release. I’ve put a link to your post in that issue so we’ll let you know when it’s fixed.

Thanks,

Hannah

Thank you very much for the quick response !
I’ll wait !

Great work anyway !

Thank you

Hi Benjamin,

This is now fixed in master (#4798) and will be in the Cesium 1.30 release on February 1 thanks to @szsolt!

Thanks,

Patrick

Thank you so much !
I really enjoy working with Cesiumjs and you guys !

Le ven. 6 janv. 2017 à 22:30, Patrick Cozzi pjcozzi@gmail.com a écrit :

Great news Patrick. I ran into this bug at just the right time!

My entities are created by way of CZML. I assume the 1.30 fix you mention will resolve the CZML-related bug as well.

Best in the New Year. erik

Yes, this will also be fixed in CZML. You are welcome to pull and build the master branch of Cesium from GitHub to test. Many users actually do this instead of using an official release.

Patrick