The text in the label in the entity is sometimes not displayed

Use the following method to add some entities to the map. Some text in the label is not displayed, but when the map is zoomed, the text is displayed again. If the text background is set to transparent, the text is always displayed, but some text is Is the picture capped?
var entity = {
id:options.id || Util.generateUUID(),
position: Cesium.Cartesian3.fromDegrees(options.lon,options.lat,options.alt),
label: { //文字标签
text: options.title || ‘’,
font: options.font || ‘100 30px Helvetica’,
scale: options.textScale || 0.5,
style: Cesium.LabelStyle.FILL,
fillColor: options.fillColor || Cesium.Color.WHITE,
pixelOffset: new Cesium.Cartesian2(_textOffsetX,_textOffsetY), //偏移量
showBackground: false || options.showBackground,
backgroundColor:options.backgroundColor || new Cesium.Color(0.035,0.764,0.792, 0.7),
eyeOffset: new Cesium.Cartesian3(0, 0, -10)
},
billboard: { //图标
image: options.imagesUrl,
scale: options.imageScale || 0.5
},
properties:options.properties

    }

viewer.entities.add(entity);

Are you able to reproduce this issue in a Sandcastle? See: How to share custom Sandcastle examples

When the icons overlap each other, the position of the text above will change with the movement of the earth, which may be caused by this problem. I cannot upload my own icons, so this problem is not fully reproduced.

Can you attach an image, gif, or video showing the issue?

Your Sandcastle shows the billboards obscure some of the labels. This is because the billboards closest to the camera are rendered above. You can control this by setting a Z value for the eyeOffset to bring the billboard closer or further away from the camera: https://cesium.com/docs/cesiumjs-ref-doc/BillboardGraphics.html?classFilter=Billboard#eyeOffset.

@omar thank you very much, by setting a Z value for the eyeOffset of the billboard,the problem is solved.

1 Like