I’m currently trying to solve the same problem this guy had, except I’m doing in Babylon:

You can also refer to this sketchfab model, as it is doing what I’m hoping to achieve:

I want to be able to find if a point P is behind the meshes. I have been using the normal of the mesh at the point P and checking if the normal is opposite to the camera lookat angle:

eq: dot( normal_p, camera.target - camera.position) < 0

but that doesn’t work well for meshes with folds, like a cloth or crumpled paper mesh.

For the best accuracy, I would have to fire a ray at the direction of P from camera, and check if P is being picked, but doing so would drastically reduce my performance as ray picking is expensive, especially when I have dozens of P. It doesn’t really help even if I did all the ray picking once every 1000ms with a setInterval.

I have been looking into the depth renderer / depth map, but I am lost on how to retrieve the coordinates from the depth renderer.

Is there any suggested ways to perform this operation without adding too much load?