Hi,
I'm doing some development with raycaster. It works well with mesh and objects. But it sometimes went wrong with Points. Most situation is I have over 300,000 points in the cluster. It nearly works well when I used my develop computer but it begins to hard to precisely pick point on some working computers. I'm not sure whether it relates to hardware or not. Whatever the GPU branch is, or whatever the system is, some computers work, some not. I try to input the same mouse position and camera position, but the intersect array would be totally different for the same point cluster. Is that a bug? Or something I have not realized?
That's too many points...
Emm, we have done some experiment and have found it always work well even with 300,000 points with 4:3 resolution. But others doesn't work.
I'm doing some development with raycaster.
It works well with mesh and objects.
But it sometimes went wrong with Points.
In fact with points it shouldn't work at all.
Why?
Because (obvioulsy) points don't have any surface to cast a ray on.
@RemusMar Raycasting points example
See also Raycaster.params.points.threshold
Actually that should probably have better documentation. I guess it's used to test how close to the point the ray needs to be to detect it?
@looeee
It seems you didn't understand my statement.
I didn't say it doesn't work.
I said for points it shouldn't work at all.
Actually I understood you fine, just didn't want people to get the impression that it can't be done if they come across your comment.
I guess it's used to test how close to the point the ray needs to be to detect it?
Correct. The localThreshold (used for the actual distance comparison between a point and the ray) is calculated with this value and the scale of the corresponding Points object.
I guess it's used to test how close to the point the ray needs to be to detect it?
Logically speaking, that's not correct.
At least for these reasons:
1) you didn't hit anything with the ray, but you get result
2) you can have multiple points in space with the same distance to the casted ray.
3) a point is not a 1x1 sprite (plane always faced to camera).
The bottom line: for points it shouldn't work at all.
@RemusMar
Mathematically speaking, the line can intersect the point, almost impossible to do it anyway, and i understand what you are saying.
Practically speaking it does make sense to support it because it is useful, of course we basically treating points as spheres, its not accurate but its useful.
Well, actually I did get the intersection result on points cluster with raycaster. If it shouldn't work as @RemusMar said, why the intersection result includes the index, distance and the position of the point I click?
@HangchengQi What @RemusMar said is that it works but we should remove the ability to raycast points because it does not make sense matematically...but it works
@tentone Now I understood. I think @RemusMar is correct, sometimes when the points have two or three planes, like the first floor and second floor of the house. You click on the second floor with overview angle, the intersection could be on the second floor or first floor, even the points are dense enough. However, for me, the only thing is why the intersection accuracy is case by case. As now I know, resolution, GPU and OS version would have influence on it.
@HangchengQi If you're using THREE.Raycaster it doesn't depend on the GPU but solely on the CPU. Each object type has its own raycast method which receives the raycaster as argument and calculates the intersections ( i.e. Point.js ). So I don't think GPU and OS should have any influence on this.
I'm working with more than 40 Milions of points and can raycast them without any problems. Could we have a look at your piece of code ?
@Itee Emm, I mean I could do it well on my development computer with any resolution. But the website has not work well on some users' computer. Someone could fix this by using 16:9 resolution. Some could fix it with 4:3 resolution. I just wonder what happens. Actually, this is an inner website, so if we know how to handle this would be enough. But I still hope to totally fix this problem.
I don't think that the aspect ratio has any impact on this issue.
BTW: If there are no warnings, error messages or runtime exceptions, you have to provide a live example for debugging. Otherwise this discussion leads to nothing.
Closing for now. We can reopen the issue if @HangchengQi provides a live demo that actually shows the problem.