"If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization."
More pages: 1 2
Clustered Shading
Tuesday, March 24, 2015 | Permalink

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.

Some useful shortcuts for the demo:
F5 - Clustered Shading
F6 - Visualize clusters
F7 - Classic Deferred Shading
F8 - Visualize stencil mask for Deferred Shading with MSAA




Enter the code below

Saturday, March 28, 2015


Saturday, March 28, 2015

"Fullscreen" is lower GPU usage than "windowed". lol

I got ~3650 fps at 1024x768@8xAA (windowed at desktop 1280x1024) - ~93% GPU usage

Notice: read my previous posts.

Sunday, March 29, 2015

Michael, it's not necessarily a better way to do it. It's a different way to do it, and comes with a different set of pros and cons. On the plus side, it's easier to do light assignment, and you can also do exact culling with very little cost. You also get clusters that are evenly sized and consequently even distribution of lights into clusters.
On the other hand, it doesn't map to pixels as easily, which may add some lookup cost. It also doesn't scale as easily, you may have to use a cascading solution if you have a large view distance.

As for the DX10 icon, yeah I know, I just didn't have a DX11 icon on my site. I'll fix that later.

Whether to do light assignment on the CPU or GPU depends on your needs and workload. Since the CPU doesn't have much to do at all in this demo I expect better performance doing light assignment on the CPU instead of GPU, allowing the GPU to only concern itself with shading.

Wednesday, May 20, 2015

Funny, I recently pitched a similar idea to my technical director called bitset lighting!

Tuesday, July 7, 2015

You pitched a fairly old idea then
Clustered lighting has been introduced in 2012 by Ola Ollson.
As for tiled lighting in general, if not even earlier for the tiled lighting itself, we need to look back at Johan Andersson in 2011 for BF3

Tuesday, February 2, 2016

look - my previous post with my old CPU on March 28, 2015

Now, I've new CPU i7-4790K@4.7GHz HT and...
I got ~3950 fps at 1024x768@8xAA (windowed at desktop 1280x1024) - ~98% GPU usage of GTX 780 Ti Classy - wtf!?

Tuesday, December 18, 2018

Hey, ive been a fan of these demos for a long time. It would be cool to have a demo thats just full of bugs and glitches. Discovering them is the best thing about games.


More pages: 1 2