Goal: Given a surface mesh (terrain), discard all points above a given elevation relative to the terrain. The terrain can change quite often due to tiling and LODs, so the point culling will need to be dynamic and have good performance. The camera in our scene is free floating, so no assumptions can be made in that respect.
My initial attempt was to draw the terrain, translated to the given elevation, only to the depth buffer. Then, when rendering the point cloud, discarding points that fail the depth test. There are a couple problems with this method though: I have to determine which side of the translated terrain the camera is on and, if above, flipping the depth test. Also, if the camera is looking at the terrain edge-on, points will be discarded that shouldn't be.
Any ideas are welcome, and let me know if I need to make clarifications regarding the task.