How do I make a compositor filter effect affect only a specific part of the render? So, this is my node setup and as you can see the sunbeams affect the entire image.



However, I only want it to emit out of the doorway. So I created a mask for that and plugged it into the factor input. 



But the output isn't exactly accurate.



So, how do I solve this?
The mask was limiting the result of the sunbeam node to the doorway itself. You can multiply the mask against the image, then run that through sunbeam and add the result to the original image.