The algorithm do do a proper Zblur would make a complicated graph in which the number of nodes depends on the blur parameters, so it is better to code a C++ plugin for that.
We first have to code Convolve, then Lens aperture generators, Bokeh, and finally Zdefocus.
As described here: https://github.com/MrKepzie/Natron/wiki/Google-Summer-of-Code-GSoC-ideas
The goal of depth-dependent defocus is, given a depth image and a all-in-focus color image, to blur each pixel in the color image depending on its depth. Many algorithms are available in the litterature have been proposed, but some of them produced coarse approximations of the result. The implementation in Natron should at least handle correctly occlusions by foreground objects.
We propose the following method:
1. extract "depth-slices" from the image, using the depth image. a depth slice is black and transparent everywhere except where the depth is within some range, where it is the original RGBA data.
2. blur each slice with the proper blur size (FFT-based convolution is necessary for a proper Bokeh effect). The in-focus slice is not blurred.
3. merge-over each slice, from the back to the from. That way, each
blurred slice may occlude objects in the back.