ID mask noisy when using Volume Scatter for World volume I've made a sword in this medieval blacksmith scene an ID mask so that I can give it a glare effect without affecting the rest of the scene, but because I used Volume Scattering for the world volume, the mask shows up like this:



Without volume scatter the mask looks fine, and I've tried rendering the mask without volume scatter enabled but it looks too far removed from how it looks WITH volume scatter not to stand out when I add it back into the scene. 

This only happens when I include an ID mask node in compisiting. Is there a way to fix this or a workaround?

This is how I have the compositor nodes set up so far in case it helps:
ID masks are generated from sampling as far as I understand. The quality of them depends on the amount of samples set for the render. If it's noisy, you should increase the amount of samples for the render. It is worth noting that ID masks are also 2 bit black and white images so there is no anti-aliasing at all and that makes the usefulness of them very limited (some might even say 'completely useless'). For glare effects they are completely adequate, however, if you want good masks with anti-aliasing  for other purposes you should render them separately with shade-less materials made with emission shaders assigned to objects in the scene or another a lot better option would be to use Blender 2.80 that supports Cryptomatte that is way more convenient and powerful solution for generating masks.