more work on lighting algorithm (not done)