Heres a little Blink Script that allows you to select the ObjectIDs as they come out VRay. I built in an option which will premultiply the image by the selected ObjectID. How it works, should be selfexplanatorly.
Blinkscript-based Nuke gizmo for generating mattes or 4D noise from a Position pass.
Different 3d noise types that are applied to rendered position passes.