KPT5 Blurrrr Technical Notes

back

Michael Herf
19 May 1999 (Orig)
20 Dec 2000 (Revised)




Hi-Speed Blur
Kraussian Blur
Camera Optics
Motion Blur
Zoom Blur . Spin Blur . Spiral Blur
Gaussian Weave . Spiral Weave

The untold story

KPT5 has some very powerful capabilities. However, I think that many of them are not well known. This article is my take on KPT5 Blurrrr. I think you'll get a lot more out of the filter after reading.

For reference, I wrote much of the core technology in Blurrrr, and I don't like typing three extra "r's" after "blur" either. :)

Thoughts

It's incredible how terms that only electrical engineers would have said 20 years ago are now common terms for artists everywhere.

I was listening to Chuck Geschke's retirement webcast from Photoshop World last year. They had a lot of artists speak about a kind of "What Photoshop means to me," theme, and the comment almost all the artists made was, "Photoshop works like I think," which is kind of surprising.

We use the words "filter" and "Gaussian" and "gradient" and even "bicubic filtering" without really thinking that these are scary-technical words. I guess they work, and they accurately convey concepts, and that's all that matters. I've talked with lots of artists, and they're actually very fascinated to learn, say, that a Gaussian is a smooth hump, just a bell curve twirled around its middle.

When we were spec'ing the UI for KPT, Kai wanted three levels of everything. One level was presets only, the second was visual and interactive, and the third level was a "spreadsheet view," where every parameter was tweakable and editable to about 10 decimal places.

We ended up with a hodgepodge that gives some of the feedback of the second level, and some of the numerical accuracy of the third level.

My purpose here is to show you what you'd get if you had that spreadsheet view, and you could see the filter from the inside.

Hi-Speed Blur

The Hi-Speed Blur came about from my attempt to find the cheapest possible decent-quality blur. I initially thought it was a Gaussian, but Ben quickly disabused me of that. It's also not quite separable (meaning it's a 2-D filter, not two 1-D filters like the Gaussian), but my implementation pretends it is, so you get some mild streaking around edges.

This filter applies at exactly the same speed regardless of the blur radius. That means that a 1-pixel blur or a 500-pixel blur will apply at exactly the same speed. Using this when you really want to blur a lot pays off.

This blur is the fastest one I've measured. In benchmarking, it achieved 21 frames per second at 640x480 RGBA on a P2/400.

Since this isn't a perfect blur, it creates some horizontal and vertical streaking. If you're concerned about this, the best thing to do is to apply the filter twice, and it'll clean itself up.

Kraussian Blur

This gem of a filter is Ben's brainchild and technology. The Kraussian blur has many useful features. Most of them are subtle or hidden, but you'll fall in love with at least one.

Dither

As many of the KPT5 effects now do, this blur will dither its output to recover some extra bits of precision. To understand how dithering helps quality, try the following:

  1. Open a new document.(RGB mode), say 256x256.
  2. Use Photoshop to make a gradient from white to a light gray (240, 240, 240)
  3. Use the Photoshop Gaussian Blur at 10 pixels.
  4. Use Auto Levels. Yikes! The banding!
Now try the same steps, except use KPT5 for the blur, with dithering on. All the banding has moved into noise intead, effectively preserving the original signal much better. CDs use a similar technique to encode digital audio -- they use a higher-quality signal and dither the output.

Variable Radius

Here's a gem: the mysterious "Fade" parameter in the Kraussian blur. Each pixel can blur at its own radius! When you turn OFF "fade" it enables the variable-width blur. Sadly, this concept didn't really make it through to the UI.

If you know After Effects, this effect is called the "Compound Blur" and people love it. However, here it's just a bit hard to get to.

Let's start with an image to show this off.

1. 2. 3. 4.

1. Make a new document, 256x256, filled black. Now select half the document and fill white.

2. Start by making a soft selection - no hard edges. (To do one quickly, just draw a shape with the lasso tool and then feather at about 20 pixels.)

3. Now in the Kraussian Blur filter, use the option menu (the triangle in the Parameters menu) to turn on Fade. Apply at about 36 pixels. This is the typical result of rendering a blur with a soft selection -- full blur, or nothing, or fade in-between.

4. Start again with (2.) This turn off the fade parameter. You'll get an astounding result!

Everywhere your selection is "full" the Kraussian Blur uses the exact blur radius you choose (36 pixels). Everywhere else, it will scale the blur radius towards zero proportionally, until at the edge there is no blurring at all!

You can use arbitrary masks and blur each pixel separately. (I recommend getting to be good friends with Quick Mask.)

Notes: I think there are some bugs that cause the variable width blur to apply as if it's rendering to the preview. At times, I've had to crank the radius way up to get a good result. This one deserves to be fixed.

Wrap

One more feature of this filter: wrap.

