This is the eighth in a series of posts about building a bokeh simulator. This series starts here.
I’m still struggling with how to efficiently program the off-axis bokeh simulation, but I did write some code to do a simulation with a static offset, if that out of focus (OOF) point spread function (PSF) is run against the entire image.
Here’s the result of a run a 50-pixel disk PSF (on a 2500×2250 image) with no occlusion, scaled down to web dimensions:
Now let’s imagine a lens that occludes quite readily, with a diameter of the occlusion the same as that of the on-axis OOF PSF.
This sim gives us this:
You can see that the blurring is diminished, but there’s an odd quality to it. The occlusion that I picked would make the image darker in a real camera, and it would have in the sim, except that i compensated for it.
Same idea in the other direction:
And in the corner:
CarVac says
The simplest way (if a bit cheat-y) would be to do a bilinear blend between the nearest four PSFs.