-slightly optimized path tracing
made rendering.d match the algorithm presented in the lecture