Skip to content
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

Picking should use pick-window-rectangle. #165

Open
fredrik-hjelmaeus opened this issue Sep 27, 2024 · 1 comment
Open

Picking should use pick-window-rectangle. #165

fredrik-hjelmaeus opened this issue Sep 27, 2024 · 1 comment

Comments

@fredrik-hjelmaeus
Copy link

When using static pick method in Potree, picking window is not used.
Only when directly hovering within a points rendered area is it picked.
The provided screenshots displays when the mouse is within and a sphere is created on pickPoint hit position.
pick_hit
pick_miss

I have setup a forked repo based on your example scene
here: https://github.com/fredrik-hjelmaeus/pnext-three-loader-pickwindow-issue
usage: When pointcloud is loaded, sphere will be displayed on any pick point hits.

When pick window works as intended, we would expect all points within specified picking rectangle window to be considered hits. And after this, the closest of those hits would be the one returned as PickPoint.

@andrewjafa
Copy link

Hi Fredrik,

I also ran into this recently and found a hacky workaround in case it helps (this is definitely not the solution)
I force the point size to be the same as the desired pick window size during the picking

const pickParams = {
                pickWindowSize: 1,
                onBeforePickRender: (material: PointCloudMaterial) => { material.size = 9 }
            }
const pickPoint = Potree.pick(viewer.pointClouds,viewer.renderer,viewer.camera, ray, pickParams);

Additionally I've run into strange issues when using arrays of pointclouds during picking, where the closest point is not picked or no pick is returned at all. The workaround there was to iterate through the pointclouds one by one, noting the hit distances, then choosing the closest. Its marginally slower but at least gives accurate results.

Andrew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants