Paint Shop Pro


You are going to be creating your own textures as you travel through this book, and to do that you'll need a good tool for texture and image manipulation. Well, the good folks at JASC Software have graciously allowed us to include their great image processing tool, Paint Shop Pro, on the companion CD for you to use.

I've been using Paint Shop Pro for about 10 years, I think. In the early days, I only used it for converting file types, because that was about all it could do. Nowadays, though, it is a fully featured image processing and image generation tool, with scanner support, special effects and filters, image analysis statistics, and the whole nine yards.

First, you'll need to install Paint Shop Pro, if you haven't already run the Full Install from the CD.

Installing Paint Shop Pro

If you want to install only Paint Shop Pro, do the following:

  1. Browse to your CD in the \PSP folder.

  2. Locate the Setup.exe file and double-click it to run it.

  3. Click the Next button for the Welcome screen.

  4. Follow the various screens, and take the default options for each one, unless you know you have a specific reason to do otherwise.

Getting Started

To get this party rolling, we're going to just blast through and create a couple of textures that you can use later for whatever grabs your fancy. We'll cover just the tools and steps we need to get the job done. In a later section we'll cover the most common tools in more detail.

Creating a Texture

So, let's get down to brass tacks and create a texture from scratch. We'll create a wood texture using the built-in capabilities of Paint Shop Pro.

  1. Launch Paint Shop Pro and select File, New.

  2. A New Image dialog box opens up. Set the width and height dimensions to 128 pixels (see Figure 8.10) and click OK.

    click to expand
    Figure 8.10: Creating a new blank image.

  3. We now have a blank image to work with. Choose the menu item Effects, Texture Effects, Texture, and the Texture dialog box will appear, as in Figure 8.11.

    click to expand
    Figure 8.11: Texture dialog box with woodgrain texture.

  4. In the visual list at the lower part of the Texture dialog box, select Woodgrain. You'll have to scroll down through the list to the bottom.

  5. Click on the color box at center-right. You will get a Color dialog box, as shown in Figure 8.12.

    click to expand
    Figure 8.12: Color dialog box for woodgrain.

    Tip

    Most of the image processing tools in Paint Shop Pro have an Auto Proof button that looks like this:

    If you are using something newer than an old Pentium 100 computer, you should probably have this button pressed. It allows you to see the changes in your image as soon as you make them, rather than waiting until you click the OK button to close whichever dialog box you are using.

  6. Change the value in the R (for red) box to 139, in the G (for green) box to 87, and in the B (for blue) box to 15. The H (hue), S (saturation), and L (light) boxes will automatically change to match.

  7. Click OK to close the Color dialog box.

  8. Change the other settings in the Texture dialog box to match those in Table 8.1.

    Table 8.1: Texture Dialog Box Settings

    Attribute

    Value

    Size

    100

    Smoothness

    15

    Depth

    9

    Ambience

    0

    Shininess

    4

    Angle

    336

    Intensity

    50

    Elevation

    37

  9. Click OK to close the Texture dialog box.

  10. Now you should have a bona fide woodgrain texture, like the one shown in Figure 8.13, that you can use for things like walls, planks, ladders, the wooden stock on a weapon, barrels, and whatever else you can come up with.

    click to expand
    Figure 8.13: Woodgrain texture.

  11. With this texture, you can experiment with different image processing effects and touchup tools in Paint Shop Pro. Go ahead and give it a try.

Okay, that was so much fun, let's do another. This time we are going to tweak an image a bit searching for a specific look. The next texture will be a sort of rough-wall look that you might find on a painted cement block, or maybe a freshly poured sidewalk, or something like that. We'll call it the sidewalk texture, for convenience.

  1. If it isn't still open, launch Paint Shop Pro.

  2. Select File, New.

  3. Set the width and height dimensions to 128 pixels and click OK. (Take another look at Figure 8.10 if you need to refresh your memory.)

  4. Select the menu item Effects, Texture Effects, Texture, and the Texture dialog box will appear again, just like before, as depicted in Figure 8.11.

  5. This time we'll do something a bit different from the previous image. Locate the Texture frame at center-left. Click on it to open a visual menu of textures, and choose Concrete. You should get a texture like the one shown in the boxes in the dialog box in Figure 8.14.

    click to expand
    Figure 8.14: Texture dialog box with default preset.

  6. Click on the color box at center-right to get the Color dialog box again.

  7. Using Figure 8.15 as a guide, change the value in the R box to 218, in the G box to 181, and in the B box to 110.

    click to expand
    Figure 8.15: Color dialog box for sidewalk texture.

  8. Click OK to close the Color dialog box.

  9. Change the other settings in the Texture dialog box to match those in Table 8.1.

  10. Click OK to close the Texture dialog box. You should get a new texture like the one shown in Figure 8.16.

    click to expand
    Figure 8.16: Initial sidewalk texture.

    Now this texture is quite a bit darker than I want it to be. I'm looking for a gray with a hint of beige or tan color, so what we'll have to do is touch it up a bit. First, we want to brighten the highlights and, at the same time, darken the shadows a bit.

    To do this, we'll use the Highlight/ Midtone/Shadow tool.

  11. Select Adjust, Brightness and Contrast, Highlight/Midtone/Shadow. You'll get the Highlight/Midtone/Shadow dialog box shown in Figure 8.17. Change your settings to match those in the figure.

    click to expand
    Figure 8.17: Highlight/Midtone/Shadow dialog box.

    As you can see with Figure 8.18, the texture details now stand out in relief quite a bit more. This is goodness. However, the color is way too rich, or vibrant, for use as a sidewalk or wall texture, in my humble opinion.

    click to expand
    Figure 8.18: Enhanced highlight sidewalk texture.

    What we want to do now is tone down the richness of the color. We can do that by using the Hue/Saturation/Lightness tool. Now, we could have done this part using the Color tool when we created the color. And I tried! But it wasn't close enough, so using the Hue/Saturation/ Lightness tool allows us to tweak the color in the direction we want.

  12. Choose Adjust, Hue and Saturation, Hue/Saturation/Lightness to get the Hue/Saturation/Lightness dialog box, as shown in Figure 8.19.

    click to expand
    Figure 8.19: Hue/Saturation/Lightness dialog box.

  13. Set the Hue to 0, the Saturation to 70, and the Lightness to 0, and then click OK.

    This will take the edge off the richness of the color quite a bit. If you look at Figure 8.20 and compare it with Figure 8.18, you can see the difference. You can use the Undo/Redo feature of Paint Shop Pro to compare your own versions of these images. Select the Edit, Undo and the Edit, Redo menu items to switch back and forth between the before and after versions of your own creation.

    click to expand
    Figure 8.20: Desaturated sidewalk texture.

    Now that the color is where we want it, let's roughen it up a bit. The texture is a bit too smooth, sort of like taffy. A sidewalk usually looks grainier. To do this, we'll add noise.

  14. Choose Adjust, Add/Remove Noise, Add Noise. You'll get the Add Noise dialog box, as shown in Figure 8.21.

    click to expand
    Figure 8.21: Add Noise dialog box.

  15. Set the Noise value to 19 percent.

  16. Select the Gaussian button.

  17. Check the Monochrome box. Compare Figure 8.22 with Figure 8.20, and you'll see the difference—the newly added roughness to the surface.

click to expand
Figure 8.22: Final sidewalk texture.

You should now have two images open in your Paint Shop Pro window: the first one being the woodgrain texture, and the other being the sidewalk texture. In the next section you'll learn how to save those images for later use.

Working with Files

We want to get those images saved without any further ado, but first I want to show you something. You're going to launch the fps demo game that comes with the Torque Engine.

Launching the fps Demo Game

  1. Leave Paint Shop Pro running and task switch (Alt+Tab) to the Windows desktop.

  2. Using the Windows Explorer, browse into the C:\3DGPAi1 folder and then double-click on the fps demo shortcut.

  3. When the GarageGames/Torque splash screen appears, click on the Start Mission button.

  4. When the Mission dialog box appears, clear the Multiplayer check box.

  5. Click on Scorched Planet to highlight that line.

  6. Click on Launch Mission.

    When the game finishes loading you should get a view pretty well identical to the one in Figure 8.23, except it will be in color, of course. The floor will be bright orange, and the beams above you will be magenta. This odd coloring is deliberate—you are going to save your own textures in place of these two textures; this will make it easy for you to see if your changes have taken effect.

    click to expand
    Figure 8.23: Spawn view in the fps demo game.

  7. Resist the natural impulse to run around and blow things up. Instead, press the Escape key to exit the game (well, try to resist the natural impulse to run around and blow things up, anyway).

  8. Click Quit.

Saving Texture Files

Okay, now that you have the "before" view recorded in your mind, we'll finally get to saving those images. Switch back to Paint Shop Pro now, and follow this procedure to save your files:

  1. Click on the woodgrain image to bring it to the front (making it active).

  2. Select File, Save As, and the Save As dialog box will appear.

  3. In the Save As dialog box, make the type be JPG by scrolling through the Save As Type list and selecting JPG – JIFF Compliant.

  4. Browse your way to C:\3DGPAi1\fps\data\interiors\evil1.

  5. Name your file wood.jpg—the name must be exact.

  6. Click OK.

  7. You will get a dialog box that says "C:\3DGPAi1\fps\data\interiors\evil1\wood.jpg already exists. Do you want to replace it?" Click Yes.

Repeat steps 1 to 7 for the sidewalk image, using the name drk_cem.jpg.

Now, task switch back to the desktop and run the fps demo game again, just as you did before. When you spawn in the game you will now see the floor rendered with your new texture and the overhead beams rendered with the woodgrain texture you created. If either the floor or the beams look like they did in your "before" view, then you've probably made an error in the file name or perhaps saved them in the wrong folder. Double-check your work, and everything should turn out fine.

Congratulations! Now you are an artist.

Tip

The actual textures used for this platform object are saved in the evil1 folder as Original wood.jpg for the overhead beams and Original drk_cem.jpg for the floor. You can use the originals to replace your own textures if you want to see what they looked like.

PNG versus JPG

Paint Shop Pro supports many, many file types. If you select File, Save As, you'll get the Save As dialog box. If you click on the Save As Type combo box, you'll get a whopping great hockey sock full of available file types. There are two of particular interest to us: JPEG (Joint Photographic Experts Group) and PNG (Portable Network Graphics). In Windows, the JPEG format file extension is "JPG"; this has more common usage than "JPEG", so that's the term I will use.

When you save files in the JPG format, the images are compressed. The type of compression used is called a lossy compression. This means that the technique used to squeeze the image information into less space throws away some of the information. This is not necessarily a Bad Thing. The people who devised the JPG format were pretty clever and were able to specify rules that guide the software in what to keep, what to throw away, and how to modify the information. So although there is loss of information, the effect on the image is pretty negligible in most cases.

But there is an effect. Try this little experiment to see for yourself:

  1. Create a new document the same way you did earlier with the two textures.

  2. Make sure you have your foreground color set to black in the Materials palette (see Figure 8.24) and the background set to medium gray.

    click to expand
    Figure 8.24: Materials palette.

    Tip

    To change the foreground color, find the Materials palette at the right side, below the toolbars. There are two sets of overlapping color squares: a large and a small. Locate the upper-left large color square, which is called the Foreground and Stroke Properties box. Click this square and a Color dialog box will open. Select black and then close the dialog box by clicking OK.

    The rectangle on the lower right is the Background and Fill Properties. You change it in the same way.

    If you can't find the Materials palette, choose View, Palettes, Materials.

  3. Choose Adjust, Add/Remove Noise, Add Noise to get to the Add Noise dialog box.

  4. Select the Gaussian and Monochrome options.

  5. On the right-hand side of the dialog box, set the Noise percentage to 60 percent.

  6. Click OK, and the blank image will be filled with speckles and dots, similar to the image shown in Figure 8.25.

    click to expand
    Figure 8.25: Noise image.

  7. Next, select the Preset Shape Tool, the third last icon on the Tool palette.

  8. Draw a shape in the middle of your image—any shape will do. Figure 8.26 will give you an idea.

    click to expand
    Figure 8.26: Noise image with shape.

  9. Now select File, Save As, and the Save As dialog box will appear.

  10. In the Save As dialog box, make the type be JPG by scrolling through the Save As Type list and selecting JPG – JIFF Compliant.

  11. Give the file a name (I'll use "testing"), and save it wherever you can remember to find it again. Make sure you use a unique name so that you don't overwrite an existing file.

  12. Click OK.

  13. Now select File, Save As again, but this time select PNG format. This is an open standard file format used in many parts of the computer industry.

  14. Close both of your image windows.

  15. In the File menu, near the bottom is the Recent Files sub-menu, which contains a list of the names of recently used files. If you used the same file name that I did, you should see testing.png and testing.jpg in the list. Open both of them.

  16. Use the Zoom tool, which is available via the top icon in your Tool palette (see Figure 8.27). Click on the icon, then select the Zoom tool from visual menu—the toolbar icon will change to reflect the chosen tool. Next, click once in each image to zoom it to a larger magnification. Right-click to zoom out again.

    click to expand
    Figure 8.27: Tool palette, with tool names.

  17. Compare the two images. You'll notice odd pixel artifacts around the lines of your shape in the JPG version that don't exist in the PNG version. Those artifacts are a result of the compression.

See Figure 8.28 for a zoomed view of JPG image's artifacts in the upper portion of the figure, compared to the PNG image in the lower portion. The arrows in the JPG version point to some of the compression artifacts.

click to expand
Figure 8.28: Noise image.

On top of all that, if you repeatedly open and save JPG files, the distortion will get worse each time you do it, as data is lost in the compression each time. You'll see it as a sort of smearing of colors around edges, especially in areas of high color contrast. It's similar to the messiness resulting from photocopying photocopies of photocopies.

So, if JPG has these artifacts, why use it? Because with more complex images, JPG files are usually smaller than PNG files. Go ahead and try for yourself. Maybe use the one in your texture example from earlier, like the sidewalk texture. When I save the final texture as JPG, I get a file size of 6,493 bytes. As PNG, I get 19,882 bytes!

The smaller the texture files are, the more of them we can fit in a given amount of memory, and the more textures we can fit in memory, the richer the visual experience for our game.

Okay, so now you are wondering, why bother with the PNG file type, right? Well, there is a good reason for using PNG files, of course. The PNG format supports a concept called alpha channels, and we will need to use alpha channels for some of our game images. Not all of them, but a few. So the rule of thumb will be to use JPG for all images except when we need to specify an alpha channel—then we use PNG.

Finally, here is an important workflow tip. Save all of your original image creations in the Paint Shop Pro native format: PSPIMAGE. When you create and save your images in PSPIMAGE format, it's a lot like having the original source code for a program. In PSPIMAGE format you can edit any text you've created in vector mode, modify objects and curves that are in vector format, move them around, and so on. You can then save them in the game format you need, PNG or JPG, when you need to.

Bitmap versus Vector Images

Paint Shop Pro uses image graphics in two different and complementary ways: bitmap graphics and vector graphics formats.

Bitmap images are also called raster images. Raster, the older term, is the pattern of lines traced by rectilinear scanning in display systems. Although it is not exactly the same as a bitmap image, it's the term that Paint Shop Pro uses to describe such images. In this book I will use the term bitmap for such images, except when quoting Paint Shop Pro tools or commands that use the word raster. Just remember that they essentially mean the same thing in this context.

A bitmap image is composed of pixels laid out on a grid. Each pixel represents a color value, one each for red, green, and blue. The weighting of each of these values determines the color of each pixel. In most image processing tools, if you increase the magnification of a bitmap image, you can see these pixels. They look like squares on the screen. A bitmap object is a collection of these pixels. An object is stored as a group of pixels with the color information about each pixel color. Pixels can be blended to create soft edges and smooth transitions between objects. Photographic images are usually rendered as bitmap images because the pixel format matches well to the way that photographs are made.

You should note that an image in bitmap format is resolution-dependent. You specify the resolution and pixel dimensions when you create the image. If you later decide to increase its size, you enlarge each pixel, which lowers the image quality.

A vector image is composed of procedural and mathematical instructions for drawing the image. As you encountered in Chapter 3, a vector is basically a line that has definite magnitude and direction. Vector objects in Paint Shop Pro are defined in a similar fashion. Each object in a vector image is stored as a separate item with information about its relative position in the image, its starting and ending points, and width, color, and curve information. This makes the vector format useful for things like logos, text fonts, and line drawings.

An image in vector format does not depend on the resolution. It can be resized without losing detail because it is stored as a set of instructions, not as a collection of pixels. Each time you display an image, you re-create it.

Now a computer monitor uses pixels to display an image, and most printers convert pixels to ink dots. Because of this, vector images are converted into pixel format when displayed on the screen or printed. However, when you close the image files and save them, they are saved in the vector format.

We will be doing most of our work with bitmap images. However, you may find that certain vector techniques can be used to create some image components, like curves and text. We'll create them as vectors and then convert them when required. Some of the tools we'll use allow you to create in either format. Most of the time we'll do it in the bitmap format when we are using fancy effects tools.

Creating Alpha Channels

Okay, so you are now able to perform the most important texture imaging operations, creating one and saving it. The next most important operation is the creation of alpha channel transparent sections of an image. Remember the helicopter tail boom?

There are other uses for alpha transparency, of course. Bitmapped GUI buttons are candidates: You may want a button that does not have straight sides and square corners. You can create irregular button shapes using transparent sections of your button image.

Another use for a bitmap with alpha transparency would be overlays on the GUI, such as health bars, status displays, and weapons crosshairs.

Let's take a look at an example of a bitmap with transparency.

Launch the fps demo game the same way you did when testing your textures earlier, but this time click the About button instead. You'll see the credits for the creation of the Torque Engine, with the nice round GarageGames logo. Let's change it!

  1. In Paint Shop Pro select File, Open. Browse your way to C:\3DGPAi1\fps\client\ui and then find the file gglogo150.png and open it. We're going to work with this file. The original version has already been backed up as Original gglogo150.png for you, so don't worry about messing up the logo.

    Notice that there is no background color for this image; the areas outside the logo circle are filled with a gray-and-white checkerboard pattern. This pattern is the default Paint Shop Pro transparency pattern. The appearance of this pattern means that the alpha channel for the file has a value of 0 for each pixel of the image that coincides with the transparency pattern.

  2. Now choose the Freehand Selection tool. (Refer back to Figure 8.27—you want the fifth tool icon from the top.) Click on the little black triangle to the right, and choose the Freehand Selection tool from the icon menu.

  3. Use the Freehand Selection tool to select an irregular shape in the gglogo150 image, such as shown in part A of Figure 8.29.

    click to expand
    Figure 8.29: Creating an alpha channel selection.

  4. Delete the selected portion, leaving a cutout in the logo, as shown in part B of Figure 8.29.

  5. Now choose File, Save As to save your changes.

  6. Launch the fps demo game and click on the About button.

You should now see that the nice round GG logo has a "hole" in it shaped like the selection you made, with the dialog box's gray background color showing through. Part C of Figure 8.29 shows what it looks like. If the dialog box's background color had been blue, that's the color you would see. Or if it had been some bitmap image, then parts of the image would show through the logo. The areas in the logo that were covered by the transparency pattern (as dictated by the alpha channel) are not drawn at all. Of course, your shape is probably not identical to the cutout shape I made.

This process, when carried out with most programs other than Paint Shop Pro, or even with some older versions of PSP, is a fairly complex activity. With PSP 8 it's pretty well a nonevent!

Paint Shop Pro Features

I won't cover all of the features that Paint Shop Pro offers—and there are just a ton of them. What I'll do is cover those that I use the most when creating textures for games and present some of the most useful options and capabilities for those features.

Materials Palette

In Paint Shop Pro a material is a combination of color, gradient, pattern, and texture. The Materials palette provides a way to edit those attributes of either a foreground or background material.

The Materials palette is normally found docked on the right side, just below the toolbars.

On the Materials palette (see Figure 8.30), you will find the Colors tab and the Swatches tab.

click to expand
Figure 8.30: The Materials palette.

The Colors tab is used to select either the foreground or the background color for the material. Simply move your cursor over the Colors tab body, and the cursor will change to the eyedropper icon. Set the foreground color by left-clicking on a color, and set the background by right-clicking on a color.

Swatches are custom materials you have created and saved for later use.

To the right of the tabs are the Foreground Properties and Background Properties boxes. When you choose a color from the Colors tab, the chosen color appears in the appropriate properties box. The upper-left properties box is for the foreground and stroke properties, and the lower-right one is for the background and fill.

Below each properties box are three buttons. From left to right these are the Style button, the Texture button, and the Transparent button.

  • Style button. Indicates whether the color box is showing a color, gradient, or pattern.

  • Texture button. Indicates whether a texture will be applied to the color.

  • Transparent button. Indicates whether this color type (foreground or background) will be transparent.

To the right of the Foreground Properties and Background Properties boxes are the much smaller Foreground Color and Background Color boxes. Like the properties boxes, these reflect the current active colors. However, when you click in these boxes, you get a simple Color Selection dialog box and not the more complex Materials dialog box.

The All Tools check box allows you to indicate that the materials properties you have set apply globally to every drawing tool. When this option is not chosen, you will have to change the settings for each drawing tool you use.

If the Materials palette is not visible, choose View, Palettes, Materials to make it visible.

Layers

You can create four types of layers in Paint Shop Pro: raster layers, vector layers, mask layers, and adjustment layers. Raster layers are Paint Shop Pro's name for layers that contain pixel information (bitmaps). You can probably guess that vector layers contain instructions for drawing vector lines, shapes, and text. Vector layers can be added to images of any color depth, but not so with raster layers. Mask layers contain mask information, such as the alpha channel stuff that we did earlier in this chapter. Adjustment layers contain color correction information. You use them to change the appearance of the underlying layers.

A newly created Paint Shop Pro image consists of one raster layer, always called the background layer. This is like the canvas of a painting; every image must have at least one layer. Paint Shop Pro permits up to 100 layers per image, providing your computer has sufficient memory.

A Layer palette, the Layer Properties dialog box, and various commands in the Layers menu are available for working with layers. For each layer, the Layer palette displays its order in the layer stack and current properties. For a vector layer, a button for each vector object you draw is also displayed. The Layer Properties dialog box shows the settings for any individual layer. The Layers menu contains the general options for creating, managing, and merging layers. It also lists the layers in the image.

Tip

An image must be a grayscale image or a 24-bit color image to contain more than one bitmap layer or any adjustment layers. You might need to increase an image's color depth if you want to add these layers.

Creating Layers

To create a new layer, choose the Layers menu. You will see one menu item for each of the available layer types that can be created. If some aren't available, you need to increase the color palette for your image by choosing Colors, Increase Color depth. 16 million colors, if available to you, will give you access to all layer types.

The Layer Palette

The Layer palette provides quick access to many of the commands and options in the Layers menu and Layer Properties dialog box.

The Layer palette contains two panes (see Figure 8.31). Drag the vertical divider to change the size of each pane. The left pane of the Layer palette displays the names of layers and layer groups. The icon to the left of each name indicates the type of layer (background, raster, vector, mask, adjustment, group, or floating selection). When there are more layers than the palette can display, you can use the scroll bars on the right side to move the list of layers up or down.

click to expand
Figure 8.31: The Layer palette.

The right pane of the Layer palette displays options for the layer, including visibility, opacity, blend mode, link set, and lock transparency. All settings on this pane apply to raster, mask, vector, and adjustment layers, but only the Visibility toggle applies to vector objects.

The Layer palette toolbar includes buttons for command tasks, such as adding a new raster or vector layer.

If the palette is not visible, choose View, Palettes, Layers to make the Layer palette visible.

Layer Palette Buttons

Each layer in an image has a Layer button on the Layer palette where its name is displayed. To the left, an icon shows the layer type: raster, vector, mask, or adjustment. If you add an object to a vector layer, a plus sign ("+") appears next to its button and a Vector Object button appears underneath it. A Text Object button displays the text you typed. Line Object and Shape Object buttons display the types of lines and shapes, respectively. A Vector Object button is indicated by the "square and circle" icon to its left.

  • Click a Layer button to make its layer active, or current. The button is highlighted to indicate that it is active. When you click a Vector Object button, its text appears in bold.

  • A Layer button corresponding to a new layer appears on the palette and in the Layers menu list when you add a new layer. When you delete or merge a layer, its Layer button disappears.

  • Right-click on a Layer button to get a pop-up menu of operations that can be performed on the layer. This menu is similar to the Layers menu.

  • Right-click on a Vector Object button to get a pop-up menu of the editing operations available for the layer.

  • Hover the cursor over a Layer button to see a thumbnail image of that layer, or over a Vector Object button to see a thumbnail of the object.

  • Click the plus ("+") sign to the left of a Vector Layer button to expand the object list for a vector layer.

Layer Palette Controls

Several optional controls are available on the right side of the Layer palette. You will probably only need to use two of these controls: the Visibility toggle and the Opacity slider. The Visibility toggle merely indicates whether the selected layer or object should appear in the image. The Opacity slider indicates how much of the object or layer is visible. Opacity is the measure of how opaque an object is, so it is the opposite of transparency. A 100 percent opaque object or layer completely obscures any objects or layers that are behind it. A 50 percent opaque object would be like a ghost of an object, allowing a certain amount of the obscured objects or layers to show through.

Saving Layers

You can save images that contain raster, mask, and adjustment layers in either the PSPIMAGE format or Photoshop's PSD format. Both formats retain all the layer information for these two types of layers. However, images containing vector layers must be saved in the PSPIMAGE format to retain the vector information. When you save an image with vector layers in the PSD format, the vector layers are converted to bitmap layers.

Tool Options Palette

Every drawing tool has different adjustable settings that can be accessed via the Tool Options palette. The contents of this palette change according to which tool is being used.

Figure 8.32 shows the Tool Options palette in its default location, just below the toolbars. In the figure, the Paint Brush tool has been selected, so the Paint Brush options are being shown. The other parts of the window—the toolbars and menus—have been dimmed to make the Tool Options palette stand out.

click to expand
Figure 8.32: The Tool Options palette for the Paint Brush.

Paint Brush

The Paint Brush is one of the primary image creation tools. It is one of the brush tools that is associated with the seventh icon from the top of the Tool palette (refer back to Figure 8.27).

Using the Paint Brush

To "paint" in a freehand style, use the Paint Brush tool as follows:

  1. Click the image where you want the brush stroke to start.

  2. Drag the cursor while pressing the mouse button. (Press the right mouse button if you want to use the background color.)

  3. Release the mouse button to end the brush stroke.

If you want to create straight lines, do this:

  1. Click the image where you want the line to begin.

  2. Press and hold the Shift key.

  3. Click the image where you want to end the line (right-click to use the background color).

  4. You can continue adding line segments of either color by clicking the mouse button.

  5. Release the Shift key to end the line.

Paint Brush Tool Options

The Tool Options palette for the Paint Brush will appear in the upper toolbar when you select the Paint Brush. Figure 8.32 will help you locate the palette. The palette contains a number of optional attributes that you can alter; the most useful options are described in Table 8.2. These kinds of options are available for all tools on the Tool palette, although the specific options vary from tool to tool.

Table 8.2: Paint Brush Tool Options

Option

Description

Shape

Shape controls the shape of the brush tip: round, square, vertical, horizontal, right slash, and left slash. When the brush touches the image, it applies color in the selected shape. For example, if you click your image once with a square brush, the brush will apply a square-shaped area of color.

Size

Size is the width of the brush tip in pixels, from 1 to 255 pixels wide.

Opacity

Opacity controls how completely the color covers the image surface. Lowering the opacity is like diluting paint. At 100 percent opacity, the color covers everything; at 1 percent, the color is almost transparent.

Density

Density controls the amount of color the brush applies with each stroke. The density can be compared to the number of bristles in a real paintbrush—increasing or decreasing density adds or removes bristles. At 100 percent, the color covers the surface completely. As the density decreases, the amount of color applied with each stroke decreases. At 1 percent, only a few pixels of color appear.

Hardness

Hardness controls the sharpness of the brush edges. The harder the brush, the more defined the edges of color will be. At 100 percent, the stroke has sharply defined edges. As the hardness decreases, the brush edge softens.

Step

Step controls the spacing of the discrete pixels of color, or how frequently the brush tip touches the image during a stroke. It is a percentage of the diameter of the brush tip. At 100 percent, a size 30 brush tip touches the surface once every 30 pixels, and the brush shape is clearly defined; at 50 percent, the tip touches in the middle of the previous tip. As the step decreases, the brush tip touches the surface more frequently. Its outline becomes less noticeable, and the strokes appear smoother and denser.

Paint Shop Pro contains a selection of brushes with the preset tip shapes that approximate specific drawing tools: Paint Brush, Pen, Pencil, Marker, Crayon, Chalk, and Charcoal. If you use one of these brushes, all attributes except the size and step values are set automatically. You will find these presets at the left end of the Tool Options palette, under the label "Presets".

The numeric edit controls used in the palette provide a variety of ways to change the settings. You can type a number in the box, click the spinner controls, drag the meter bar, or press the pop-out button and drag the slider.

Table 8.3 describes options that are available only for the Paint Brush tool and not for the other brush tools.

Table 8.3: Paint Brush Special Brush Options

Option

Description

Continuous Stroke

Normally, the Paint Brush tool simulates the effect of repeated brush strokes. Each time you move the brush over the same area of the image (or layer), you apply more paint. When the Continuous Stroke check box is selected, the brush applies paint once, and repainting an area has no effect.

Wet Look

With this option selected, the Paint Brush tool simulates wet paint, with soft color inside and a darker ring near the edge. To see the effect, lower the Hardness setting to some value less than 100 percent.

Air Brush

The Air Brush is used to paint the same way you would with an airbrush or a spray can. It is one of the three brush tools that are associated with the seventh icon from the top of the Tool palette (refer back to Figure 8.27).

Tip

To confine the brush painting to a specific area, use the Selection tool or the Freehand Selection tool to make a selection before painting. Then the brushwork will only be applied within the selected area. This is a handy technique to avoid "overspray" with the Air Brush.

Freestyle Airbrush Painting

Freestyle airbrush painting is a technique where there are no restrictions on brush movement. To paint something in a freestyle manner:

  1. Click the image where you want the brush stroke to start.

  2. Drag the cursor while pressing one of the mouse buttons (press the right mouse button to use the background color).

  3. Release the mouse button to end the brush stroke.

Straight Airbrush Lines

We can restrict the movement of our airbrush in order to make consistent lines, by doing the following:

  1. Click the image where you want the line to begin.

  2. Press and hold the Shift key.

  3. Click the image where you want to end the line (press the right mouse button to use the background color).

  4. Keep adding line segments of either color by clicking with the left or right mouse button.

  5. Release the Shift key to end the line.

Clone Brush

The Clone Brush is the eighth tool from the top of the Tool palette. Use the Clone Brush to copy part of an image to another location. You can clone within an image, between bitmap layers, or between two grayscale or 24-bit color images. For example, if a photograph has a flaw against a multitoned or multicolored background, such as skin or cloth, you can use the Clone Brush to copy the background over the flaw.

When you use the Clone Brush, you work with two image areas: the source area, which is the area you copy from; and the destination (or target) area, which is the area you copy to. The destination can be within the same image or in another image of equal color depth.

Clone Brush Options

The Clone Brush shares many options with the other brushes. However, one option is unique to the Clone Brush and has a big effect on how it operates: the Aligned Mode option.

With this option enabled, the source area moves with the brush each time you release the mouse button. When you release and then reclick the mouse button, the brush resumes cloning the image relative to the distance from the source area.

With this option disabled, the source area does not move when you release the mouse button. Each time you release and then reclick the mouse button, the starting point for cloning returns to the source area.

There is also the Sample Merged option. With this option enabled, the brush will clone all visible data rather than just the data from the current layer. If not enabled, only the data on the current layer when the source point was defined is cloned.

Tip

When you clone from one image to another, make sure that the two images have the same color depth before you begin.

Cloning

To use the Clone Brush, follow this procedure:

  1. Position the cursor over the part of the image that you want to copy. Set the source area by right-clicking the source area once. Your computer beeps to indicate that you have selected the source area.

  2. To place the cloned image on a specific layer or in a selection, select that layer or area now. Paint Shop Pro only clones within the selection.

  3. Move the cursor to the area to which you want to start copying the image. This can be within the same image or in another image of the same color depth.

  4. Press and hold the left mouse button to make the crosshairs appear over the source area to indicate which pixel you are copying.

  5. Drag the mouse to clone from the source area to the destination area.

  6. Release the mouse button to end the brush stroke.

  7. To resume cloning, start over at step 5. Remember that the location of the source area depends on the clone mode.

Eraser

Use the Eraser to replace colors in an image with the background color or with a transparency. When you drag the Eraser across a bitmap layer, all the pixels in its path become transparent. When used on a background, the Eraser produces a different effect. It acts like a paintbrush, replacing the existing color with the current foreground or background color.

The Eraser retains the information it has removed from a layer. To restore the erased image, you can right-click and drag the Eraser over the transparent areas.

To use the Eraser:

  1. Activate the Eraser by clicking its button in the Tool palette. (The Eraser is in the seventh slot from the bottom. Refer back to Figure 8.27.)

  2. Use the Tool Options palette to configure the Eraser tip for your needs.

  3. Drag the cursor across a layer to erase the color.

Selecting

There are several ways to select things in Paint Shop Pro. When working with bitmap images on raster layers, you select pixels with one of two tools, Selection or Freehand. When working with vector layers, you select objects with the Vector Object Selection tool.

Selection Tool

Use the Selection tool to create a selection in a specific preset shape. The Selection tool is located in the fifth slot from the top of the Tool palette (refer back to Figure 8.27). As with other tools, you have a range of tool options to use (see Table 8.4).

Table 8.4: Selection Tool Options

Option

Description

Selection

Type Choose one of the selection shapes from this drop-down box. Your choices are rectangle, square, rectangle or square with rounded corners, ellipse, circle, triangle, pentagon, hexagon, octagon, one of two star shapes, and one of three arrow shapes.

Mode temporarily

Normally you would use the Selection tool in Replace mode, where each time you use the tool, you create a new and different selection. You can use Add mode if you want each selection you make to be added to the previous selection. Remove mode removes the area of each selection from a previous selection. You will find, however, that it is probably best to just use Replace mode and press the Shift key to invoke Add mode or the Control key to temporarily invoke Remove mode.

Feathering

Feathering controls the sharpness of a selection's edges. By fading a set width (in pixels) along the edges, it produces a smooth transition between a selection and the surrounding area. The feathering value is the width of the transition area in pixels. A higher feathering value creates softer edges by feathering more pixels. Feathering is useful when pasting a selection. The fading helps the selection blend into the background.

Anti-alias

Anti-aliasing is similar to feathering, but more precise. It produces a smooth-edged selection by partially filling in pixels along the edge, making them semitransparent. If anti-aliasing is not applied, the edges of a selection can appear jagged. Anti-aliasing is useful when combining images and when working with text.

To make a selection:

  1. Click the Selection button on the Tool palette.

  2. Place the cursor on the image.

    Tip

    To create a rectangular, square, or rounded rectangular or square selection, place the cursor at a corner of the area you want to select.

    To create a circular or elliptical selection, place the cursor at the center of the area you want to select.

    To create a selection using the other shapes, place the cursor at a point that would form the corner of an imaginary rectangle enclosing the shape.

  3. Click and drag the mouse until the selection is the size you want. As the cursor moves, a line appears to indicate the border of the selection.

  4. Release the mouse button. The selection border becomes a marquee.

Freehand Selection Tool

The Freehand Selection tool shares the same slot in the Tool palette as the Selection tool. It makes selections with three types of borders:

  • Irregularly shaped borders

  • Point-to-point straight borders

  • Borders between areas of contrasting colors or amount of light

You can change the Freehand Selection tool's selection shape from its Tool Options dialog box by choosing one of the three selection shapes from this drop-down box. This works exactly the same as with the Selection tool.

The Freehand Selection tool has the same options as the Selection tool, with one addition: Smoothing. This option smoothes sharp corners and jagged lines. The higher the value, the more smoothing is done.

Use the Freehand Selection tool to draw the outline of the selection as follows:

  1. Click the Freehand Selection icon on the Tool palette.

  2. On the Tool Options palette, set the needed options.

  3. Move the cursor over the image.

  4. Click the image at a point that you want to become the border of the selection.

  5. Drag the cursor to create an outline of the area you want to select. Be careful here—don't release the mouse button while creating your selection, or you may end up selecting stuff you don't want.

  6. If you release the mouse button, start again, add to the selection using the Shift key, or remove part of the selection using the Ctrl key.

  7. When the line encloses the selection, release the mouse button. The line becomes a marquee indicating the border of the selection.

Masks

A mask is a grayscale image that you apply to a layer. You can use it to hide and display parts of the layer, to fade between layers, and to create special effects with precision. Masks can be created from selections, alpha channels, and images.

A mask can cover a layer completely or with varying levels of opacity. The gray value of the mask determines how much it covers. Where it is black, it completely masks the layer; where it is white, it leaves the layer unmasked; where it is gray, it produces a translucent effect.

All masks are created and edited in a grayscale bitmap mode. Therefore, all tools and image processing features that work on grayscale images work on masks. The tools that can be used in either vector or bitmap mode (Drawing, Preset Shapes, and Text) work only in their bitmap modes when editing masks.

A mask works the same way with a vector layer as it does with a bitmap layer. It can be linked to a layer, which moves it with the layer. If a mask is not linked to the layer, moving the layer's content will not affect the position of the mask.

Because a mask is grayscale, you can save it with the image in an alpha channel or as a separate image on a hard disk. The texture for the helicopter canopy in Figure 8.7 was created as a grayscale mask saved in an alpha channel! Also, you can load a selection as a mask and a mask as a selection from an alpha channel.

Remember that you must choose the mask layer you are editing by selecting it on the Layer palette before painting so that you edit the mask, not the image. When you are editing the mask, the colors available to you become those of a grayscale image. When you click a foreground or background color box, the grayscale palette appears. When you switch to a nonmask layer, the active color boxes return to their previous colors.

Tip

Any painting tool or effect that can be applied to a grayscale image can be applied to a mask.

When you edit a mask, you change either the areas or the level of masking. For example, painting over an object to mask it changes the area, while making a gradient fill edits the degree of masking. A gradient fill is where we fill a shape with colors that gradually fade from one color to another. Usually we use a grayscale gradient when making masks. For example, we might use a gradient that transitions from dark gray to white. The dark gray masks more than the lighter grays. As the gradient approaches white, there is less masking effect.

Creating a New Mask Layer

To create a new Mask Layer:

  1. On the Layer palette, click the layer for which you want to create a mask.

  2. Choose Layers, New Mask Layer and then choose the type of mask:

    • Show All. This type shows all underlying pixels. All pixels of the mask are white. Paint the mask with grays or black to hide portions of the underlying layers.

    • Hide All. This type hides all underlying pixels. All pixels of the mask are black. Paint the mask with white or grays to show portions of the underlying layers.

    The mask layer and the selected layer are added to a new layer group. The mask layer applies to the selected layer only.

  3. Use the painting tools to alter the masked area.

  4. To view the mask on the image, click the Mask Overlay toggle on the Layer palette, at the far right of the layer properties palette for the mask layer you created.

Tip

To apply a mask to all underlying layers, drag it from the layer group to the main level of the Layer palette.

Creating a Mask from a Selection

To create a mask from a selection:

  1. Use the Selection, Freehand Selection, or Magic Wand tool to make a selection on a raster or vector layer in the image.

  2. Do one of the following:

    • Mask the selected area. To do so, choose Layers, New Mask Layer, Hide Selection.

    • Mask the unselected area. To do so, choose Layers, New Mask Layer, Show Selection.

    The mask layer and the selected layer are added to a new layer group. The mask layer applies to the selected layer only.

  3. Use the painting tools to alter the masked area if needed.

  4. To view the mask on the image, click the Mask Overlay toggle on the Layer palette.

Creating a Mask from an Image

To create a mask from an image:

  1. Open the image that you want to use for the mask.

  2. Select the image in which you want to create the mask layer.

  3. On the Layer palette, click the layer you want to mask.

  4. Choose Layers, New Mask Layer, From Image to open the Add Mask From Image dialog box.

  5. In the Source window drop-down list, select the image to use for the mask.

  6. In the Create Mask From Group box, select one of the following:

    • Source luminance. The luminance value of the pixel color determines the degree of masking. Lighter colors produce less masking, darker colors produce more masking, and transparent areas completely mask the layer.

    • Any nonzero value. Transparent areas completely mask the layer. There is no gradation to the masking. Pixels with data (opacity of 1 to 255) become white pixels in the mask, and transparent pixels become black in the mask.

    • Source opacity. The opacity of the image determines the degree of masking. Fully opaque pixels produce no masking, partially transparent pixels create more masking, and transparent pixels produce full masking.

  7. To reverse the transparency of the mask data, select the Invert Mask Data check box. Black pixels become white, white pixels become black, and grays are assigned their mirror value.

  8. Click OK.

    The mask layer and the selected layer are added to a new layer group. The mask layer applies to the selected layer only.

  9. To view the mask on the image, click the Mask Overlay toggle on the Layer palette.

Scaling Images

You may need to scale your image, making it larger or smaller. To do this, use the Resize feature, as follows:

  1. Choose Image, Resize.

  2. Select a method for resizing the image. The Resize dialog box presents you with two sizing method options:

    • Pixel Dimensions. Select a new size by choosing a new measurement in pixels or one based on a percentage increase or decrease from the original.

    • Actual/Print Size. Select a new size by changing the resolution or the page dimensions. Note that the two are linked.

  3. Enter the new measurements in the Width and Height boxes of the Pixel Dimension panel. In the Actual/Print Size panel, you can also change the resolution.

  4. In the Resample Using box, select the type of resizing for Paint Shop Pro to apply. There are five choices:

    • Smart Size. Paint Shop Pro chooses the best algorithm based on the current image characteristics.

    • Bicubic Resample. Paint Shop Pro uses a process called interpolation to minimize the raggedness normally associated with expanding an image. As applied here, interpolation smoothes out rough spots by estimating how the "missing" pixels should appear and then filling them with the appropriate color. It produces better results than the Pixel Resize method with photorealistic images and with images that are irregular or complex. Use Bicubic Resample when enlarging an image.

    • Bilinear Resample. Paint Shop Pro reduces the size of an image by applying a method similar to the Bicubic Resample. Use it when reducing photorealistic images and images that are irregular or complex.

    • Pixel Resize. Paint Shop Pro duplicates or removes pixels as necessary to achieve the selected width and height of an image. It produces better results than the resampling methods when used with hard-edged images.

    • Weighted Average. Paint Shop Pro uses a weighted-average color value of neighboring pixels to determine how newly created pixels will appear. Use this type when reducing photorealistic, irregular, or complex images.

  5. In an image with more than one layer, select the Resize All Layers check box to resize the entire image. Leave the box unchecked to resize only the active layer.

  6. To change the proportions of the image, select the Maintain Aspect Ratio of check box and type a new ratio for the image width. Aspect ratio is the relationship of the image's width to height. By default, the Aspect Ratio box displays the image's current aspect ratio.

  7. Click OK to close the dialog box and apply the changes.

Tip

After resizing, many images can be improved by using the Sharpen or Soften filters.

Bilinear and Bicubic resampling are available only for grayscale images and 24-bit images. To resample an image with a lower color depth, do the following:

  1. Increase the image's color depth.

  2. Resize the image.

  3. Reduce the image's color depth to the original depth.

Rotating

Use this feature to rotate a selection, a layer, or an image of any color depth.

To rotate an image, a layer, or a selection:

  1. Choose Image, Rotate, Free Rotate.

  2. Select the direction of rotation by clicking the Direction's option button or its text. Right is clockwise, and left is counterclockwise.

  3. Set the degrees of rotation in quarter-circle increments (90-, 180-, or 270-degree option) or rotate by any other amount by typing the value in the Free box.

  4. To rotate every layer in a multilayer image, select the All Layers check box. Clear the check box to rotate only the current layer. When this check box is selected or when the image consists of a single background layer, the canvas size changes to accommodate the rotated image.

  5. Click OK to close the dialog box and rotate the image.

Image Sizes

Use the Change Canvas Size dialog box to change the dimensions of the image. Because the current background color is used for pixels added to the background layer of an image, select a background color before opening the dialog box.

Changing the canvas size changes the size of the background, without changing the size of the image or any layers that may be in the image.

To change the image resolution, use the Resize dialog box, not the Canvas Size dialog box.

To change the size of the image canvas:

  1. Choose Image, Canvas Size.

  2. In the Dimensions panel, enter a new size (in pixels) for the image in the New Width and New Height boxes. You can type a number or use the spin controls. The current width and height are displayed for your reference.

  3. Use the Arrow buttons in the dialog box to indicate how you want the image to be placed in the newly dimensioned canvas.

  4. Use the edit boxes to enter precision placement information that will supersede the Arrow buttons, if needed.

  5. After positioning the image, click OK to close the dialog box and apply the changes.

Text

There will be times when we want our game textures and images to contain text. Now we could use the paintbrush and try to write out our text in a freehand fashion. However, there just so happens to be a very handy Text tool available with lots of capabilities.

Looking back to Figure 8.27, you'll find that the Text tool is the fourth one from the bottom of the Tool palette.

Go ahead and create a new blank image, then select the Text tool, and click in the center of your image. You'll get the Text Entry dialog box.

Using Figure 8.33 as your guide, you'll note that the first and most obvious feature is the Text Edit box. You can type many lines of text in here; there is a limit, but it is high. I have been able to enter 32 lines of 128 characters each with no penalty other than a little slowdown in response time.

click to expand
Figure 8.33: The Text Entry dialog box.

Let's create some text so that we can look more closely at the available options.

  1. In the Font section of the Tool Options palette, you can scroll through the Name, Stroke Width, and Size lists and click to make your selection.

  2. The Create As section is where you choose the creation mode for the text. You can select one of three modes:

    • Vector. A vector object on a vector layer.

    • Selection. An empty selection on the current layer.

    • Floating. A selection floating above the current layer.

    You should usually create your text as vector type. This allows you to easily edit and manipulate the text at any time. You can collapse the vector text into your bitmap image when you are happy with using the Layers, Merge, Merge All (Flatten) menu item.

  3. By selecting the Anti-alias check box, you can soften the jagged edges that can appear on bitmap text; this feature partially fills in pixels in the jaggy spots. You can only do this with grayscale and 24-bit color images, however. (You should create your textures as 24-bit color images unless you have a specific reason to do otherwise, anyway.)

  4. To select a color for the text, use the Materials palette.

  5. Add emphasis effects to the text by using the Font Style options. When you choose an effect, it is applied to the next character you type. Change the effects of specific characters by highlighting them and then clicking the effects buttons. You can select from four style effects: Bold, Italic, Underline, and Strikeout.

  6. The Alignment buttons are to the left of the Font Style buttons. These buttons set how the ends of multiple lines of text line up with each other: left, center, or right paragraph alignment. These settings affect the entire text in a paragraph and can't be changed for individual lines. Different paragraphs can have different alignments.

  7. In the Text Settings section at the far right end of the Tool Options palette, set specific leading (space between lines) and kerning (space between letters) by clearing the Auto Kern check box and typing values in the Leading and Kerning edit boxes.

    If you cannot see the Text Settings section, you will see a small black triangle at the right end. Click on this triangle to make the Tool Options palette shift over, revealing the tools that couldn't fit in your window on the right-hand side.

  8. In the text box, type the text you want to add to the image. Click the background (away from the text) to remove the highlighting and view the text. Note that the text does not display kerning and leading changes you have made.

  9. Click OK to close the dialog box; this places the text in the image at the location where you had clicked with the Text tool.

There you go. You should now have your text sitting in your image, centered on the spot where you clicked the Text tool, highlighted with a dashed-line box with the sizing handles on the corners.




3D Game Programming All in One
3D Game Programming All in One (Course Technology PTR Game Development Series)
ISBN: 159200136X
EAN: 2147483647
Year: 2006
Pages: 197

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net