There be Light
Shame on me. I began to feel a bit sad because everyone and his grandmother has a working self-made GI raytracer (or at least this is my impression when I go on Ompf.org). Of course, QuarkLight has a few features that I never showed in the previous renders (a couple of procedural textures, textures operators, a thin lens camera model for Depth of Field just to name a few) but, com’on, no GI.
I added the following code to my Trace routine (right after the direct light computation and just before the reflection stuff):
//Add GI
real gipdf;
vector4<real> gi_sample = mat->Sample(in, hitdesc, gipdf, SCATTERING_TYPE::DIFFUSE);
if(gipdf > real(0))
{
gi_sample = toWorld * gi_sample;
SurfacePoint gipoint;
gipoint.previousIOR = hitdesc.previousIOR;
ray<vector4<real>> gi_r = ray<vector4<real>>(hitdesc.point.point + hitdesc.shadingGeometry.normal * Q_EPSILON, gi_sample);
Spectrum gi = Trace(gi_r, gipoint, depth - 1);
color = color + gi * gipdf * r.direction.AbsDot3(gi_sample);
}
I would call it some sort of Path Tracing, but I fear It would be misleading. I don’t even know if this produces correct images…
This is what I got after 4 hours of rendering (1024 spp):
Just 2 considerations:
1) Yes, it is very noisy. I don’t have the time to leave the pc working for 8 hours (and my wife does not like to have it heavily working when nobody is at home or by night). I will try to move from uniform hemisphere sampling to cosine sampling. This should improve things. Once I’m sure this approach is ‘correct’ I might also try with multiple importance sampling but still, there are simply to many things to add/fix in the direct lighting raytracer before thinking about GI.
2) I’m currently using a very simple Tone Mapper. Results are not very good, but my other TM is broken so this works better. I also have the hdr output and I used the Qtpfsgui tool to get prettier pictures, but noise increases. Once I have a cleaner image I could use that toon on it before posting next time on the blog.







