High Res Screenshot With Custom Depth Mask Not Working

I found out that the object was past the render distance that unreal would render the object.
A very hacky solution by editing the built unreal material asset function was found here, but hey, if it works:

This took me forever to figure out, and I feel there should be a better solution.
Anyway, thanks for the help guys :stuck_out_tongue: