Performance improvement for material shadow and bug fixes