Reputation: 73
I have trouble about picking points in 3D scene in WebGL. I found a example that is possible attach ID to each point through the RGBA components. It works but usually a point which is clicked is so far from wanted. I have point cloud of about 1.5mil points. It seems that function readPixels() returns little bit different components of RGBA in same area of click and ID is different too. Maybe here is some problem that shaders use [0,1] interval of color components and function readPixels() unsigned byte. Maybe so many points located in 1 pixel. In the picture is the red point place where was clicked and the green point is the place where ID (RGBA components) were found. I tried to set bigger gl_PointSize for example 30 pixels in ID RGBA layer and then I could find right point, but it is not accurate.
In the picture below the position was correct because function readPixels() returns correct RGBA components (ID).
Upvotes: 1
Views: 97