-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
subsequent pickPosition returns wrong value (depth?) #11031
Comments
Thanks for the detailed bug report @anne-gropler. For some reason though I can't reproduce the bug: Maybe this is GPU specific? What system are you on? |
Thanks for trying it out! To answer your question, we use different GPUs across the team. Nvidia GPU, Intel chip, AMD GPU. The following picture was reproduced on Linux with Intel graphics using Firefox: |
The only other thing I was able to find is, that the
is different for the picks (in case the first pick is correct). E.g. the first pick at the correct position might have a depth of ~0.75 and all other picks might have a depth of ~0.71. So from this little bit of research it looks like there might be a problem in the calculation of the depth/the values in the depth bufffer or something related to that. Unfortunately I am not able to find out anymore here and any further help would be appreciated. :) |
Thanks @UniquePanda for sandcastle improvement and the debugging! 🌟 @lilleyse Can you reproduce it now? |
Yes |
A little update on this as I am currently investigating: Maybe @ptrgags has an idea? You're might be the one who has spent the most time with the related code in the past months. 😄 I am willing to work further on this as it is becoming quite urgent for us, but any help is appreciated. |
As mentioned by @lilleyse this is related to #4368. It may even be the same problem. Maybe this issue should/could be closed. Based on the discussion in #4368, I did some trail and error debugging and found out, that for us the problem goes away, if we call We'll use that workaround for now, although it's not really nice and probably has an impact on performance. 😅 |
Just a last note to keep my debugging results somewhere: I think, the following happens on a "double click" in the sandcastles:
If you let the browser render a frame after every single call to I suspected that the depth returned by this line is only correct for the first call to
Because in an example I got So overall it looks like the values in the depth buffer change between frames/render passes (when |
Thanks for all the debugging here @UniquePanda. From my understanding, the root cause of this issue is likely #4368, however this only arose in point clouds once the Model reactor once point clouds and model implementations became a bit more unified. If that's the case, I'll close this in favor of #4368, but cross link this report. If I've misrepresented anything please let me know! |
@ggetz This issue was not fixed by #4368 / #11983 , so could we reopen this issue here, please? I updated the sandcastle because the previous ones don't load the tileset anymore. This issue still persist, i.e., the subsequent picks are too close to the camera and don't properly hit the point cloud (they should be on the wall, or on the ground): |
Got it, thanks for pointing this out @anne-gropler. Reopening. |
Firstly, this issue is hard to reproduce, that's why I provide images below.
In my application, when the user clicks a point cloud point, we want to find the point closest to the camera within a certain screen environment (
env
currently set to 4). So this is not about hitting any point cloud point within that screen rect, but the closest one. This function we namedpickPoint
calls Cesium'sviewer.scene.pickPosition()
.However, sometimes*,
pickPoint
returns a position that is too close to the camera, where actually no point cloud is.The sandcastle implements 2 kinds of picking:
pickPoint
all over the screen for every 20 pixel. Might take a minute or longer.pickPoint
there. Might take a few seconds.In
pickPoint
, some point entites are created at the positions that were successfully picked. A yellow point means that this position was picked at the very first; a blue point means this position was picked subsequently in the loop to pick around the given screen environmentenv
.When the bug happens:
What I think could be wrong:
Since the first pick seems to be right and subsequent picks that are close to the first one aren't, I think this could be something about the picking cache, or maybe the depth buffer gets interpreted wrongly (logarithmic vs. linear). But this is just my intuition, I have no idea about the Cesium code. Since it's unreliable to reproduce, it might also be a race condition somewhere.
* sometimes: Happens very often on certain point clouds, sometimes on meshes, and almost never on certain other point clouds. We cannot find any difference in the point clouds that would make them special to this bug. The point cloud which has this bug quite often is also used in the sandcastle, and it also sometimes shows this error in the sandcastle, too. First I thought that
attenuation
might play a role, or the density of the point cloud, or that the point cloud is still loading, or that the globe is still loading, or just overall "busyness" of the browser. But nothing could reliably increase the chance of causing this bug.Images: massive pick
It's as if the point cloud exists twice, but closer to the camera position. Easy to spot at the wall ("line") and the tree structures.
(the red and green circles on some images were picked using
debugPickPosition
on the point cloud when the inspector widget was initialized)Initial position after massive pick:
Shown from above:
Even the globe gets picked wrongly:
From the ground:
Images: diagonal pick
Showing the same diagonal pick from different angles.
Inital Position:
Zooming in:
You can clearly see that the diagonal line is in shape as the vegetation in front of the wall, but only the first few picks are correctly on the wall.
Sandcastle example:
https://sandcastle.cesium.com/#c=rVj7c9o4EP5XdPnhalpi/OCZR3sJIS1pQnIJbS+dzHSELYLASJwtB9y7/O+3sjDYxqT07pgM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ZRGwxgWNs4hUJ4h9ZeAJbtBSBaWyUdz6nloQFBEPKhSGWF4DcJBIM8STKyGB15I8ofTTRSxdoGRl6EkBydQmmMoDnqH6ugAWeVigyzArG0ssDFftllCztomAyn3ncvL6y8oBzSnl586W7z+PC79L9hUhE87YlQpD3P5s+mPAcjKmmTNc534uqiL4rb8Cf7M+kio8Cco8L9S4W59nOvlanm7WraDrR9rFlHl+9tOp/eC6b9rzv+tQbc16e5kujuJbiHTnyfVjctYQrEFA7IRFzGQROjvv+XzEUDKr78iJdyPSkvx27TYBPlGc0q2OgaGy60iprx9N8qLI0Vw2cvj+iWSF8iM1SKWLNLHZvkFdL7ahHCPYXczuGd1niBPHzBzPSmHex2bheIkvjloqysEZ2c8hBZpy9NCfEmKzw2x7cN68604lynOZZAi05APOcpNXZ2zscJlbe159ftDzMQs1wBRsWqUU01fyJ93uleDxa6f1S/pd7mE9qMZ0S875/1vZ9efTi8739qX3fZH6X2vvHcUiMgjb5M1/kan8uojr9yarlcEmcIFGLZHZRDCCVPoThAkARxV0qZHLn1C1D0u+D0bUoODAEaGoRcD1MPe26MK6G+YehzD8fDxGk5yHo6k2sh8e6mEuq4fVeC12FKoH+1ynv8B
Browser: Chrome, Firefox
Operating System: Windows 10, Ubuntu
The text was updated successfully, but these errors were encountered: