It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to th e home page.    
Latest game industry news.|Articles about game development.||||Searchable databases of game development companies, products, and web sites.|Forums for talking to other game developers.|Purchase stuff from Gamasutra, Game Developer magazine, the GDC, and more.
Search articles, jobs, buyers guide, and more.

By Peter Hajba
Gamasutra
[Author's Bio]
May 23, 2001

Introduction

Some Facts - What Does It Do?

Tiling Textures

Creating Overlay Patterns and Detail Textures

Printer Friendly Version
 
Discuss this Article

 


Features

The Power of the High Pass Filter

Some Facts about Waveforms

As every self-respecting sound engineer knows, an audio signal is a waveform which consists of multiple frequencies. These are often divided into Bass and Treble - low and high frequencies. The wavelength of the signal determines the frequency: low frequencies have long wavelengths, while high frequencies have short wavelengths.




FIGURE 3 (top to bottom). Low frequency waveform; high frequency waveform; a signal containing multiple frequencies.

Analogous to sound signals, images also consist of both low frequency and high frequency detail, and in this respect, act like waveforms: in pictures, large blurred details represent low frequencies, and small, sharp details represent high frequencies.

In audio world, without treble the signal sounds muffled, and without bass, it feels thin. Likewise, without high frequencies, that is, small details, images appear blurred. Without low frequencies, they seem flat.

FIGURE 4 (left to right). Low frequencies only; high frequencies only; multiple frequencies.

Manipulating the Frequencies

To manipulate signals, sound engineers often use tools called Filters - just like us Photoshoppers. The most common ones, the Low Pass and the High Pass filters remove certain frequencies from the signal, while the rest of the signal passes through; this is where the part pass in the name comes from.

In the sound engineering world, the most rudimentary filter is the Low Pass filter: it filters out the high (treble) frequencies and leaves the low (bass) frequencies intact. The equivalent of this effect in Photoshop is the Gaussian Blur: small details disappear, and large ones remain.

Technically, the High Pass filter is the opposite of Gaussian Blur: it removes large, blurred low frequency details, while small sharp high frequency details remain. The quickest way to demonstrate the filter's effect in Photoshop, is to simply create a new image, Render Clouds with black and white, then apply a High Pass to it. Try changing the radius of the filter and see how the large black and white areas vanish, while the small ones remain (at this point, ignore the fact the image also loses a lot of contrast). With very small radii, the clouds begin to resemble noise - and you may notice that at zero it becomes gray. After applying the filter at a radius above zero, do Auto Levels (Shift-Ctrl-L) to restore the original contrast of the picture, and see the difference.

FIGURE 5 (left to right). Clouds before High Pass; Clouds after High Pass and Auto Levels.

Why does the contrast drop so drastically that it must be restored afterwards? Well, because both High Pass and Low Pass (Gaussian Blur) remove parts of the original signal, using them reduces the contrast (or analogously, amplitude) of the image quite drastically - the sound gets quieter, and the histogrammatic pixel distribution of the picture is pushed towards the middle (gray). As in the previous example, this can be easily compensated by using the Brightness/Contrast or Levels tool to restore the crispness of the original image.

The histogrammatic shift towards middle is caused by a simple fact: for example if the original image is a lot darker than 50% gray, the signal inverse to it is naturally a lot brighter. This symmetrically centers the signal around center. In audio processing, this is a very handy way to remove DC offset from the signal. If the texture you're working on needs to be much darker or brighter than 50% gray, you need to manually adjust its brightness after filtering.

How Does It Do It?

Gaussian Blur and Low Pass filters are pretty basic: they reduce the sample rate of the original signal, and interpolate the results with weighed average. The case isn't quite as simple when you actually want to remove the low frequencies. Although the two filters have opposite effects, the High Pass filter is actually based on Low Pass - or Gaussian Blur. (In fact, the Unsharp Mask filter is also a part of the family, but that's not a part of this feature.)

The trick with High Pass is to take the signal, Low Pass it, invert it, and then mix it back to the original signal. The result is that the opposite low frequencies in the two signals cancel each other out, while the high frequencies, which are missing from the inverse signal, remain.

FIGURE 6. Diagram: opposite signals cancel each other out.


FIGURE 6b. An inverse signal without high frequencies cancels out the low frequencies, but leaves the high frequencies intact.

This is exactly what happens when you use the High Pass filter in Photoshop. To prove my point, you can try and do the same thing manually by using Gaussian Blur. The procedure goes as follows:

  • Create a duplicate layer of the texture you're working on and move it on top (if your texture has several layers, Select All, then Copy Merged, and paste it on top)
  • Invert the duplicate layer
  • Reduce the layer's opacity to 50% - this results in a gray image as the layers cancel each other completely
  • Select Filters/Blur/Gaussian Blur, activate the Preview, and tweak the radius slider.

As you can see, the result looks exactly the same as when previewing the High Pass filter. This exercise simply demonstrates that Gaussian Blur and High Pass belong to the same family.

In the following sections I am going to explain how to put this powerful little tool into good use.

________________________________________________________

Tiling Textures


join | contact us | advertise | write | my profile
news | features | contract work | jobs | resumes | buyers guide | discussions | store

Copyright © 2001 CMP Media LLC. All rights reserved.
privacy policy | terms of service