I thought I would make a demo to show application of clustered lighting, here are a few screenshots:
And in case you’re wondering, yes - every candle has a separate spherical light attached to it:
There are a total of 16 torches, 22 lanterns, 91 candles and handful of other lights in the scene. Took me a few hours in blender to actually place them
In other news, I tweaked my clustering solution a bit. Saw an interesting trend where a few engines would create 2 separate lookup structures:
- Clusters
- Tiles
The tiles are old hat, but because we don’t need to do Z splitting - you can get more fine-grained tiles than clusters. Then inside the lighting pass - you check both and take the smallest set. I thought this was wasteful, but I liked the idea.
So I thought why not make XY clustering resolution-dependent. After some research - turns out a few engines including Unreal do exactly that. So I’m in good company it appears. Anyway - I did just that, we have a fixed number of Z slices, but XY slices are done every 32 pixels, giving us best of both worlds more or less. Since we get very fine-grained XY slices, I dropped Z resolution to 24 slices. Seems to work very well. Here’s a debug view of Sponza with 1024 spherical lights:
The scale goes up to 13 here, that is - only a few pixels have to look up 13 lights here, mostly it’s ~5.
Speaking of lights themselves - I expanded the concept of point lights to spherical lights, which lets us have softer lighting and better match emitter size.
For comparisson, here are two versions of the previous scene, with the lights
and without
and a few more
Although a darker environment benefits more from numerous lights, of course