Clustered Shading
As the main specialization project during my second year of studies at TGA, I developed clustered shading for my DX11 engine.
It allows super fast calculations of lights by assigning them to clusters, ensuring that only lights that affect the pixel are factored into the lighting calculations.
First, the camera frustum is divided into grid-like clusters. Then, all of the lights are assigned a sphere collider, which is then checked against the frustum and its clusters.
If a light is found to be overlapping, it is added to the cluster.
When doing the final render pass to combine the results from the deferred rendering, the shader calculates the world space position of the pixel in order to evaluate which cluster it is inside.
Then, it loops through the lights assigned to that cluster to do the lighting calculations.
This is a lot faster than the previous method used, which was simply to brute-force calculate all pixels against all lights. With a large amount of lights in the scene, massive amounts of resources were wasted,
as most lights ended up not affecting most pixels. With clustered shading, only the lights which are likely to affect the pixel are actually used in the calculations of the lighting.
Contact me at: ludvig.thread249@passmail.net