I’m trying to modify Cesium to support picking of a rectangular area instead of just a point.
I have the code done but for some reason it gives the incorrect results, and I’m not sure if I’m missing some Cesium detail that might be crucial to solve this.
To do picking, Cesium renders all possible objects into a framebuffer then extracts the color behind the target point.
I did an alternative picking method that takes a rect as input and then looks through all colors in the rect area and generates a list of picked objects (avoid duplicates, of course).
If anyone who knows anything about Cesium internals (Patrick or others) and have some time to look at the code, even if just some tips to find the problem would be good.
There’s two functions added to Cesim for this:
Scene.pickRegion (alternative to scene.pick)
and PickFramebuffer.endWithRect (used by pickRegion, alternative to PickFramebuffer.end)
The code partially works, however the results are incorrect, might be related to the frustum used for picking, I’m not sure why it needs a frustum different from normal rendering, and even I tried with this line (currently commented out in the code), still incorrect result
frameState.cullingVolume = getPickCullingVolume(this, drawingBufferPositionMiddle, rectangleWidth, rectangleHeight);