This location is for Registered Users Only.
Perhaps you need to login or register.
5.2 or later
This was put together in an effort to put some optical realism into cg imagery.
It employs the FFT tool suite (FFT, FFTMultiply, and InvertFFT), which allows for fast image based convolution. For small image kernels, the Convolve node works well, but as the kernel image gets larger, the Convolve node gets impractically slow. In an FFT convolution, most of the overhead seems to be taken up in the conversion to and from frequency space, and the convolution itself is relatively quick.
The idea here was to make some extremely high dynamic range images, with a still camera, in a dark environment, of a backlit pinhole. The resulting image(s) would thereby record the "signature" of hoh light is scattered within the optical system. By using the resulting image as a convolution kernel, a real optical quality could be applied to cg imagery.
I have so far been able to make three kernels of useable quality:
If you open these 'kernel' images in Nuke, you'll notice several bright pixels in the center of a very dark frame. However, if you raise the brightness of the image, you'll see that the "black" areas of the image actually have non-zero values, and as you bring the brightness up considerably, the values extend into a fairly large area of the frame.
What this means, in terms of using the images as convolution kernels, is that a tiny amount of the input pixel's energy is dispersed around a rather large portion of the frame. Under the circumstances of normal image values, the result is a slight softening of the image. However, in the case of very bright specular reflections, the apparent "spread" is larger; and as the input pixel values become greater and greater, the apparent spread gets larger, as well.
To use it, you'll have to:
- put the three kernel images in an accessible directory, and create a LensKernelFFT_Group_v01 node in Nuke.
- Open the group node's properties, and go to the "Kernels" tab. There will be three filename knobs whose names correspond to the kernel images (f1.4, f2.8, f5.6).
- Load the kernel images into the filename knobs, and save the Group wherever you store your Groups & Gizmos.
To use, attach the LensKernelFFT group to an image you want to convolve. It works best on images that use a high dynamic range. In the real world, small specular reflections of the sun or light sources are generally much brighter than other, non-specular areas, and in cg imagery these will b represented by floating point pixel values much greater than 1.0 (values well above 50 might be encountered) .
The "output" pulldown should generally be set to "convolution result" (there's an "input kernel" option, that just passes the input kernel image to the output, this is mostly for troubleshooting purposes).
The "channels" pulldown allows you to choose "RGB" or "RGBA", when the alpha is convolved, the luminance of the rgb kernel is used as the alpha kernel.
The "kernel" pulldown allows you to choose betwen the three kernels. The kernels yield very different results. The f2.8 & f5.6 kernels have a pronounced eight pointed star pattern that corresponds to the diaphram blades. The f1.4 kernel displays none of this, as f1.4 is the wide open setting of the lens.
One of the byproducts of FFT convolution is "image wrap", that is, the convolution of a pixel on the edge of the screen shows up on the opposite side. This is normally not an issue unless very bright pixels are at the edge of the image. The 'pad frame' parameter adds a number of pixels to each side of the image before the FFT tools are applied, and is meant to be a work around for that byproduct. The larger the '"pad frame" value, of course, the more time consuming the FFT conversion and convolution process.
When making photographic images, everything, dark and light gets scattered through the lens, and, in concept, the full spectrum cg image should be processed through this node. In practice however, I feel that applying the convolution to the entire image makes the dark reas of image too soft. So you might (probably) want to key out the bright areas (a soft key works best, try a blackpoint of 0.1 and a whitepoint of 1.0), and convolve those brightest areas. To preserve overall image energy, you'll probably want to subtract or stencil out the keyed areas from the base image, and add the convolved result to that.
Because this node isn't terribly fast (although, compared to the Convolve node, it's very fast), you may find it best to precomp the result, once you've picked a kernel and key level you're happy with.
There's nothing magical about the kernel images, they are just extremely high dynmic range images (exposure times range from 1/1000 sec to one hour). If anyone is interested in making their own kernel images, they should feel free to do so. My experience is that are much better saved as full float, rather than 16 bit half float.