Smooth darkness

Smooth lighting

I couldn’t resist the urge to implement the so-called smooth lighting which is also used by other voxel worlds. Basically it is an interpolation of the lighting values that gets received by a vertex. At first, I implemented some very slow naive algorithm, but I soon discovered the splendid article on Ambient Occlusion from 0fps. It also explains how to correctly interpolate your lighting values. The added benefit is that you get ambient occlusion for free. It looks really nice, and realistic in a scary way.

 

Introducing… the darkness

It is a dark place out there, especially at night. I’ve made some huge progress on the engine the past few weeks. I threw away my threading code and started focusing on getting some rendering features working. Instead of using threads, I currently just use a work queue where maximum one task is executed per frame. After some clean ups I will identify the critical sections and create a more robust threading/worker system. But for now, it works well enough apart from some hiccups.

While implementing the lighting code, It took me some effort to get the flood fill algorithm working across chunks. The problem with chunks is that you have to think twice, because there are a lot more (literally) edge cases :-)