I’m assigning canvases (images) to rectangle primitives. When I have one canvas overlapping another, the canvas that is below is partially hidden by the canvas that is on top (see attached snapshot). The part that is partially hidden corresponds to the section of the canvas on top that is transparent. I have to use primitives instead of entities because I have to constantly update the material with the updated canvas and the updates cause flickering when using entities. I’m thinking of replacing the rectangle primitive with the custom singleTileImageryProvider that takes a canvas to see if that solves the issue. Is this a z fight issue? Is there a workaround to avoid the issue?
The code when assigning the canvas to the rectangle primitive is below:
var oRectangle = Cesium.Rectangle.fromDegrees(args.data.geoTL.x, args.data.geoBR.y, args.data.geoBR.x, args.data.geoTL.y);
var material = Cesium.Material.fromType(‘Image’, {image: args.data.image}); //--------------> canvas
var options = {
rectangle: oRectangle,
ellipsoid: Cesium.Ellipsoid.WGS84,
asynchronous: false,
show: true,
id: args.id,
material: material
};
var multiPointRectangle = new Cesium.RectanglePrimitive(options);
We don’'t currently have great support for z-indexing. As a work around for now, try setting the height of whichever rectangle you want to be on top to a small value.
I verified and the issue does not happens in Cesium version 1.14. The issue started happening when I upgraded to version 1.16. I’m going to try in version1.15 and version 1.17 and I will let you know the outcome. I cannot use the workaround you are suggesting because my project has no notion of the z ordering of the shapes that are rendered on the map. This is why we are using canvas with transparency to be able to see the intersection of the areas on the map when the canvas overlap…