|I was working on some of the Init levels, and they were all looking pretty bland. I figured I'd take some of my old code and put the lightmapper I wrote ages ago into my level editor. That of course would be too easy so I started this Ambient Occulsion Shader test.
Basically I took my old lightmapper, rewrote it to use a KD-Tree instead of an oct-tree (cos KDTrees rule!). Ripped out the old lighting calculations and then put in the ambient occlusion code. Its pretty simple - from every point on your lightmap, send a heap of rays in random directions. If you hit something darken the value, if you don't lighten it. Basically its colour = (misses/total_samples) * 255;
Oneday I hope to integrate this into my Init levels so that they are all permenantly shaded. Till then its just a cool little demo app.