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 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.


An old rendering

Nothing new about QuarkLight really. Fact is, I’ve been busy looking for a new job and getting used to it once found. In addition, I have spent much time working on my site. There are so many features that must be implemented as soon as possible (phong-like speculars, a better obj loader and a faster BIH) that I don’t even know where to start.

In the meantime I’ve found an old rendering I did several months ago, before implementing the BIH. I was sure I lost it, and since the whole scene was hard coded and I deleted that code, I would have never been able to render it again without rewriting every single scene element by hand. I thought to add the image to the blog, so here it is:

The nice thing about this image is that it clearly shows reflections, refraction, normal mapping and speculars.

Academy Awards

Now that the Academy Awards have been assigned, I would like to say a couple of things about the special effects oscar . First, there was no real choice: Avatar’s effects were simply amazing and IMHO no movie in the next three or four years will reach that high quality level. It is the Crytek’s Crysis of Hollywood.

Second: surprisingly enought, no SFX nominations for Transformers: Revenge Of The Fallen and Terminator Salvation, perhaps the two movies with the best effects after Avatar. This reminds me the 2008 awards, when The Golden Compass has been assigned the award instad than Transformers or Pirates of Carribean At World’s End, which definitely deserved it more.

Once I thought that the Academy Awards were reliable at least for the technical categories. Now I’m a bit more skeptic. As a side note, I’m really happy that District 9, an uncommon movie and yet beatiful, has been considered by the Oscar commitee, thought I suspect that this is due more to the social meaning of the plot than the movie itself.

Good Old Sponza…

Two more renderings. This time no reflection/refraction stuff, but the good old Sponza Atrium (new version by Crytek), because I was the onlu one left without a sponza render. No GI though, sky + sun direct lighting, and a point light to ‘emulate’ GI (QuarkLight does not support the Ambient term). In the meantime I was able to speed up the rendering times by a factor of 2 thanks to the great support of the comunity. Rendering times are still quite high (10 min. more or less for the two pics below) but I’m getting better :-)

You might notice a couple of artifacts in one of the two images: I’m quite sure that there is a problem in the bloom filter. I’ll check.

Now is way better

I like those images. The first with sun, the second with sky lighting only (slightly changed the scene in the meantime). Black dots were generated by divisions by 0 in the Yxy -> RGB conversion code. Those divisions cause IND numbers wich always result in other IND numbers, no matter wich operator you use with. In the bloom filter that lead to black circles, with the same radius of the filter radius and centered on the guilty pixels. I still have issues related to this somewhere though, so it is not completely solved.

My real problem, however, is that I really need to figure out how should work HDR rendering. I mean, the sun luminance should reach 10^9 cd/m^2, but for anything over 10^6 (perhaps even less) I get extremely bright pictures with burned colors. Every feature of the floor texture vanishes after TM or the sky is dark. I’m trying to learn as much as I can about radiometry and photometry before going further. In order to get the two images I had to set the luminance values quite low, but this is a temporary hack.

My new Blog, mainly about CG news and my spare time project: QuarkLight Raytracer!

Hi all, I’m really interested in (quite) everything related to 3d rendering and CG, so I thought that it would have been interesting to record somewhere my work in progress Raytracer progresses. As I don’t have much time to work about it I fear that the development is quite slow, so I am also going to report interesting news from the CG world, GPU, SFX and games included!

But first, something about QuarkLight. I’ve started it a couple of years ago, after a few weak attempts to understand what’s under the hood in raytracing applications. I have that insane hobby since when I saw Jurassic Park in 1993, but the mathematic behind RT algorithms always prevented me from implementing something decent. Currently, however, I’m quite happy with QL. I want to complete the currently implemented features and fix bugs before thinking to GI and possibly a refactoring of the material system (among others). The material system is very limited: I implemented a generic one with standard channels (diffuse, specular, reflection, transparency, emission and so on) but later I moved to something more ‘physically¬† based’, wich was a good thing, but right now it only supports perfect diffuse, perfect specular and glass materials.

A couple of pics now: the first before I changed the material system:

The following image is new, made with the new material system: I’m working to add a simple Tone Mapper and a Bloom filter for glares, but something went wrong :-)