Here an interesting gizmo for digital compositor for Nuke.
OpticalZDefocus is a physically accurate ZDefocus, which controls circle of confusion (coc) size based on lens geometry using the depth of field equation. Set your lens and film-back characteristics, your focus distance, and adjust the size of your bokeh with the aperture size, just like a real lens.
OpticalZDefocus v1.1 gizmo for Nuke by Jed Smith (http://jedypod.com)
Download:
OpticalZDefocus v1.1 For Nuke
OpticalZDefocus is a physically accurate ZDefocus, which controls circle of confusion (coc) size based on lens geometry using the depth of field equation.
Set your lens and film-back characteristics, your focus distance, and adjust the size of your bokeh with the aperture size, just like a real lens.
Features
- Unpremultiply your depth channel by the selected alpha
- Sample the z-depth value at a given x/y coordinate
- Supports multiple depth units: mm, cm, m, dm, inches, feet
- Automatically snarf lens geometry data from a selected camera node
- Min z-depth value to avoid long processing times on cg with transparent alphas
- Fast constant defocus mode which will not calculate depth of field
The latest version will always be here: https://gist.github.com/jedypod/50a3b68f9b5bbe487e1a
There is also a video about the depth of field which includes a section about how to use the tool here, for those that are curious: Simulating Physically Accurate Depth of Field