Updated the shadow offset calculation. Fix #194.

Also made it slightly more efficient by only calculating the shadow offset if we actually have a shadow!