I am trying to identify the visible faces of a mesh within a certain area on screen (defined by an SVG path) in three.js
There is no guarantee that either the path or the mesh will not be concave.
I am able to:
- filter the faces within the area (by mapping the vertices to their 2d position and using elementFromPoint
- filter faces facing camera like this
camera.getWorldDirection().dot(face.normal) < 0)
but I am not able to filter out faces that are hidden by other faces.
That means that if I the mesh is - say - a vase, I would end up selecting both the visible faces on the outside of the vase, and the ones inside, that are not visible, but face towards the camera.
What would the method be to filter out faces not visible to the camera?