pnext / three-loader

Point cloud loader for ThreeJS, based on the core parts of Potree
Other
201 stars 88 forks source link

Clarify usage of the pick() method #29

Closed Zielon closed 5 years ago

Zielon commented 5 years ago

In the Potree 1.6 there are used 2 different renderers. However, three-loader uses only one renderer with a copy of nodes to render them separately in a scene. Does it mean that I can use directly the same renderer instance for both, pick() and a point cloud? Do you have any example code with a pick() usage?

hccampos commented 5 years ago

Hi @Zielon !

Indeed, you should be able to use the same renderer for rendering the point cloud and for rendering the picking materials. The latest Potree uses a custom renderer for the point cloud which is faster but breaks compatibility with IE11 (not acceptable for us at Pix4D).

const normalizedPoint = new Vector2(x, y);
const raycaster = new Raycaster();
raycaster.setFromCamera(normalizedPoint, camera);

const pickResult = pointCloud.pick(renderer, camera, raycaster.ray);