Changed lighting and shadow code a little, and fixed a material ID error.