Unity Lighting System

Direct light is light that is emitted, hits a surface and is then reflected directly into a sensor. Indirect light is all other light that is ultimately reflected into a sensor, including sky light.

Reali-time lighting is calculated at runtime, while baked lighting is calculated in advance and is saved as lighting data.

Unity: Render Feature Blit

https://forum.unity.com/threads/apply-effect-to-objects-on-specific-layer-using-stencil-solved.841150/

https://forum.unity.com/threads/has-anyone-ever-gotten-a-stencil-buffer-to-copy-with-commandbuffer-blit.432503/

In URP’s custom render feature pass, Blit doesn’t pass the depth/stencil when blitting a color texture. The work around is to create a screen mesh and blit it on the mesh.

Bloom

https://catlikecoding.com/unity/tutorials/advanced-rendering/bloom/

Bloom is essentially three parts:

  1. find the brightness above the threshold in the texture.
  2. blur the brightness
  3. add the result to the original texture.

For the blurring part, we can use Dual Kawase blur. There’s an optimization in the implementation. Instead of getting temporary render texture in the amount of pass, we can only have iteration amount of texture and reuse them by blitting from the last to the first.

As for the the brightness calculation, we can first find the biggest value in the pixel’s RGB value and compare it with the threshold.