Extract visible vertices from a 3D geometry model Let's assume we have a 3D model consisted of XYZ-formatted vertices (such as point cloud model). My problem is given the position and normal of camera or camera projection (i.e. where I am looking at the points- usually given by my API), how can I extract the visible points and remove the non-visible points?

For instance here points corresponding to the black point cloud box and the back surface of the red box are removed. In point clouds, points have a size. So let's assume they have a size, say 5 pixel radius just for modeling purpose.

P.S. It doesn't have to be perfect. Just any approach to somehow remove the non-visible points so to decrease the total points with not much impact on the visible points will work.

Here is a test point cloud model to work with: https://www.dropbox.com/s/dfhyy9xa5i9o2fz/testPLY.ply?dl=0
Idea A:
Draw an invisible mesh that will occlude the points we don't want.

Create a mesh from the point cloud.
Render that mesh to a depth buffer but not to the color buffer.
Render the point cloud using a depth test &quot;closer or equal&quot;.

This approach should give the expected result, but the problem with it is the first part, which is not trivial at all.
Idea B:
Approximate the mesh with fat particles, that are big enough to hide points in the background.

Pick a size that is roughly the typical distance between two points.
Use that size as a particle diameter.
Render the point clouds using such large particles, to a depth buffer but not to the color buffer. Maybe offset that point cloud a little, so it's a bit farther from the camera.
Render the point cloud using points this time, and using a depth test &quot;closer or equal&quot;.

This method should be a lot simpler to implement than A, because there is no need to triangulate anymore. The result will not be perfect though: some points that should be visible might disappear, and some that shouldn't be visible will remain visible. Tweaking the particle diameter and offset will yield different results.
Idea C:
As a very cheap trick, just render the point cloud with a fog function. The farther points are from the camera, the less visible they are. This method won't hide any point, but still help reading the volume.