Fast Ray Picking in SceneJS
SceneJS ray-picking lets you pick a point on the canves and get the precise 3D World-space coordinates of whatever that
intersects within the 3D view.
It’s very fast, even for really large numbers of objects. While it uses the standard colour coding approach to find the picked object, it also uses the depth buffer to help it find the 3D intersection coordinates, thus managing to avoid expensive ray-intersect computations. If you’re curious how it works, I did a writeup on the technique here.
|Ray pick performance demo||Pick-fly-orbit demo #1||Pick-fly-orbit demo #2|
I’ll assume that you know all about basic 2D picking in SceneJS. Ray picking
is done in pretty much the same way, except that you supply an additional
rayPick flag when you do the pick, and get
back an additional
worldPos property in the result, which gives you the intersection coordinates:
And here’s the ray-pick call:
comments powered by Disqus