Implements path tracing (mostly) correctly. Still quite buggy, but works(ish).