If you want to blur a wrapping texture in Photoshop, you'd have to manually change your canvas size, copy the image to a 3x3 grid, and then blur, then crop again.

Or you could check the "wrap" checkbox in KPT's Kraussian Blur.

Use this when you're making seamless textures by hand, so you can blur them and not worry about cloning/retouching the edges later.

Camera Optics



"Soft focus" in photography is in, and a Gaussian doesn't cut it for backgrounds that really look like they came from a camera. The reason is that the effects are really quite different.

Gaussians are relatively smooth filters -- they taper very gently, leaving behind very few hard edges. Lenses, even out-of-focus ones, leave some of the hard edges. This is because they blur with a disc, not a smooth bell-curve like the Gaussian. (To understand why this happens, think of the shape of the lens!)

Camera Optics simulates this effect and is a perfect match for rendering out-of-focus backgrounds and depth-of-field effects.

Everything's straightforward here, except perhaps the "blowout" slider. (Ugh, it should be called "Bloom" but somehow that didn't make it.) When you photograph a very bright light out of focus, it will bloom into adjacent spots of the film, leaving telltale colored discs behind. (Cliche movie intro, out of focus streetlamps, yeah that.)

To simulate this, Camera Optics uses a highlight detector, and lets you dial up the "actual" intensity of those highlights. In other words, it detects the bright regions of the picture (the ones that your film, scanner, camera couldn't quite represent) and makes them even brighter.

If you don't notice anything happening when you crank up Blowout/Bloom, go back to Photoshop and tweak Levels so that some pixels are at the top of the range. (So they're white or have a component that's 255.) The highlight detector will then find them and you'll get the right effect.

Motion Blur



This filter is similar in concept to Photoshop's motion blur, except that it's not really a motion blur. :)

Two big differences: First, it's a gaussian in 1-D, not a box blur like Photoshop's. Yes, if you're doing shutter blur, a box is more correct, but Gaussians have a lot of creative uses. Also, the KPT Motion Blur automatically wraps on the edges, which is amazing for seamlss textures.

If you haven't realized it, this is an exposed piece of the spiral blur.

Spin Blur, Zoom Blur, Spiral Blur

I got to do this great demo at Macworld 1999 (in San Francisco.) I demoed Photoshop's zoom blur.

For 2 minutes a pop.

I'd talk straight for two minutes, waiting, while they blurred a 640x480 image. And then, finally...

finally...(sorry, thought it was going to apply already)...

they'd finish, and I could zoom in and show how noisy the result was.


Cropped from a 1280x900 image.

And then I'd run the KPT equivalent, wait about a 5 seconds, and show how it was a better-quality result. It was really fun.

I thought it would be more fun to post some old emails about how this filter came to be, rather than just droning on in here. So in the voyeuristic way that everybody loves to read other people's email, here ya go:

Mike prototypes the filter and sends pictures.
Mike gets the filter working and tells everybody.

Like the motion blur above, these blurs use a Gaussian kernel that tapers near the edges, rather than creating hard boundaries.

The spiral blur is a true generalization of the two. Where Spin is a 0-degree rotation, Zoom is a 90-degree rotation, Spiral lets you choose any angle in between -- a whole continuum of possibilities! You can generate spirals of any kind moving towards the center of an image.

Tip: since all these blurs are centered in the middle of the image, try adjusting the canvas size to change the center point before applying the filter (yikes, that's work!)

Gaussian Weave, Spiral Weave

There's not actually much to say here, but it is cool that Moe & I literally did these two filters in an hour, total.

They basically use a "maximum" (Lighten in Photoshop) to apply two blurs on top of each other. For the Gaussian case, it's a 1-D Gaussian. For the Spiral Weave case, it's two spiral blurs that have opposite angles (they add up to 90 or 180 or something.) You can make really cool effects with this thing, but there's not a lot of depth to talk about!

 

KPT 5/6 Usability Notes

It was October, 1998, and I was playing with RealPlayer, and they had this "Compact" mode where the app would show more UI when you moused over it, and less when you weren't paying attention. So I decided to one-up them, made this animating thing where the panels would shrink when they were inactive, and show you more when you were using them.

I showed it to everybody, and then decided I hated it. It distracted you from your work, made you lose context, hid values that you needed for working with an image. It was a passable idea for watching video (where having the UI around could be a distraction), but really bad for editing pixels.

In that somehow-inertia of, "That's a feature," or "I like that," the feature stayed, in a simplified form. Hence KPT5 and KPT6 both ship with "Panel Auto Popup" turned on by default.

Moral of the story: When you make something that's awful, keep it to yourself.

I apologize. I appeal to your better sense to change this on every KPT UI you find:


To enable manual popup, click the current filter's title, select "Panel Manual Popup" and it will change all the filters in the set.


The UI has many great features that people seem to overlook. For instance, numerical entry: