Joe Maller: FXScript Reference: Building Joe's Motion Blur

How I used FXScript to build my Motion Blur filter for Final Cut Pro.

Visit the New FXScript Reference and Joe's Filters sites. These pages will be phased out soon and may already be out of date.

Joe's Filters
FXScript Reference

This page describes the FXScript concepts behind Joe's Motion Blur. If you're looking for the page about how to use the filter, click here.

Overview

Joe's Motion Blur is a replacement for the Wind Blur filter included with Final Cut Pro. This directional filter sacrifices speed for quality, but ends up with a much more aesthetically pleasing effect than the built-in filter produced.

 

Unfotunately, FXScript's built in MotionBlur() function kind of sucks and any filter using this routine will be very inefficient at high quality settings. For serious amounts of high qualtiy Motion Blurring, Use After Effects or you could be rendering for a VERY long time. On the plus side, it makes me feel like Building Joe's Minimum Maximum wasn't so slow after all.

Not much to it

There is almost nothing to this filter. Initially there are a few lines to declare variables and set up zoomfactor (described with Joe's Multi-Value Tester):

float w, h;
dimensionsOf(Dest, w, h);
float zoomfactor; zoomfactor = w/720;

The last option in the motionBlur() function sets the number of intermediate steps. This was the major stumbling block of Wind Blur. The smoothest possible blur would have the number of steps equal to the distance, one step for every pixel. However, in most cases there is no perceptable difference between a step for every pixel of distance or every 3-4 pixels of distance.

The trick was not to set an arbitrary amount, but to set an amount dependent on the distance specified. BlurQuality is a slider between 1 and 10. This value is translated to match whatever distance is set with the following line:

BlurQuality /= 20

The reason to divide by 20 instead of 10 is because of how MotionBlur() works. A literal value of 2 steps produces a pair of blur-trail images, one on each side of the original image. Because of this, the steps value should never be more than 1/2 of the blur's distance. Dividing BlurQuality by 20 yields a range of 0.05 - 0.5. That value is then calculated against the distance to derive the final number of steps:

BlurQuality = integer(distance * BlurQuality);

MotionBlur() only accepts integers for the Steps option, using integer() makes sure that the product of distance * BlurQuality will be rounded to the nearest whole number.

Now all that's left to do is the actual blur. The distance is measured in x and y coordinates, using Sin and Cos to translate the angle. (Using Sin and Cos for angle translation is covered with Building Joe's Gradients.) The following needs to appear on the same line in the actual source code:

motionBlur(Src1, Dest, integer(distance*cos(BlurDirection-90) * zoomfactor), integer(distance*sin(BlurDirection-90)/aspectof(dest) * zoomfactor), BlurQuality);

Conclusion

As you can see, there's not much too it. The filter finishes with my standard compositing controls, mixing src1 and the blurred dest back into dest.

The complete FXScript source code for Joe's Motion Blur is included with the paid version of Joe's Filters.

Buy Joe's Filters Download the Free Trial

 
page last modified: October 23, 2017
Copyright © 1996-2003 Joe Maller