What is the feature?
This feature enables the user to alter the shape and the light distribution of the depth of field (bokeh).
To create images like these with a cycles:
What was changed?
Most significant changes are in the way the lens samples are placed onto the lens. Before they where either projected into a disk by concentric_sample_disk or into a regular polygon.
I introduced a third possibility to place them in the intersection of two disk which model from the film-plane visible view into the scene.
For more information please refer to https://knork.org/realistic-bokeh.html or just ask me.
To allow light-distribution a simple weight function that operates on the “radius” of the sample-point was introduced. Similar a distance from center of out shape is defined for a regular polygon and the optical vignetting which allows us to use the same weight function for all cases. The weight function also ensures that the total amount of light passing through the bokeh shape is not altered.
Are there any downsides?
I use rejection sampling for optical vignetting which is physically plausible as light rays are actually being blocked by the lens housing. However this of course means that in focus images will have a vignetting effect and also be noisier on the outside as there are fewer samples passing through the lens.
If anyone knows how to uniformly sample the intersection of two disks please let me know.
Update: I thought it might be useful to provide my test-scene as well