Got a bit of an issue picking from pointclouds (Cesium.PointCloud3DTileContent) when there’s a mix of transparent and non-transparent pointclouds in the scene. If I use scene.pickTranslucentDepth I can pick on the transparent ones, but not the non-transparent, and vice-versa. Is there any way around this? Is this a known issue? I’m using scene.pickPosition().
Hmm, seems my issue is linked to in what order I do the picking. I have issues if I use scene.pickPosition() first, then scene.pick() or scene.drillPick(), however if I do a scene.pick() first then do a scene.pickPosition(), the height comes through right on both pointclouds.
Is there some logical explanation for this? Is there maybe some waiting for a render to happen first with pick(), but not for pickPosition() or somesuch?
When calling pick twice in the same frame, for example scene.pick and then scene.pickPosition, the first pick will hide the object it picked. To do a pick twice in the same frame, you will need to call scene.render() in between each pick.
That sounds … bonkers? Why would a pick hide an object for consequite picks? But I also don’t think it’s quite accurate, I think it depends on what kind of picking, because if I use pickPosition() first, I can’t pick transparent pointclouds, but if I pick() first, then do a pickPosition() I can pick them. Similar oddities around transparent globes as well, and a combination of transparent globe, transparent and non-transparent pointclouds makes this terribly hard. I’ve tried to only do the picking at the same time in the render cycle, and best results seems to be to have a listener to postUpdate. I’ll give preUpdate and postRender a go as well.
As to the extra scene.render(), part of this exercise is to try to have the quickest real-time loop, and another render really makes the loop chug slowly. With all the checks, parameters and extra render() it seems picking times are around 70-90ms (I have other framework overheads, but this is the core Cesium picking time), around 40ms without the extra render, and a special mix of renderCounter % 2 with pickPosition() and a ray picker (with scene.pick() on an intersection for translucent terrains) seems like its capturing most of it (plus I do a special cluster picking for pointclouds that adds around 10ms depending on scatter factors).
Some times I also need a drillPick() for good measure, so it’s getting a bit mad. Maybe I should write up a starting guide to pickers, and have you gus fill in the blanks of what’s expected behaviour with them and the order they come in?
Th ideal, of course, is that you have one picker that is like a drillPick() with a pickPosition() with terrain intersection, all in one. Using pickPosition() is tricky as it will include entities and tiles, when really I just want terrains, or if no terrain, the globe. But if the drillPick() can attach a _pickedPosition property to each item in the resulting array (maybe even return a terrain object, and / or a globe object as it hits it on the way down, as we’re already testing for stuff, and here’s a crazy idea, even return the imageLayer(s)!!), all the problems of the world would be solved …