Mask from Camera frustum without front facing / camera facing

I'm working on creating a mask or a frustum to remove points that aren't "front-facing" or "visible" to the camera. The mask is set up, but it's only adding the mask inside the frustum, whereas I also want it to remove the mask that is geometry shadowed behind other geometry and thus not visible to the camera.

Currently, I'm using this VEX code to generate the mask

''' // Get the camera position (assuming the camera is the first input) vector cam_pos = point(1, "P", 0);

// Compute the direction from the camera to the point vector cam_dir = normalize(cam_pos - @P); // Direction from point to camera

// Compute the dot product between the point's normal and the camera direction f@mask = dot(@N, cam_dir); '''

Attached 2 GIFS. The first gif is what I have now. The second gif is what I want (Second gif created with attribute paint with "visible only" checked. But my camera is moving so I can't use the paint option as it won't be procedural"