Pathtracing Algorithm with code and example renderings