Creating antialiased Material ID masks

Here is a link to a video that has a good solution to creating anti-aliased material and object ID masks. Something a software like Blender should do anyway. The material ID masks created by Blender are badly aliased.

It is in German but by just watching the video it is easy to figure out.