1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu 3D Game Programming All in One- P14 doc

30 287 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 30
Dung lượng 854,78 KB

Nội dung

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 photo- graph 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 but- ton. 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. Paint Shop Pro 297 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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 trans- parency. 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. Chapter 8 ■ Introduction to Textures298 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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). 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 cor- ner of an imaginary rectangle enclosing the shape. Paint Shop Pro 299 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 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 temporarily 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. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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 dia- log 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. Chapter 8 ■ Introduction to Textures300 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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, mov- ing 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 sep- arate image on a hard disk. The texture for the helicopter canopy in Figure 8.7 was creat- ed 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 edit- ing 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. Paint Shop Pro 301 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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 pro- duce more masking, and transparent areas completely mask the layer. Chapter 8 ■ Introduction to Textures302 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ■ 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 pix- els 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 Dimen- sion 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 min- imize 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 photoreal- istic images and with images that are irregular or complex. Use Bicubic Resample when enlarging an image. Paint Shop Pro 303 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. ■ Bilinear Resample. Paint Shop Pro reduces the size of an image by applying a method similar to the Bicubic Resample. Use it when reducing photorealis- tic 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 cur- rent 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 Chapter 8 ■ Introduction to Textures304 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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 bot- tom 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 slow- down in response time. Paint Shop Pro 305 Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 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: ■ Ve ct o r. 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 (Flat- ten) 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 cre- ate your textures as 24-bit color images unless you have a specific reason to do oth- erwise, 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 spe- cific 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. Chapter 8 ■ Introduction to Textures306 Figure 8.33 The Text Entry dialog box. Team LRN Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. [...]... textures—Paint Shop Pro As you have seen, Paint Shop Pro has a very complete feature set In the following chapter, we will expand our understanding of using textures in game development by learning how to skin objects, such as player models and vehicles Team LRN 307 This page intentionally left blank Team LRN chapter 9 Skins S kins are special textures used in games The quality that separates skins from... going to have vehicles in their games, and the Torque Engine does quite a nice job of supporting vehicles We'll be making our own vehicles later, but because this chapter is on creating skins, let's make a skin for some kind of vehicle For a bit of a tease, let's take a look at a vehicle that is already included in the Torque demo using the Show Tool 1 Browse to C:\3DGPAi1 and click on the Show Racing... we save the original model file, because the UV Unwrapping tool will have modified the UV coordinates for the objects in the model, and we can save those changes to the file so that the modeling tool can read them back in again Figure 9.1 The victim—a simple can of soup Then we import the unwrapped image with the lines indicating the face edges into an image processing tool like Paint Shop Pro and... model The system is called U-V Coordinate Mapping The U-coordinate and the V-coordinate are analogous to the X- and Y-coordinates of a 2D coordinate system, though they're obviously not exactly the same 309 Team LRN 310 Chapter 9 ■ Skins Imagine (or you can actually try this at home yourself) taking a closed cardboard box and slicing it open along the edges Then lay the whole thing out flat on the kitchen... by pressing the Tab key—there's more to see See Table 9.2 for the keyboard controls Table 9.2 Torque Racing Demo Controls Key Description mouse W S Tab Escape steering left or right accelerate brake toggle from first- to third-person viewpoint exit the game The Runabout Skinning Procedure Okay, now that the old adrenaline is pumping, let's get back to making skins We're going to create a skin for a... and view the results, as in Figure 9.4 Figure 9.2 Laying it all out—the unwrapped can The part of the process we will focus on in this chapter is the activity shown in Figure 9.3, the actual creation of the textures on the UV Team LRN Making a Soup Can Skin template, so that it can be later used as a skin for models Making a Soup Can Skin So let's dive right in and create a skin We can use the bare model... that they typically wrap around the shape of a 3D model It is fairly obvious that 3D monsters and player-characters would have texture skins, but the term can also apply to automobiles, wheelbarrows, mailboxes, rowboats, weapons, and other objects that appear in a 3D game Typically, skins are created after a model has been unwrapped, so that the skin artist knows how to lay the skins out in the UV template... shown in Figure 9.3 Notice that for textures I simply created markings and re-created a simple label For the top of the can I made some circular text, and for both end caps I made a circular pattern that represents the ridges you often find in those places on tin cans The image file has now officially become a skin for the can! The final step is to import the new skin into the modeling program (or the game) ... the outline Using red line color when you are drawing helps to differentiate between the template's black lines and the lines you are making 9 After you've finished with the cab roof, right-click anywhere on the drawing to deselect the object you just drew, and then set the line color back to red and the fill color back to transparent Figure 9.17 Arrows indicate the editable 10 Next, draw an outline around... Consider it part of the modeling process in the context of this book However, in this chapter we'll deal with the texture processing part of skinning a model and use models I've provided on the CD Later you'll create and skin your own models and do the unwrapping and other things We'll cover how the unwrapping works in more detail then When we want to apply textures to 3D objects, we need a system that specifies . spe- cific 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. that appear in a 3D game. Typically, skins are created after a model has been unwrapped, so that the skin artist knows how to lay the skins out in the UV

Ngày đăng: 26/01/2014, 18:20