Nov 24, 2009

My first attempt to global illumination

I was really impressed by the work of Anton Kaplanyan from Crytek on light propagation volume (LPV) for massive lighting and global illumination! So I decided to do a quick test implementation of this method to experiment it by myself. Here are the result:

Direct lightingDirect lighting + global illuminationGlobal illumination onlyGlobal illumination x2

As a quick test, I considered only one LPV aligned on the AABB of a single object (no cascaded LPV). The LPV is one voxel larger than the AABB in order to avoid artifact at borders. Then, I just apply the LPV algorithm discribed in the white paper using virtual point lights and co. As I said, this is a basic test implementation so no SH gradients are used to avoid back face lighting and other artifacts.

The light is a simple spot without shadows.

It is interesting to note that without high frequency detailed texture, the GI lighting have a "square" look mostly due to the Cartesian cubic sampling. Indeed it seems that this is not visible with nice textures and normal mapping, as you can see on the screen-shots presented in their white paper.

Because this is a quick test, the code is somewhat ugly :-|, excepted the class to manage the unfolded volumetric texture. That's why I'm not going to publish it. If you are still interested, send me a mail.

The unfolded volumetric texture I have developed is visible on the bottom of the screenshots. Basically, it represents all slices of the 3D texture. Considering LPV, I also have included a black border color between each slice. Thus, in the shader, I do not have to test if my border samples come from the right slice during the gathering process. However, one step of the gathering process involves now rendering a quad overlapping each unfolded slice (one quad per slice) and not overlapping the black borders.

Ok I could give you computation time for each step of the method but as I said the code is note optimized, there is still a lot of tests (even in shaders!) and I am on a laptop PC...

Next step: implement this method as presented in the paper with cascaded LPV, importance sampling of virtual point lights, etc. I plan to implement this in my small engine I am using now for my PhD (will speak about it later). I don't know when I will do this since the pressure increases as the end of my PhD come closer.

Thanks for reading!

2 comments: