how to set PolylineCollection behind PointPrimitiveCollection

HI
there is a demo

  • I need PolylineCollection behind PointPrimitiveCollection always
  • I need the black point before the red point always
  • I need the label primitive before the black point always

some help, thx

Hi @edgexie, welcome to the Cesium community! Could you help me understand what end result you’re trying to achieve?

Based on the sandcastle you provided, it looks like you want the red and black point primitives to be in the same location, and you say you want the black point to render on top. Is that correct? You want the red point to be hidden behind the black point, and a label to be rendered on top of both?

Or are you looking to do something more like this, where the black point is at position2:

yeah, in the same location, I want the black point to render on top, and a label to be rendered on top of both. I want the line on bottom of them always.

Got it. It looks like it may be difficult to achieve exactly what you want with the Primitive API. Here’s the closest I could get:

A version where the points are on top of each other, and the line is underneath. But the label doesn’t show up

A version where the label shows up, but the line occasionally renders on top, depending on viewing angle

You may have better luck using higher-level APIs like the Entity or Billboard APIs, where eyeOffset is a supported property (not the case for the Primitive API). The Primitive API is better performance-wise, but unless you’re rendering thousands of objects, the extra features of Billboard may be worth it!

Let me know if this helps / if you have any other questions.

I can’t use entity, because I have so many UAVs, the count may be near 10k. The points represent drones, and the label represent the code of drone.

I need the black point before the red point always, and the label is always on the top.

any ideas? Or is this a fake demand?

I see, that does make this tricky. One route you could consider is the EntityCluster API to cluster your points together to reduce the rendering load.

Here’s a sandcastle example of how that would look and how to set it up.

There’s also a similar post on the forums that might be insightful, and also links out to a github issue on the topic of rendering order.