With the knowledge gained from implementing a simple path tracer, surfing the internet and watching lectures about global illumination on YouTube (http://www.youtube.com/playlist?list=PLslgisHe5tBPckSYyKoU3jEA4bqiFmNBJ), I decided to start over with an empty project and set up a clean code structure.
- Working indirect illumination. Taking things, such as the BRDF of the material and probability of sampling a given ray, into account
- Cosine-weighted sampling for diffuse materials
This means that I'm pretty much just as far as I was before, but now with cosine-weighted sampling.
I'm currently trying to implement a direct lighting approach. At every ray-object intersection point p, I sample a random point on each of the lights and calculate their contribution to the lighting of point p. Given that I have not implemented any kind of fall-off of a light's intensity over distance, an image generated with just direct lighting appears far too bright. As such, the combination of direct and indirect lighting at every intersection is heavily dictated by the (incorrect) direct lighting. This can clearly be seen in the gallery album included with this post. Or, at least, I hope so. Since I've never uploaded one before.
However, I'm wondering if implementing fall-off of the light's intensity will "fix" this. Since it will make the indirect lighting image even more dark, making it contribute even less compared to the direct lighting image. But I guess we will see how it all works out.
An optimization to reduce noise might be to sample the light's shape projected onto the unit hemisphere around the normal, instead of sampling just some random point on the light's shape. Since for a point p, a large fraction of the points on, for example, a sphere are occluded by the sphere itself. This would lead to a whole lot less samples that lead to no contribution.
After direct lighting is fixed, the next thing on the agenda is... CUDA! In the next entry, I'm hoping to show off some slick videos of how awesomely fast and interactive our path tracer will be. Stay tuned!