Material: allow custom id & do checks by id

This allows you do things were you may need to
 have separate material instances that should be
 treated as if they were identical.