Looking for tips on how to create a proper mask for windows

In this image below, I’m trying to figure out how to create a mask of the window glass pane so that I can do a basic exterior background image replacement in post-production.

Usually what I’ve done in the past is to set a wire color for the glass pane, and use the VRayWireColor render element to give me something to work with in Photoshop.

However, in this case, because of the angle, if I used this same approach, I would end up with a mask represented by the Yellow sample region. This would mean losing the exterior side of the window frame. Ideally what I want is a mask that looks more like the Red region.

I’ve also tried playing with the RenderMask script - but haven’t been able to quite produce the mask I’m after here.

I suppose I could remove the glass panes, and use a temporary object that covers the viewable window space on the outside, and use that to create the mask, but then I would lose the glass reflections and would need a separate render pass to merge reflections back in - I’m hoping there’s an easier way?

Managed to find an answer for this from a some-what related thread:

In the Material Editor, I set the Refract “Affect channels” option for the window glass material to “Color+Alpha” and that gave me exactly what I needed in the Alpha channel / render element!

This thread may help you out as well…- Chaos Forums