Material Mask off camera

I need a mask that is based on what is in the cameras view. Anything that isn’t seen needs to be masked. (yes I know, it sounds stupid. But this is the only way I can get a post processing effect to work correctly. Otherwise it just won’t work in unreal.)

Is there a way to mask material for whatever is not seen on the camera?