Pick objects using painter's algorithm

Hello everyone!

I have a mesh that consists of 10668618 vertices and there is attribute that groups vertices into separate faces.
I want to highlight / select separate faces on pointer move / click, but when using default raycasting to find faceId (that is mesh facet id) of the mesh and then to find predefined face, it has very low performance.
The better solution could be render mesh faces with unique colors somewhere out of scene or on another scene (invisible for user) and on pointer click find pixel color and in this way find clicked face and highlight it on the main scene.

What is the best approach to do that?
Any suggestions would be very appreciated.

This might be worth a read Apparent 150x speed improvement using Rusty Raycast

1 Like