Thanks for the reply.
However this won't really help me, since I need Object IDs not Material IDs. Since objects with the same material will merge to one color, but I need to mask every object individually. I could apply different materials to every object, but that would be total overkill for a function that works out of the box in the 3ds max version.