Fixed bug where material fetch in material atlas would go wrong because
material atlas was not a power of 2.