move common lighting calcs to separate file