Making custom glare shapes in Blender's compositor

I’ve been experimenting a bit with glare lately, and, with the help of some YouTube videos, I found out that essentially, a lens mask’s Fourier Transform dictates the glare shape
So if your lens is shaped like a heptagon, then its fourier transform will look like this:


And plugging the image into the Bokeh Blur node in the compositor you get the dispersion effect for the glare:

Then, simply add in the blurred image to the original with the Mix Color node and you’re good to go!

The advantage to this method over the Glare is is you can make the lens any shape, for example a heart or a leaf, and the glare will still work.
The disadvantage is that it’s a bit more tedious and can take longer to process

Do you know of a way to add custom bokeh shapes “in-camera”? I don’t like comping DOF, and the default Cycles bokeh looks too clean. (And I’m too poor to afford the camera addon.)

Place a plane a few centimeters in front of the camera lens in-viewport with a transparent material with a mask
White transparent in the open lens, black transparent in the closed lens
Then just enable DOF

That’s kind of what I figured, but I couldn’t find any good free realistic bokeh images online…

That’s what shader nodes are for :wink:

This might be helpful:
https://www.blauwfilms.com/research/bokeh-of-the-human-eye-and-camera

Some here:

And here:
https://drive.google.com/drive/folders/0B8-FOWcYQNtTN3BZU2NlYm84WkU?resourcekey=0-jaM4ARiljJPGuOfuktMWsA&usp=drive_link

These are great resources, thanks!