In the following code, why are both of my polygons transparent, even though one of them has an alpha value of 1? Is it not possible to have opaque instances when translucent=true on PerInstanceColorAppearance? What if I want to smoothly animate a polygon from transparent to opaque?
The code below runs in sandcastle
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var positions = Cesium.Cartesian3.fromDegreesArray([
-88.0, 35.0,
-80.0, 35.0,
-80.0, 40.0,
-88.0, 40.0
]);
var positions2 = Cesium.Cartesian3.fromDegreesArray([
-88.0, 45.0,
-80.0, 45.0,
-80.0, 50.0,
-88.0, 50.0
]);
var geometryInstances = [
new Cesium.GeometryInstance({
geometry : Cesium.PolygonGeometry.fromPositions({
positions : positions,
height: 1000000,
extrudedHeight: 1500000,
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1,1,0,1))
}
}),
new Cesium.GeometryInstance({
geometry : Cesium.PolygonGeometry.fromPositions({
positions : positions2,
height: 1000000,
extrudedHeight: 1500000,
vertexFormat : Cesium.PerInstanceColorAppearance.VERTEX_FORMAT
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(new Cesium.Color(1,1,0,.3))
}
})
]
scene.primitives.add(new Cesium.Primitive({
geometryInstances : geometryInstances,
appearance : new Cesium.PerInstanceColorAppearance({
closed : true,
translucent : true
})
}));