That fixes the darkness issue. Now the only real issue is the frame rate reduction when the lens flares come into view. It seems dependent on actual sun blockage, IE, the more the sun is blocked by something (most likely a vessel) the more intense the frame reduction is.
Yes. When direct sunlight is blocked, the code does nothing and simply returns the image without doing anything. Else, the whole lens flare code is applied.
One of the first things I'll do is to separate the process into two parts: when the sun is within the camera frustum, and when it's outside. I still want to have the flare appear, but because it is outside of the frame, a simpler code should be executed.
Furthermore, the current setup does the job as a proof of concept, but I want it to be actually beautiful... and more realistic.
So I've closed everything I could to make the room as dark as possible, and took some photos of my phone's flashlight directly (I have a Canon 1100D, and I shot it with a 55-250mm lens, if anyone's asking).
The result is that, well... There's more to them then anyone could have imagined :rofl:
The resulting lens flare are simple (not a lot of components) but quite interesting: the further out to the edge the light source is in the frame, the more "egg shaped" the flare becomes. This is similar to what happens with out of focus blur. Also the glare of the light source is more diffuse at a low aperture (f/4.5 in my shots), but the "light streaks" appear on higher apertures levels (f/22 here). Given the no DoF and the high brightness, I can safely assume the aperture will be set high :lol:
I've already got some code I wrote for "barel distorting" DoF
here (set the anamorphic distortion to 0 so better see the effect), surely this could be easily ported to this Lens Flare shader.
Actually, the best thing would be to implement this badboy:
http://resources.mpi-inf.mpg.de/lensflareRendering/pdf/flare.pdf :lol:
---------- Post added at 16:03 ---------- Previous post was at 14:03 ----------
Here's a new version of the LensFlare shader. Barrel distortion is pretty much there, and it's now more subtle, and more colorful!