How to select objects by mouse selection rectangle?

710 views Asked by At

I mean not bounding box and bounding sphere, but exactly pixel perfect, I mean.

Maybe shader or special renderer? Give different colors to different meshes, and by rendered colors detect what objects were selected?

After three days of googling, I haven't found a single answer on the Internet. Help, please.

For example, this Box should not be selected:

enter image description here

How does Blender do it? If I select many objects, he clearly understands what I have selected. Do you have any ideas about their algorithm?

Maybe we can paint objects in the scene in different colors, and render the scene, and then use the pixel colors to understand what colors are visible? And so we exploit the parallel nature of the graphics card? Its like raycasting, but by every selection pixel.

1

There are 1 answers

0
Иван Вольнов On

There is now a feature request at GitHub: github.com/mrdoob/three.js/issues/20530