material index & Anti-aliasing

I’m new to Blender. :smiley: I want to have a separated material layer. So I indexed that material, setup my nodes, but the result I got from the edges is too bad. It seems it has no anti-aliasing at all.
May I ask what should I do.
Thanks

Attachments



What would be the meaningful anti-aliased material index value? For example between IDs 2 and 3? Is 2.5 a material with ID 2 or ID 3? Or maybe it is a blend of 1 and 4?

There is no meaningful way to antialias ID values and for this reason they are exact, as IDs should be.