I wanted to add some effects to make the sun glare as you look directly at it.
To achieve this I first experimented with my own SunGlare.cs script that increased the light intensity from the sun directional light as the angle between the camera angle and the light direction gets smaller.
I experimented with relating the intensity to different powers of that angle, and a simple quadratic relationship seemed to give a pleasing result.
After googling about how others achieve glare and lens flare I learned that the Universal Render Pipeline in Unity has a lot of these effects built in to what it calls volumetric post-processing. This made it very simple to add lens-flare, camera bloom with dirty lens effect, and realtime adjustments to the scene colour, contrast and exposure.
I was really pleased with the combined effect of these built in post-processing effects plus my own SunGlare.cs script to increase the sun intensity as you look directly at it.
Comments