re render the model with a black background
open up the background image in photoshop
paste the render in as a new layer
use the magic selector tool on the black areas and delete it
or
As I see it masks are just opacity maps
render another Zdepth with a huge zdepth distance so all of the geometry within the scene is completely white
then open the background image in PS
paste your render of your geometry
apply a new mask
paste your new Zdepth as the mask, if this doesnt work you will have to invert the Zdepth colours (im not sure how to do this in PS I usually do it in Paint lol mspaint FTW! lol)