FEBRUARY 07, 2002
The Complete Guide to Creating Photoshop Filters
The Filter Factory tutorial series, parts 1 through 7
by David Nagel
Page 9 of 9

Part 1: Introduction to Basic Operations in Filter Factory
So what is this "Filter Factory" thing? Photoshop's Filter Factory provides you with a plugin interface for creating your own filters using formulas containing functions, operators and variables. Now, I know I've already scared the beejeepers out of half of you. "What do you mean by 'formulas?' 'Variables?' 'Operators?' Damn it, I'm a designer, not a mathematician. What's going on here?" Now don't you worry your pretty little artistic head about those big, bad words. Ol' Davey's here to protect you from them. I know you're a designer, and all you really want to do is create custom effects and be able to show off to your friends the fact that you can make your own Photoshop plugins. There's no programming at all; there's just a specific way you need to write what you want your filters to do. And I'm going to show you how.

We're going to start off with some basic Filter Factory functions and how they work. Over the course of the next several weeks, we'll get into it more, and I'll even show you how to create a custom interface for each one of the filters you create--again, no programming required.

Getting started
If you haven't already, make sure that you have Filter Factory installed in your Photoshop "Plug-Ins" folder. If it's not there, you'll find it somewhere on your Photoshop CD. Just drop it into your Photoshop "Plug-Ins" folder, and relaunch Photoshop. Once it's there, you'll find it under Filter > Synthetic > Filter Factory.

For the purposes of this tutorial, you should have an image open in Photoshop that contains transparency. And you should not work on a "Background" layer. If your image is just a Background layer, double-click it in the Layer palette to convert it into a layer.

The reason you want to do this is that Filter Factory provides you with options for modifying each channel in your image. If your image contains no transparency, then you will only have R, G and B channels available for modification. With transparency, you will also be able to write filters that mess around with an image's alpha channel (if you so desire).

What am I looking at?
Now that we have our image all ready to go, let's go ahead and open up FIlter Factory (Filter > Synthetic > Filter Factory). What you're faced with right away is a very daunting-looking interface, just the kind of thing a designer doesn't like to see when he or she is in the middle of compositing.



You know what the image in the interface is. That's your preview window. But what does the rest of it mean? You see those sliders labeled "Map 0," "Map 1," "Map 2" and "Map 3?" Those are simply value sliders that we'll be using in the filters that we create. I'll show you an example of how they work in a few minutes.



Next you see four data entry fields labeled R, G, B and A. I bet you can figure out what those mean. That's right! They stand for red, green, blue and alpha--the three color channels in your image, plus the transparency channel. Inside each one of those fields you see a small r, g, b and a. These are simply the default values for those fields. They just mean that the Red channel, for example, should stick with its current value, which is r. Makes sense, right? If R=r, then your image remains unchanged. If you modify the field to read R=r+100, then your image will become more red, as you have just told the red channel to adjust itself 100 points higher.



In fact, go ahead and do this right now. In the field labeled R, change the data input area to read r+100. You will see the change immediately in your little preview window. (After you see what it does, go ahead and change that field back to its default "r" setting.)



Finally, at the bottom, you see a bunch of buttons. "Load" just let's you load previously saved settings. "Save" lets you save your settings. "Make" lets you actually turn your settings into a self-contained Photoshop plugin. And the "Cancel" and "OK" buttons let you cancel or apply the effect to your image.



Those are all of the things you'll have to worry about for now.

Now, I mentioned that I would show you how the sliders work, so we'll just try something simple right now so that there's no confusion later on. There are eight sliders there. Each slider has its own name, these names being "control 0" through "control 7." In shorthand, that's ctl(0) through ctl(7). Just to see what these controls do, place "ctl(0)" in the A data entry field, as in the following picture.



Instantly you will see your picture vanish in the preview window. But now slide the first slider (called "ctl(0)") back and forth from 0 to 255, and you'll see the transparency change. See? Now the A channel takes on the value of whatever position the slider is at. It's the same thing for all the channels.

But there are tons of ways to interact with the sliders. Obviously, if the only thing you could do with this thing were to change the absolute values of your four channels, it would be pretty useless. So we'll kick things off by showing you how you can change the way the sliders affect your image.

A little arithmetic
To this point, we've just been looking at how the sliders control channels as simple numeric values. Nothing too troublesome. But all we've been able to do is to create solid colors. Hardly worth the effort of writing a filter, right? Right.

So now we're going to start adding a little complexity to the whole thing so that we can actually generate some useful effects.

How?

By writing formulas in the data entry fields.

Settle down, settle down. I know this sounds like it's not fun, but it's really easy. Suppose, for example, you want to use more than one slider in each channel, or you want the value of the slider in the green channel to affect the value of the red channel. No problem.

In Filter Factory, we can add, subtract, multiply and divide the values of the sliders. For example, instead of writing "ctl(0)" in the A channel, you can write "ctl(0)+ctl(1)" so that the value of the alpha channel is now the value of the first slider plus the second slider.



Why would you want to do this? Well, some of our effects might require you to use values higher than the 255 maximum available to any individual slider. With "ctl(0)+ctl(1)" you can go as low as zero (0+0) or as high as 510 (255+255). With multiplication, you can go even higher.

Another reason for this is that you might want to have the value of one channel affect the value of another channel. For example, if I use "ctl(1)+ctl(0)" in my red channel and just "ctl(1)" in my green channel, then I will change the value of my red channel at the same time that I change the value of my green channel. At the same time, my red channel maintains some independence because I can offset any changes made with "ctl(1)" by adding "ctl(0)" to it.

Go ahead and try this out, as in the illustration below. Adjust the first and second sliders to see what happens. (Remember, the first slider is ctl(0), and the second slider is ctl(1).)



In addition to adding, you can also subtract, multiply and divide slider values. The plus (+) and minus (-) symbols represent addition and subtraction. The asterisk (*) and slash (/) characters represent multiplication and division. In practice, these would look like the following:

Addition: ctl(0)+ctl(1)
Subtraction: ctl(0)-ctl(1)
Multiplication: ctl(0)*ctl(1)
Division: ctl(0)/ctl(1)

These four things (+, -, * and /) are called operators. There are no other operators that you will have to worry about. So we're all set to move on to the next phase.

Working with individual pixels
As you've probably guessed, adding and subtracting the values of color channels isn't our aim here. Our aim is to produce effects, and we do this in the Filter Factory by adding functions to the operators we learned above. Today we're going to deal with two of these functions. In future installments, we'll take this much further. But the two that I'm about to give you will allow you to create some pretty cool effects, provided you play around with them on your own and experiment with the operators we learned above.

For both of the functions we'll be learning about today, we are going to be affecting the positions of individual pixels in our image. Pixels in a Photoshop image have both absolute and relative values. In terms of absolute values, Photoshop uses Cartesian coordinate, otherwise known as x and y. Lowercase x represents the horizontal position of any given pixel. Lowercase y represents the vertical position of any given pixel.

Look at the little red dot in the image below.



This red dot is a single pixel that's 30 pixels over from the left edge (x) and 20 pixels down from the top edge (y) of the image. It's x,y position, therefore is expressed as 30,20.

We, however, are not going to be speaking to any one particular pixel. Rather, we want to affect pixels in general--all of them--but also affect them individually. Of course, we don't want to go in and manually write all of the coordinates for all of our pixels in a given image. Instead, we simply refer to all pixels "source" and their coordinates as x and y. The shorthand for "source" in the Filter Factory is "src" simply enough. So any given pixel is referred to as src(x,y). This simple statement accounts for every pixel in your image, regardless of coordinate.

Each pixel must also have a channel assigned to it in the Filter Factory. The channels for red, green, blue and alpha are referred to as 0, 1, 2 and 3, respectively. So now each pixel looks like this:

R: src(x,y,0)
G: src(x,y,1)
B: src(x,y,2)
A: src(x,y,3)

To get an idea of what I'm talking about, follow along with this exercise. It will be very simple.

First, create a new image that's 400 pixels x 400 pixels (with a transparent background). Fill in the background white, and then use the Pencil tool to create a red dot in the dead center of your image. Use a 45 pixel brush so that you'll be able to see what's going on.



Now open up Filter Factory and set all the sliders to 0. Enter the following into each one of the data entry fields.

R: src(x,y,0)
G: src(x,y,1)
B: src(x,y,2)
A: src(x,y,3)

Notice what happened? That's right, nothing. All we've done is told Filter Factory that all of the pixels should remain at their current positions. But now add "ctl(0)" to each of the x and y coordinates of your R, G and B channels, like this:

R: src(x+ctl(0),y+ctl(0),0)
G: src(x+ctl(0),y+ctl(0),1)
B: src(x+ctl(0),y+ctl(0),2)
A: src(x,y,3)

Now move the first slider around, and you should see the big red dot moving up and to the left. This is because we've told Filter Factory to move each channel of every pixel a number of pixels up and down equal to the current x,y position plus the first slider, otherwise known as "ctl(0)."



(One thing you might have noticed when playing around with the slider is that the preview in Filter Factory is not accurate. If we move the first slider to a value of 60 or more, the red dot seems to slide off the canvas. But, in fact, if we apply the filter, the red dot will still be somewhere on the canvas. This is just something you have to live with. An inaccurate preview is the price we pay for being able to make our own filters.)

Now, as you've probably guessed, you can change things up a bit for each individual channel by assigning a separate slider to to each color. So, instead of the above formula, let's try this one:

R: src(x+ctl(0),y+ctl(0),0)
G: src(x+ctl(1),y+ctl(1),1)
B: src(x+ctl(2),y+ctl(2),2)
A: src(x,y,3)

Now move around the first three sliders, and you'll see the individual channels of the red dot moving separately, as if they were separate dots, where only the overlap maintains its original red color. Of course, on an image that's composed of something other than just a red dot, the effect will look different. You can experiment with this on your own.

But what if you don't just want to move channels diagonally up and to the left? That's where your subtraction operator comes in. The expression "src(x-ctl(0),y-ctl(0),0)" moves the pixels down and to the right. And you can use any variation in between. Here you can also combine sliders to allow you to move pixels up and down and right and left. The expression "x+(ctl(0)-ctl(1)" will allow you to do this because you can wind up with either a positive or negative value, depending upon the values of the first and second sliders. It would look like this:

R: src(x+(ctl(0)-ctl(1)),y+(ctl(0)-ctl(1)),0)
G: src(x+(ctl(0)-ctl(1)),y+(ctl(0)-ctl(1)),1)
B: src(x+(ctl(0)-ctl(1)),y+(ctl(0)-ctl(1)),2)
A: src(x,y,3)

This will allow you to move the dot diagonally up or down, lef or right, depending on where you place the first and second sliders.



But what's the deal with all of those parentheses? This is simple. It's just part of the organization of the formulas we're using. You have to keep expressions together with opening and closing parentheses for each expression, as in 1+(2*3)=7. Without the parentheses, 1+2*3=6. Get it? Good.

REMEMBER: The basic structure of any "src" function is src(x,y,0) for the R channel, src(x,y,1) for the G channel, src(x,y,2) for the B channel or src(x,y,3) for the A channel. You can add any expressions you wish these this basic structure as long as everything appears in a way that is logical to Filter Factory. You accomplish this by keeping everything within parentheses, just as you would in an algebra formula. If you get an error in Filter Factory (indicated by a little exclamation point in a yellow triangle), chances are that you are missing parentheses somewhere.

Three final notes on this. First, you can use your image's r, g, b and a values as a part of your formulas. Every pixel in your image has a numeric value for r, g, b and a. This numeric value can then be used in your expressions simply by using the letter of the channel. For example, "src(x+r,y+r,0)" or "src(x+(r+g+b+a),y+(r+g+b+a),0)."

Second, you remember the number at the end of each one of our "src" expressions? "0" means red; "1" means green; "2" means blue; and "3" means alpha. You can actually move these around to give channels the characteristics of other channels. For example, if you place "src(x,y,0)" in the first three color channels (R, G and B), you'll wind up with a black and white image. Just something to keep in mind.

Third, to this point we've been using the lowercase x and y for our coordinates. But you can also use capital X and capital Y for different effects. Why different? Lowercase x and y represent the coordinates of your individual pixels. Capital X and Y represent the actual static edges of your image. Try substituting capital X and Y for lowercase x and y in some of the formulas you've already experimented with.

Variations on a theme
So now we know the basics of moving around source pixels. Obviously, the whole thing would be pretty pointless if we stopped here. What you need to understand is that moving pixels up, down, left and right can produce a whole variety of effects, depending upon the formulas that you use. Essentially, you can produce any effect you want and then vary that effect with the use of the sliders.

Just stick to the basic structure, and make sure you enclose your individual expressions within the proper opening and closing parentheses.

Here are some examples. Play around with these to create your own variations.

Dave's Funky Wet Duo
R: src(x-r,y-r,0)
G: src(x-r,y-r,1)
B: src(x-r,y-r,2)
A: src(x,y,3)

This produces a very cool, but static, effect based upon the red value of each of the pixels in your image.



Can you think of a way to add some variety to this effect? Here's one way:

Dave's Fresh Wet Duo
R: src(x+(r+(ctl(0)-ctl(1))),y+(r+(ctl(0)-ctl(1))),0)
G: src(x+(r+(ctl(0)-ctl(1))),y+(r+(ctl(0)-ctl(1))),0)
B: src(x+(r+(ctl(0)-ctl(1))),y+(r+(ctl(0)-ctl(1))),0)
A: src(x,y,3)



It's the same thing as the previous formula, but I've introduced our sliders into the equation, allowing us to customize the look of our new filter each time we use it. Keep in mid that you don't have to use r in this formula. You could also use g, b or a or any combination of these.

Dave's Distort-O-Matic
R: src(((x*100)/ctl(0)),y,0)
G: src(((x*100)/ctl(0)),y,1)
B: src(((x*100)/ctl(0)),y,2)
A: src(x,y,3)

This one will simply allow you to stretch an image. It also illustrates an important point about Filter Factory's math. Namely, Filter Factory outputs whole numbers. So, if you're going to do any division, you might want to throw in some multipliers as well. In the above example, I have multiplied x by 100 before dividing it by ctl(0). Try removing the "*100" portion of the formula to see what happens to the filter's capabilities.

Bring on da noise
So we've now discovered what the sliders do, what the channels do, what the operators do and what the "src" function does. Now we're going to move on to a new function that you can use with your addition, subtraction, multiplication and division operators. This one is used to generate noise effects and is used in conjunction with the "src" function. It's called the random function, and its shorthand is "rnd."

When you use the "rnd" function, you're asking the Filter Factory to generate a random number between two numbers. So the expression "rnd(1,10)" will generate a random number between 1 and 10. But what's the point?

When we're dealing with the "src" function and the coordinates of individual pixels, the "rnd" function will allow us to shift our pixels by a certain value plus a random number, giving us a noise effect.. Our sliders can determine how much noise appears in our image, and we can control the noise on a channel by channel basis. Here's how it looks:

R: src(x+(ctl(0)-rnd(1,35)),y,0)
G: src(x+(ctl(0)-rnd(1,35)),y,1)
B: src(x+(ctl(0)-rnd(1,35)),y,2)
A: src(x,y,3)

In the above formulas, we're telling Filter Factory to shift the pixels on the horizontal axis (x) by a number of pixels equal to the value of the first slider (ctl(0)) minus a random number between 1 and 35. This does not allow you to control the amount of noise in your image, but rather the position of the noise. To control the amount of noise, try this instead:

R: src(x+(rnd(ctl(0),ctl(1))),y+(rnd(ctl(0),ctl(1))),0)
G: src(x+(rnd(ctl(0),ctl(1))),y+(rnd(ctl(0),ctl(1))),1)
B: src(x+(rnd(ctl(0),ctl(1))),y+(rnd(ctl(0),ctl(1))),2)
A: src(x,y,3)

Here we're asking Filter Factory to move our pixels up and to the left by a random number between the value of ctl(0) and ctl(1). See how that happened? Instead of assigning a static value to our random number, as in "rnd(1,35)," we're letting our first two sliders determine the range of randomness. If the first slider is set to 1 and the second slider is set to 35, then, indeed, we get a random number between 1 and 35. But, if we move the second slider to 255, then we get a random number between 1 and 255 and, hence, more noise.

(I should note for the sticklers out there that, no, Filter Factory's "random" function isn't truly random, but it's random enough for our purposes here.)

Now, this noise isn't particularly pretty. You can doll it up considerably in a number of ways, most of which we'll get to in a future installment. (The concepts are a little too complex to introduce here.) For now, try using the values of r, g, b and a to generate some "less ugly" noise, as in the following example.

R: src(rnd(r+ctl(0),g+ctl(1)),rnd(g+ctl(1),r+ctl(0)),0)
G: src(rnd(r+ctl(0),g+ctl(1)),rnd(g+ctl(1),r+ctl(0)),1)
B: src(rnd(r+ctl(0),g+ctl(1)),rnd(g+ctl(1),r+ctl(0)),2)
A: src(x,y,3)



You can also achieve a nice effect by applying this formula only to the R channel and leaving the others alone.

R: src(rnd(r+ctl(0),g+ctl(1)),rnd(g+ctl(1),r+ctl(0)),0)
G: src(x,y,1)
B: src(x,y,2)
A: src(x,y,3)

Remember, "src(x,y,1)" is the same as "g." Similarly, "src(x,y,2)" is the same as "b." And "src(x,y,3)" is the same as "a."

You can also generate some interesting noise by randomly changing the values of the colors in the image rather than the positions of the pixels. Here we won't use the "src" function at all.

R: r+rnd(ctl(0),ctl(1))
G: g+rnd(ctl(0),ctl(1))
B: b+rnd(ctl(0),ctl(1)
A: a

Now the brightness of your image will be controlled by the values of the first and second slider, which the noise will be determined by the difference between the two (making sure to keep the second slider ("ctl(1)") at a higher value than the first slider ("ctl(0)").



Making your filter
You now have enough information to start experimenting on your own. We will get into some new functions next time around that will greatly enhance your Filter Factory experience. In the meantime, of course, you want to use Filter Factory to make your own plugins that you can use again in the future.

In order to create your filter, all you have to do is click the "Make" button in the Filter Factory interface after you have entered in your formulas as you like them.

Once you click this button, you will see an interface asking you to enter in some information about your plugin. The "Copyright" and "Author" fields are pretty self-explanatory. "Title" is the actual name of the filter as it will appear in Photoshop. "Category" is the menu item that Filter Factory will create so that each of the filters you make in a given "category" will appear in the same submenu in Photoshop's Filter menu.



Following this, you see your controls listed. Check any controls that you have used in your formula, and give them a name that describes what each attribute each slider will control. For now, keep the names short, or they'll get all clumped in with the slider in the interface.

As for the "maps," don't worry about them. Just leave them unchecked. They don't do anything.

When you're done naming your controls, click OK to save the filter. Save it into your Photoshop "Plug-Ins" folder. You can now quit and relaunch Photoshop and select your filter from the Filter menu. This will not call up the Filter Factory interface, but rather a new interface with the sliders you've created and a small, inaccurate preview window.

Part 2: Convolving Pixels

Now we're going to go a little deeper into what Filter Factory can do with convolve expressions.

If you remember your terminology, you'll recall that we left off with two functions and four operators. Operators are things like multiplication, division, addition and subtraction. Functions we covered included "src" for evaluating and manipulating pixel positions and "rnd" for creating noise effects. Convolve, expressed as "cnv," works almost the same way as these last two but produces radically different effects.

Convolution less convoluted
The first thing we're going to do here is a little function that can generate a whole lot of effects, from blurs to more psychedelic effects. This is a function that looks at a pixel then looks at its surrounding pixels and does something to the whole lot of them.

For the purpose of writing expressions involving the convolve functions, pixels are represented as follows:



In this diagram, you see nine pixels, each represented by a gray box. The way each one is represented in a convolve expression is like this: cnv(Top Left, Top Center, Top Right, Middle Left, Center, Middle Right, Bottom Left, Bottom Center, Bottom Right, Divisor)

That is to say, you assign a value for each pixel surrounding the center pixel, and the values are divided by the divisor.

So, for example, if you were to write the expression cnv(0,1,0,1,4,1,0,1,0,8), the Top Left pixel would be given the value 0; the Top Center pixel would have the value 1; the Top Right pixel would have the value 0; and so forth. The last number in the expression, in this case 8, is the divisor.

First let's just try a simple application of this principle by blurring the image. This is accomplished like by placing the above sample expression in each of the R, G and B channels in the Filter Factory: cnv(0,1,0,1,4,1,0,1,0,8). (Remember, you can copy and paste expressions from here to the Filter Factory, so you don't have to type things manually.)

That wasn't so tough. So how could we take this function a step further? Well, we don't want to put our sliders to waste, do we? So let's just substitute slider values for regular, old numbers. We only have eight sliders, though, so we'll have to repeat them for now. So try: cnv(ctl(0),ctl(1),ctl(2),ctl(3),ctl(3),ctl(3),ctl(4),ctl(5),ctl(6),ctl(7)) and play around with the sliders. Notice that the divisor (ctl(7)) has the most impact on the way the other sliders behave. This is because any values you select in the first six sliders are added together and divided by the last.

You might also want to switch positions of the sliders so that no individual channels share a slider, as in the example below.



Using the above expressions and tweaking around with the sliders, I was able to get the following result. (In case you can't guess, the top image is the original.)





Convolution more convoluted
So that's pretty fancy. But we can also bring in one of the functions we learned in Part 1 to make the thing do some even funkier stuff. (And I do mean funk-ay.) The function we used in Part 1 was "src" to tell Filter Factory what to do with the individual pixels and their positions in each channel. So now let's try wrapping this src function around our cnv function. That is to say, with a source function, we have src(x,y,channel). (Channel is represented as a number 0 through three for red, green, blue and alpha, respectively.) Instead of x and y, let's use the convolve expression. It will basically be cnv(expression,expression,channel). Try this one, remembering to separate each expression with a comma and remembering to put the correct channel number at the end:

R: src(cnv(ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6)), cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7)),0)

G: src(cnv(ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(6)), cnv(ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(7)),1)

B: src(cnv(ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(6)), cnv(ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(7)),2)

Here's what it might look like, depending upon your slider settings:









Again, ctl(6) and ctl(7), otherwise known as sliders 7 and 8, will have the most impact on the final result, since the other sliders are added up and divided by them. Tweak around with it for some psychedelic effects.

Part 3: Geometric Expressions

Now we'll take things a little bit further with the addition of new functions to our expressions.

You can throw on top of these expressions several more functions to make things behave a bit differently. By simply trying out sine, cosine and tangent (abbreviated sin, cos and tan in the Filter Factory), you can generate some wild effects. Again, we're simply going to build upon the expressions we created in the previous section. You can do this in one of several ways. First, you can simply enclose the whole expression inside the parentheses in the expression sin(). So the example for the R channel above would look like this:

sin(src(cnv(ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6)), cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7)),0))

Remember the extra parentheses at the beginning and end. Now, I don't particularly like the way this makes the image look. So the other way you can do this is to take your expression and insert sin (or cos or tan) functions throughout it. We could do it:

src(sin(cnv(ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6))), sin(cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7))),0)

or we could place the functions randomly throughout the expression, remembering to use parentheses properly, as in:

src(cnv(sin(ctl(0)),cos(ctl(0)),tan(ctl(0)),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6)), cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7)),0)



You can see examples of the effects below.


The original image




Three ways to apply a sin function to a convolve function.

One important thing to keep in mind is that the Filter Factory preview is not too terribly likely to represent the final look of your image. You might see some great banding and noise effects in the preview, only to come up with flat posterization when you apply the filter. There's really no way to say when it's going to be accurate, so you'll need a little extra patience to get just the right look.

Part 4: Conditional Statements and More
So we've learned several new functions, and now we're going to look at a few last ones, along with some new variables, and take a look at a whole new way to apply all of them. We can tell Filter Factory to evaluate individual pixels of an image and then do things to them if certain conditions exist. In other words, we're going to be using conditional statements.

Why? It's another way to add depth and variety to the filters you can create in the Filter Factory. It can be used for edge effects and all kinds of other fun stuff that might actually be useful rather than just funky, as has been the case with all of our previous experiments.

New functions and variables
But before we get to the conditional statements, I'd like to give you a few more functions and variables to work with. Seeing as this is really the last installment of our Filter Factory series (though not the last page of our compendium here), I'd like to cram in as much as possible to give you as many tools as I can for making your own filters.

None of these should prove too difficult. They're similar to functions and variables we've learned in the past, except that they produce different results.

What up, d?
The first one I want to talk about is d. Yes, d. What is this "d" I speak of? d is a variable that returns an angle, rather than a position, for a given channel of a given pixel. It's useful for creating flare and star effects, and it can be used just as any other variable. For example, you can use the src function with the d variable. But instead of blurring the pixels or shifting color channels in an absolute position, it places them at an angle.

For example, try doing a sin expression in each of the R, G and B channels, and include "d" in the formula:

R: sin(d*ctl(7))-d*ctl(0)/ctl(3)

G: sin(d*ctl(7))-d*ctl(1)/ctl(3)

B: sin(d*ctl(7))-d*ctl(2)/ctl(3)

Here, the first four sliders--ctl(0) through ctl(3)---control the amount of color in the spokes, while the last slider, otherwise known as ctl(7), controls the number of spokes. Setting the first four sliders down to zero should yield you simple black and white spokes, as in the following example.



I'm not going to dwell on d too long. Place it in your other formulas and see what you can come up with. It's a particularly interesting variable when coupled with convolve expressions and conditional statements, seen later in this section.

The m variable
A far more useful variable in most circumstances is m. This, to put it simply, creates rings on your images. To try it out, write down a simple src formula in each of the R, G and B channels:

R: src(x,y,0)

G: src(x,y,1)

B: src(x,y,2)

Now just go in and slowly replace each of the x and y variables with m. For example, for the R channel, input src(m,m,0). You'll quickly see what this can do with your image.





One of the problems with the m expression is that the preview window just doesn't know what to do with it in some cases. In the preview, you might be creating a beautiful radial gradation, but then, when you apply the filter, you wind up with a big circle covering your image. As with all of the problems with the Filter Factory previews, this is just one you'll have to tweak with for a while before it starts looking right.

More functions
By now you're pretty familiar with functions and how you can mix and match them inside expressions. Here's I'm going to provide you with several more and just give you a brief explanation of what they do. You can use these alone or inside convolve expressions oor any other way you see fit. These are just different ways to generate values that Filter Factory uses to create effects.

add(a,b,c): This adds a plus b, then compares the result with c and returns the smaller value. For example: add(ctl(0),ctl(1),ctl(2)). This would add the first two sliders, compare them with the third and then use the smaller of the two results. For another example, inside an expression, it would look like this: src(add(ctl(0),ctl(1),ctl(2)),add(ctl(3),ctl(4),ctl(5)),0). The first add value would become the new x coordinate; the second would become the new y coordinate; and the zero at the end, of course, just represents the red channel.

dif(a,b): The subtracts b from a and returns an absolute value. ery simple, this function can be used inside expressions just like the add function.

max(a,b): Picks the larger value of a or b.

min(a,b): picks the smaller value of a or b.

sqr(a): Returns the square root of a.

sub(a,b,c): This is the inverse of add(a,b,,c). It subtracts b from a and then compares it with c and returns the larger value.

Conditional statements: my funky chicken
How a conditional statement works in the Filter Factory, essentially, is that you tell Photoshop to evaluate the numeric value of each channel of a given pixel; if it's x value, then do y; if it's not x value, then do z. For example, we can say, "If the value of the red channel in a given pixel is greater than 120, then change it to 200; if not, change it to 80." Or something like that. It's actually easier to write it out the Filter Factory way:

r>120?200:80

g>120?200:80

b>120?200:80

See? The question "Is the red value greater than 120?" is expressed "r>120?" Then you just put in your "then" and "if not then" results. If it is, then change it to 200. If it isn't, change it to 80. This is simply expressed "200:80." Try this out just to see what happens.

Well, the problem is that this is just a one-trick effect. So, instead, let's use some controls to add a little flexibility. Instead of 120, 200 and 80, use ctl(0), ctl(1) and ctl(2). So you will have:

r>ctl(0)?ctl(1):ctl(2)

g>ctl(2)?ctl(3):ctl(4)

b>ctl(4)?ctl(5):ctl(6)

So, if the value of red is greater than the value of the first slider (ctl(0)), then change it to the value of the second slider(ctl(1)). Otherwise, change it to the third slider (ctl(2)). The kinds of effects you can get from this are pretty slick. Still, you do feel a bit confined by such a small formula, don't you?



No, of course not. You're the adventurous sort. You won't just settle for ctl(1). You want to try sin(ctl(1)). Well, go for it, tiger. Try this one out:

r>ctl(0)?sin(ctl(1)):sin(ctl(2))

g>ctl(2)?sin(ctl(3)):sin(ctl(4))

b>ctl(4)?sin(ctl(5)):sin(ctl(6))

It just gets more and more bizarre, doesn't it? Well, let's try adding in a little convolution to make things a little more crazy. If r is greater than ctl(0), then convolve it one way. If not, convolve it another. You can try any old way of convolving it you feel like trying. I'm going to try this one:

r>ctl(0)?cnv(ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6)) :cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7))

Or, even better yet, get the sin of the "else" convolution for effects with harder softer edges:

r>ctl(0)?cnv(ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(0),ctl(6)) :sin(cnv(ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(1),ctl(7)))

You should wind up with the ability to create something like the images below.

Now let's try adding in some of our new variables from this section--d and m. Try out this one:

R: r>ctl(0)?src(x-(d/ctl(0)),y-(d/ctl(1)),0):sin(r-d+ctl(3))

G: g>ctl(0)?src(cnv(ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(2),ctl(6)), cnv(ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(3),ctl(7)),1):sin(d*ctl(0))

B: b>ctl(7)?src(cnv(ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(4),ctl(6)), cnv(ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(5),ctl(7)),2):sin(d)*ctl(6)/cos(d)

As with the images below, this should yield you some very weird effects combining spokes and convolutions.





Now just try throwing in your m variable in various parts of these formulas, and you should start to see some interesting--maybe even useful--results.

But then again, maybe not. Let me know how it goes.

We've covered a lot here, and that about wraps it up for our Filter Factory series. The next two pages deal in depth with some specific applications of the Filter Factory for creating 3D effects. Page 8 covers a method for users to customize the interface of their filters. And the last page simply presents this entire piece on one giant page. (Watch for crashes on systems with low memory!)

Appendix 1: 3D Effects in the Filter Factory

Here's a tutorial whose main purpose will probably be of little use to most of you. Sound enticing? Well, even if it won't be of direct use to you, you can still learn something from it about Photoshop's Filter Factory.

We're going to use the Filter Factory plugin to create a 3D effect on an image. Now, before you get all excited, I'm not talking about the kind of 3D used in movies like Final Fantasy. To accomplish that kind of 3D, all you have to do is go out and buy a 3D program, work in it for about 72 million hours and then shoot yourself when all anybody can say about it is that the lip sync was off. No, what I'm talking about is oldee-tymee 3D, the kind where you have to wear special red and blue glasses to get the effect. (I told you this would be of little use to most of you.)

The basic function I'm referring to is a channel shift. To turn a 2D image into a 3D image, all you have to do is shift the red channel to the left. Well, that's not really all you need to do, but that's at the heart of it.

A bit about 3D
There's very little you need to know about the way 3D works. Basically, if you have glasses that have the red lens on the left side (as most do), then you want to shift the red channel to the left. With the other kind of glasses the opposite is true. The amount of red channel shift determines how near or far an object or layer appears to the aided eye. The more shift, the farther away it looks. The less shift, the nearer it looks. (No shift at all is about as near as you can get.)

One important consideration is just how eye-popping you want your 3D image to look. If you really care about the 3D, you should work on a grayscale image. If you really care about the image, you can leave it in color, but it just won't appear to pop as much. I'll show you how to do it both ways, along with examples.

