0

I have a 3d scene (with pointclouds and some other objects). I implemented algorithm to pick the closest point to the mouse for a pointclouds. But my problem is : I have several objects in my scene, so when I try to pick an object (or a point inside a pointcloud), I go through all the objects on my scene, I look for the more suitable point for each of them (accordingly to distance to the raycast or angle (which is better)). At this stage, I don't know how to find the point of which object is the most suitable in all situations.

Explanation : I want to find a point very close to the raycast but also quite close to my camera to pick visible objects (points) only.

So I need to find a way to mix : closest point to the raycast and closest point to the camera. Do you have some ideas or widespread solution in 3d ? Thanks for your help.

  • For now, an easy solution will be to sort point found in every object with the formula : distanceToCamera^2*angleWithRaycast (need to be adapted) – Julien Chaize Feb 25 '22 at 08:39
  • No need for a sort, just the minimum is needed, which require a full walk. If this is too expensive, then you need to build a data-structure to find the point faster (eg. bounding boxes, k-d tree, quadtree, etc.). – Jérôme Richard Feb 25 '22 at 08:55
  • I am using an octree per pointclouds, but a formula like distanceToCamera^2*angleWithRaycast is not working very well. – Julien Chaize Feb 25 '22 at 09:19
  • you could find the nearest points per chunk and then filter them regarding the angle. This should be faster if a lot of points are visible. Otherwise this will not be so great. If you have a lot of (small) objects, then pre-computing the bounding-boxes should be very useful to discard objects that are not visible on the screen. – Jérôme Richard Feb 25 '22 at 09:39
  • I have not a single octree. Inside an octree I have no problem to find a suitable point efficiently. An object can be behind a pointcloud and be visible between points... e I need to select a point in the foreground object in most of the case but if it is a point cloud it could have empty space that allow to select a point to the background object – Julien Chaize Feb 25 '22 at 09:53

0 Answers0