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.
Merge pull request #114 from Fishrock123/master

Material: allow custom id & do checks by id