(By the way, it would probably help if you had some 3D glasses for this tutorial. Make sure the red lens is on the left. If it's not, well, uh, turn the glasses around. If you don't have them, you can find them on the Web through a number of sources. Just do a search on any search engine for "3D glasses." I found mine at a local Barnes & Noble. They were included free in a children's book about dinosaurs. As an added bonus, the glasses themselves are shaped like a dinosaur, and they're made out of green and purple foam. Now, special glasses like these will cost you a little extra, but you can find the theatrical-quality glasses for about $0.50 each, or less in larger quantities.)

For my example, I'm going to take an image and create three separate layers. Each one will be a part of the scene that will be farther away than the next. Take a look at the image below.



Here you see two dancers and a wall in the background. My goal will be to make the wall look pretty far back, and then bring the dancers up close to the viewer, with the dancer on the right being in the absolute front.

How?

Very simple: varying degrees of red channel shift.

First you're going to want to mask off your subjects and put them into their separate layers. If, like me, you're using a single image and pulling your subjects off the background, you're going to wind up with some transparent (or white) areas in your background. You'll need to use some skill to fill those in, or else you're going to get ghost-like leftovers from the subjects you're pulling out. (Definitely do not leave the original subjects in the background, or the whole effect will be ruined.)

After you have all of your layers created, it's time to get into the Filter Factory. We'll begin with the formula for shifting the red channel and then apply it to each of our layers.

The concept is that we're going to take every red source pixel and move them to the left (in other words, along the x axis). Filter Factory is tailor-made for a simple operation like this. Here's how it works.

When you select Filter Factory (Filter > Synthetic > Filter Factory), you're presented with an interface with several confusing-looking elementsŪMaps 0 through 7 and some text fields labeled R, G, B and A. These look confusing, but they're not difficult. The "Maps" are actually sliders that assign values to your formulas, with values ranging from 0 to 255. The R, G, B and A fields represent your red, green, blue and alpha channels, respectively.

As I say, we're going to use these controls to move our red source pixels along the x axis (left). So, in the field labeled R, type in this formula:

src(x+ctl(0),y, 0)

and leave the other fields alone.



What in the bejeepers does this mean? "Src" means "source pixels." The "x+ctl(0)" means we're going to move our pixels along the x axis by a number of pixels equal to the value of the first slider. (There are eight sliders numbered 0 through 7.) The "y" by itself means that we're going to leave the y axis alone. And the "0" is simply a redundant (but necessary) way of telling Filter Factory we're applying this formula to the red channel. (Zero is just a number Filter Factory understands as meaning "red." I don't know why.)

Got it? Even if you don't, type in the formula as I gave it to you, and then try playing around with the top-most slider (the first slider in the "Map 1" zone).

See that? Kind of magical, isn't it? The further to the right you slide the slider, the more the red channel moves. So now you have your very own filter. Select "Make" to turn it into a filter that you can use over and over (saving it into your "Plug-Ins" folder). Choose "Save" to save the actual formula you created so that you can look at the formula in the future, if need be.

To use it right away, you'll need to quit Photoshop and relaunch it. You don't need to do this just yet, as Filter Factory will remember your settings for this session.

Part 2 of the actual tutorial: applying your filter
So now that you have your filter, all you need to do is apply to each of your layers separately. We'll begin with the background, which I want to look pretty far away. So I select Filter > Synthetic > Filter Factory and move the slider to about 20. This will cause a significant shift in my red channel, which, as we've learned, will make the background look farther away.



For my left dancer, I'm going to use a more moderate value, such as 5. My subject happens to be small and wearing red, so the image isn't going to look perfect no matter what value I assign. But 5 is pretty good.



Then, for my right dancer, I'm not going to apply any shift at all. If I wanted to be tricky, I might mask off her left hand separately and assign it and the dancer herself separate values, but I'm not going to do this.



Voila! Our 3D picture is done. Now just strap on those glasses and take a gander. If you move your head left to right, you'll actually see the background moving, while the foreground remains still.

Ooh.

The grayscale approach
I mentioned that grayscale images really pop better than color images. So, if you're more interested in the 3D effect than maintaining the color of your image, go ahead and convert your RGB image into a grayscale image. Then convert it back into an RBG image and follow the steps above. There's no difference in the process, just in the quality of the end result.



Alternate methods
There are other ways to do this. You could manually insert a second image into your first image's red channel. I don't like this method. It requires two photographs taken at slightly different angles. The other method is to use a filter that's already included in Photoshop (Filter > Other > Offset). To use it, select your red channel, and then apply the filter, using a negative value. (Such as -10 to move the red channel 10 pixels to the left).

The limitation of this is that it only works on background layers. Maybe there's a way to get it to work on regular layers, but I like the Filter Factory approach better anyway.

Note that the "+" sign is not the only operator you can use. You can also use, for varying effects, subtraction (-), division (/) and multiplication (*). You can even use sliders in conjunction with each other (src(x+(ctl(0)*ctl(1)),y,0). This will allow you to go beyond the 255 value limit, as the result of ctl(0)*clt(1) can be anywhere from 0*0 to 255*255.

Appendix 2: More on 3D Effects

In the last section, we examined ways to use Photoshop's Filter Factory to create a 3D effect. This time around, I thought we'd take a look at an alternate method for generating a 3D effect and get a little deeper into the Filter Factory. This one, once again, will show you how to create your own filter for achieving this 3D effect.

Now, before we move on, I must caution once again that this is not a tutorial on creating the kind of 3D seen in Monsters Inc. or Final Fantasy. This is the kind of 3D that you have to wear googly red and blue glasses to appreciate--you know, the kind that makes it look like one portion of the image is closer than another.

Last time, we broke apart portions of our image into its constituent parts and used the Filter Factory to shift the red channels of each layer a different amount. To refresh your memory, the 3D effect is achieved by shifting the red channel of an image to the left. The farther the shift, the farther away the image looks. By separating elements of an image onto separate layers, you can adjust each object's "distance" by varying the red shift on each layer.

What's the theory?
This time around, we're going to do it differently. We're going to use the background layer of an image and shift the red channel proportionally--sort of squish a portion of the image based upon the position of that portion of the image. Get it? No? Well, here's the theory.

If you shift the red channel of an image, it will look flat unless you have something to compare it with, right? 3D imagery is all about the differences in the amount of red channel shift, not the shift itself. This is the reason it worked in our previous experiment: Each layer had a unique shift in its red channel so that, compared with the other layers, it looked nearer or farther. But here we're just going to be affecting the red channel on a single layer, so we need to vary the red shift on our single layer.

Probably the most useful application for this would be a panoramic perspective shot of a wall or maybe a flying logo that trails off to the horizon. Why? What we're going to do is use Photoshop's Filter Factory and a special, magical formula to create more or less red channel shift based upon the current position of each individual pixel in our image. Sound complicated? It's not.

To begin with, choose an image that has some sort of perspective to it. For this particular technique, and image like the one below will work best. (Feel free to use this image for this experiment.) Any image will work though. If you don't have a perspective image, an image like a face can be used, with the result being that the face seems to move as the viewer's head moves. (I'll show you an example of this on the last page. It will freak you out.)



Once you have your image loaded up in Photoshop, you're ready to get working on your filter. Just work on the background layer. Or, if you want to preserve that layer, make a duplicate over it, and work on the duplicate. It really doesn't matter. But definitely have your History active, as you'll probably want to play with variations.

Open up the Filter Factory plugin in Photoshop (Filter > Synthetic > Filter Factory). What you will see there is a strange-looking interface with a bunch of data entry fields and some sliders, as well as a preview window. We're going to be working with one of those sliders (the first one) and one of the data entry fields (also the first one, labeled "R.")



The first field controls the red channel in our image. In our previous experiment, we used a simple formula to cause all of the pixels in the red channel to shift by an equal amount to the left. So we used a formula that looked like this:

src(x+ctl(0),y,0)

What does this mean? It means the source pixels (src) would be moved along the x axis (left/right) by a number of pixels equal to the value of the first slider (called "ctl(0)," or "control 0"). The "y" part of the formula just means that we want to leave the y axis alone. Otherwise, we could do something like y+ctl(1) or something like that. (A 3D effect requires that you move the red channel only left or right, not up and down, unless you plan to have your head sideways while looking at it.) The "0" is Filter Factory's reference number for the red channel. It's redundant, since we're entering our data in the red field, but it does have a purpose in more complex formulas than the ones we're doing today.

Coding the filter
This time around, we want to vary the shift in our red channel. There are lots of ways to do this. For today, we're going to use the x position of each pixel and divide it by the value of our first slider. The higher the x value of a given pixel, the farther it will shift.

Right?

Correct. Filter Factory measure x as the number of pixels away from the edge of the image. A pixel with a value of 100 is 100 pixels in from the side of the image. Our slider (ctl(0)) is an adjustable value that generates a range from 0 to 255. So if we slide the slider to 10, we will be dividing the current pixel value by 10. Pixels at position 100 will be moved over 10 pixels (100/10=10). Pixels at position 150 will be moved 15 pixels (150/10=15). Therefore, the higher the value of a pixel, the more it will move.

The code for this looks like this:

src((x/ctl(0)),y,0)

In other words, the x position (x) of any given pixel (src) will be divided by the value of the first slider (ctl(0)). When ctl(0) is set to 1, the image remains the same. Then it changes more and more as you adjust the slider. However, what you might notice when you use this is that adjusting the slider gives you only three of four usable configurations.

To be able to add more flexibility to the formula, we're going to multiply the x position by 100 and then divide by ctl(0). This gives us a much wider range of settings, which is important for this approach to creating a 3D image. The final formula looks like this:

src(((x*100)/ctl(0)),y,0)

That's x*100 (since the asterisk is the symbol for multiplication) divided by ctl(0). With this formula, the slider should be set to 100 for a neutral effect (since 100/100=1, and x/1=x) and then moved left or right to make the change. In this case, we want to move it left, as we want our red channel to shift left. You can just copy the formula above and paste it into your R field in the Filter Factory.



You want ot be careful not to slide the slider too much. A huge channel shift does not make for a very good 3D image. Keep it in the 95 to 99 range.




What's next?
Actually, you're done. Apply the filter, and look at the results through your 3D glasses.

If you'd like to save this filter for future use, Open up the Filter Factory again, where you'll see your settings just as you left them. Click the "Make" button. This will call up a new dialog box.



Enter in all of the personal information you want. The "Category" field is the name of the directory that will be created in the Photoshop Filter menu. The name of the filter is what will appear in the subdirectory. The only slider we've used for this effect is the first slider, so just click the checkbox labeled "Control 1." Save the filter into your Photoshop "Plug-Ins" directory. The next time you launch Photoshop, this filter will be available for you.

Note that Filter Factory filters only work on the platform they're created on. So, if you're on a Mac, but you want to create a Windows filter, you'll have to open up a Windows copy of Photoshop and create it all over again.

Finally, if you want to want to extend this formula to create a general distortion effect, simply copy and paste the formula in the R channel to all of the other channels. Then change the "0" in the formula to 1 and 2 for the green and blue channels, respectively.



But wait! There's more....

The freakout
In the beginning, I promised I'd freak you out with a disturbing face image with this effect applied. Here it is. When you look at it, sway your head left and right about six inches. (Scroll down the page to see a different perspective.



Above you see the effect on an image that has no perspective. Take a look at the image below, which uses a gray bar to demonstrate the actual effect on distance. You can easily apply any kind of image over the 3D image to bring out the 3D a little bit more (such as your company's logo).



Appendix 3: Customizing Your Filter Interface

We've now been through numerous tutorials on how to make your own effects filters for Adobe Photoshop. Aside from creating the actual effects, we also walked through the process of turning the effects into self-contained plugins that you could use at a later date or even distribute to your colleagues and friends, if for no other reason than you want to show off your new-found knowledge of how to make your own filters. It's a great accomplishment, to be sure, but so far the filters you've created look ... well ... ugly. Not the effects themselves, but the interface of your actual plugins. We'll close this series with a remedy to this problem.

Unlike these previous tutorials, which were platform-independent, this one is Mac-specific. It uses software and techniques available only on the Macintosh. If you would like to try this on another platform, I'm sure there's a way, but I don't know it.

First, some preliminary notes.

For this tutorial, we're going to be using a piece of software from Apple called ResEdit. If you don't currently have ResEdit, it's freely available on Apple's FTP site, as well as some of the download sites, such as http://www.download.com. Of course, you're also going to be using whatever design software you'd like to use to create the graphics for your interface. You will be able to use any size graphic you'd like, as long as it fits on your screen. All we're going to be doing is cutting and pasting these graphics into ResEdit..



For my example, I've come up with a colorful logo that says the name of my filter and provides copyright information. You'll see it in use at the end of this article. just keep in mind that whatever graphics you use will have to fit in with certain interface restrictions. For example, you have a preview window and several controllers to contend with, so you'd need graphics that won't get in the way of these.

Finally, make backup copies of your filters before you start with this process. We are going to be modifying the files with some--at times--unpredictable results.

All right. That's enough preliminary information. Let's get started.

Let's get started
Modifying your filter's interface is a fairly straightforward process. Locate the ResEdit application on your hard drive. Before you get started, you're going to want to increase ResEdit's memory partition. This is because we're going to be adding graphics to our files, and ResEdit needs more memory than the default allocation to handle this properly. To increase ResEdit's memory, do the following.

1. Click once on the application, and type Command-I. (Or just choose File > Get Info from the Finder menu.)
2. You'll see a window with a little pull-down menu labeled "General Information." Click on this, and choose "Memory" from the list.
3. In the field labeled "Preferred Size," enter the figure "10000" (without the quotes).
4. Close the info window.

Now you're ready to get started. Double click on ResEdit, and then click on the jack in the box splash screen to make it go away. You will then be presented with a dialog box asking you which file you want to open. Select your filter from the list.



When you open up your filter in ResEdit, you will be looking at a strange window with a bunch of weird, little icons. Don't worry. You don't have to know what they do. You just have to know which one to double click. In this case, you should double click the one labeled "DITL."


This is the collection of all the resources
in your Filter Factory filter. The one we're
concerned with is "DITL."

Now a new window pops up showing you a bunch of numbers listed in two columns, labeled "ID" and Size," respectively. Find the ID numbered 16004, and double click on it. (It should have a size of 532. This number will change by the time we're done.)


Select the resource that governs the filter's
appearance (16004).

Modifying the old interface
Now that you've opened that up, you're looking at your filter's interface, and things should be making sense to you about now. You see a gray box, which is your preview window. You see a bunch of sliders with some text labels, which are your controls. And you see an OK and Cancel button. This is the default look and feel for a Filter Factory filter. Obviously, we want to change this.


The basic Filter Factory filter interface, as seen in ResEdit.

The first change you'll want to make will be to stretch the interface. To accomplish this, just stretch the window by dragging on the little black square at the bottom right of the window. When you do this, the window will increase in size, but all of your interface elements will remain in place. You can move around these elements simply by clicking and dragging on them. (You can select all, move an individual item or drag a marquee around multiple items.)

The second thing I did was to increase the size of my preview window. This is easy. The preview window is that gray box on the left of the window. This is the area that will give the user a preview of your filter's effect as he or she adjusts your sliders. Just select it and drag it by its bottom right corner, just as you would resize any window. Make it any size you want. From my perspective, the bigger the better. You need to keep something in mind, though. This preview window is a bit quirky. Just because you make it huge doesn't mean your preview is going to be huge. It all depends on the size and shape of the image you're using the filter on at the time. Now just position the preview window where you want it on your interface.

Now that you've changed the size and position of your preview window, you probably also want to change to position of your sliders and text. Again, just select them and drag them where you want them to be.

While we're on the topic, you've probably noticed one of the problems with Filter Factory, namely that the text next to your sliders gets cut off sometimes. When we created our filters in Filter Factory, we assigned names to each one of our controls. Longer names simply get cut off in the default Filter Factory interface. To rectify this situation, just grab one of your text boxes and stretch it out.



You can also just double-click on the text box and enter a numeric value for the width of the text box. Use the number labeled "Right," as seen highlighted below, and enter in a larger value. This is actually the position of the right side of the text box, not its width, so the number will change if you reposition the text box later.


Altering the size of your text boxes can be done either by simply stretching the
text boxes or entering numeric values for more precision.

Finishing up
All right. So now you're happy with the position and size of your text and preview window. All that's left is to paste in your graphic. So go into your graphics program and copy it. Then paste it into ResEdit just by typing Command-V. Then position it wherever you want. You can paste in any number of graphics here, assuming ResEdit has been given enough memory to handle them. If not, you'll need to quit ResEdit and assign more memory to it, as described above. (You'll know if you haven't given it enough memory by the fact that your graphics are not being pasted in.)



If your new graphics cover up your functional interface elements, just move them into a better position. You can arrange these elements over your graphics, but the results can be iffy. To do so, just cut the elements using Command-X, and then paste them back in. When you paste them back in, they automatically move to the top of the layer order. Sometimes this works, and sometimes it doesn't. You won't know until you try out your filter. (This is one of the "unpredictable" results I mentioned before.) Whatever you do, don't cut all of the elements at once. This seems to confuse ResEdit and causes it to reassign functionality to each element. (For example, your preview window might become the "OK" button, even though it still looks like the preview window. I learned this the hard way.)

When you're all done laying out your interface, save your file and quit ResEdit. Now move your redesigned filter into the Photoshop "Plug-Ins" folder and test it out. (Of course, you'll need to quit and relaunch Photoshop to load your new filter.) Voila! You now have your very own customized filter. (If things didn't work out, you can either open the same file in ResEdit and make changes or start from scratch with a fresh duplicate of your filter.)

This concludes our massive, epoch-spanning series on the Photoshop Filter Factory. If you would like to continue using the Filter Factory and need more information, feel free to contact me at the e-mail address below. Or visit us in the Adobe Photoshop User Forum at http://www.wwug.com/forums/adobe_photoshop/index.htm.

Further Resources: I've tried to make this series as accessible as possible for you folks without any programming background. If you'd like to take the Filter Factory even further or just learn more about the guts of Photoshop, there is a highly technical instructional document that you can find at http://www.thepluginsite.com/knowhow/ffpg/ffpg.htm. I highly recommend it. For me, it's been a great source for experimentation, even if, at first, I didn't understand everything that the author was talking about.

Part 1: Introduction to Basic Operations in Filter Factory
Part 2: Convolving Pixels
Part 3: Geometric Expressions
Part 4: Conditional Statements
Appendix 1: 3D Effects in the Filter Factory
Appendix 2: More on 3D Effects
Appendix 3: Customizing Your Filter Interface
Complete: The Whole Thing on One Giant Page!

Further Resources: I've tried to make this series as accessible as possible for you folks without any programming background. If you'd like to take the Filter Factory even further or just learn more about the guts of Photoshop, there is a highly technical instructional document that you can find at http://www.thepluginsite.com/knowhow/ffpg/ffpg.htm. I highly recommend it. For me, it's been a great source for experimentation, even if, at first, I didn't understand everything that the author was talking about.


Dave Nagel is the producer of Creative Mac and Digital Media Designer; host of several World Wide User Groups, including Synthetik Studio Artist, Adobe Photoshop, Adobe InDesign, Adobe LiveMotion, Creative Mac and Digital Media Designer; and executive producer of the Digital Media Net family of publications. You can reach him at [email protected].


Prev 1 2 3 4 5 6 7 8 9
Related sites:Animation ArtistAV VideoCreative MacDigital Media DesignerDigital Post ProductionDigital ProducerDigital WebcastPresentation MasterThe WWUG
Related forums: