I am currently working on a pipeline for the visualization of buildings based on OSM data. For the future I want to generate a 3DTiles model as a result of the pipeline.
For testing purposes I am currently creating an extruded polygon entity for each building, which works well, but freezes cesium for a short time each time the entities are created.
To get around this, I switched to Primitive and PolygonGeometry. My problem now is that the buildings as entities look different than primitives, but I don’t know how to make primitives look the same as entities.
I’ve been doing a little work with Appearence but I don’t know how to solve my problem.
This is the result of creating entities (I want that Primitives look like this):
This is the result of creating primitives:
This is the code for creating the primitives:
for (var i = 0; i < buildings.length; i++) {
var building = new Building(buildings[i]),
instance = new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(building.getCoordinatesArray()),
extrudedHeight: 15
}),
attributes: {
color: Cesium.ColorGeometryInstanceAttribute.fromColor(Cesium.Color.DARKRED)
},
id: building.name
});
instances.push(instance);
}
viewer.scene.primitives.add(new Cesium.Primitive({
geometryInstances: instances,
asynchronous: true,
appearance: new Cesium.PerInstanceColorAppearance({
/* flat: true */
}),
}));
This is the result if i activate the flat property in PerInstanceColorAppearance:
Thank you all for your help