Optical Flares for Nuke can automatically blink out lens flares using a matte. This is perfect for scenes where a light source goes behind a larger object, hiding the light source.
1. Plug in a Luminance or alpha matte into the “Matte” input of the optical Flares node
2. Scroll down to the 2D Matte Occlusion settings and “Enable 2D Occlusion”
3. Then select the matte type in the “Sample Method” menu
4. Adjust the light radius to control how fast the flares blink out. A larger radius will blink out slower.