added shadow ray generation and distribution logic