Joe Maller: FXScript Reference: Building Joe's Color GlowHow I built my FXScript color glow filter for Final Cut Pro.
This filter works by selecting a color and then applying a modified and filled selection back onto the original image. Several relatively simple operations are combined to create a complex effect. The filter uses a keying operation to build it's initial selection, and all of the various options modify that selection.
There are four main steps to Joe's Color Glow:
Channels: The Key to Keying
After working with digital images and Photoshop for a long time, I've come to believe there is no diference between a selection and a greyscale image. Everytime something is selected in Photoshop, a temporary grayscale image is created corresponding to the selected area.
The color glow effect is based on a selected area. That selection is then modified, filled and composited back onto the original image. Since my selections are based on a selected color, I could extract the alpha channel generated by FXScript's
My First YUV headache
This filter was the first where I encountered how YUV and RGB color spaces interact in FXScript. The filter does almost all of it's work in the RGB255 color space. I followed the lead set out in all Final Cut Pro's built in keying filters, which all convert to RGB before keying. I think the reason for converting color space is to match the the color picked on the RGB monitor to the results on the video output. Selecting an RGB color and applying it to a YUV key results in different keyed areas between the desktop preview and video output.
I'm not sure if the pixel format is stored when the
The more I use this, the more absurd it seems. The code
How it works
Since each color conversion must be wrapped in an if/else statement to prevent double-conversions, the filter's source code looks worse than it is. The variable
The code below uses
That might not be the most efficient way of getting information into xbuffer. When I have some time, I'm going to look at other ways of accomplishing that.
Next the script converts the orinal image to RGB255 to prepare for keying. I put this into an if/then statement to be safe even though all DV source starts as YUV219. RGB255 is the same format as the desktop display so the keying operation will match up between the video output and the desktop preview. The end goal of this code block is to get the image content of src1 (the original clip) into
I've got a selection, now what do I do?
After establishing the selection, the script applies various effects to it before compositing back onto the image.
One of the simplest things to do is inverting the alpha channel of the image buffer which will be composited later. Below is a short if statement which will invert the channel based on the setting of a checkbox. Because the keying operation masks the area around
The numbers after the destination and target image buffers refer to the channels to affect. The order is alpha, red, green and blue.
I borrowed code from several of my other filters for many of the options in Joe's Color Glow. Other changes to the composite image include pre and post blurring and a thresholding operation borrowed from Building Joe's Threshold and Posterize. My standard set of compositing controls finishes the filter.
The FXScript Reference
FXScripting Joe's Filters
Joe's FXScript Explorers
Other FCP Stuff
Film & Video
Final Cut Pro
Site Notes Archive (weblog)
About Joe Maller
Past Home Pages Etc.