Like my last demo, this is sort of a modern take on an old idea. Sorting rendering back-to-front with a BSP isn't exactly a new idea, but a parallel traversal in a compute shader might be. I've been pondering on this idea for a lot longer than I care to admit, it's probably been in my TODO list for over 5 years, but I finally got around to play with it and see if it was meaningful. My original idea was actually to traverse the BSP on the fly in the vertex shader, which of course is entirely possible, but ultimately decided that it makes more sense to do it in a separate compute pass.

This time it's a sort of hybrid between Clustered Shading and LightMapping, which essentially forms a lightmapping solution that's compatible with normal mapping, and while the lights need to be stationary, allows most other attributes other than position to be dynamically changed. In this demo you can interact with all the lights, turn them on and off, change color, or switch to an animated mode.

If you've been using MakeID.h I suggest you download the latest version. The previous version had a minor bug that made it copy an element too much when it reduced the number of ranges. This didn't impact functionality, but in edge-cases it could result in a read outside of allocated memory, which if you're really unlucky could cause a crash. Thanks to Markus Billeter for reporting the issue.

I've done some internal plumbing in the website scripts. Hopefully you should see no difference at all, and I've clicked around quite a bit to verify that everything still works. If you see any that's not working on this site, please let me know.

So, uhm, it's been a while since I last posted a demo here. I have valid excuses though. This whole kids situation sure makes a dent into your available time, and for the time that remains it sure has an impact on how much energy you have left at the end of the day. But it's a great joy too, so I'm not unhappy about it in any way. And the other thing is of course that I moved into a research position at work, which reduces my itch of doing so much research at home during my spare hours. But with that said, I recently ended up browsing into my site with another guy at work for reasons I don't remember, and the realization that it had been nearly three years since the last demo was a little too depressing for me. So I made it a priority to make another one, and now it's here.

So for this demo I'm poking around a little with Clustered Shading, but exploring an alternative implementation of the underlying principles. The main differences being world-space clustering, storing active lights as a bitfield, and going full forward shading instead of deferred. Well, except for the reference I'm comparing to.

Me and my wife and kids make an appearance in a documentary series on Swedish TV. The series is called "Vi ska ha barn" (roughly translates to "We're getting a baby") and the various couples discuss their hopes, fears and expectations around having kids. In our case, the angle is mostly about getting a second child, and about tackling cultural differences in the family.