28.04.2019 Views

[JAVA][Beginning Java 8 Games Development]

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 5 ■ An Introduction to Game Design: Concepts, Multimedia, and Using Scene Builder<br />

Masking can be done for you automatically, using professional blue screen (or green screen) backdrops, along<br />

with computer software that can automatically extract those exact color values to create a mask, which is turned into<br />

alpha channel (transparency) information (data). Masking can also be done manually, using digital image software,<br />

via one of the algorithmic selection tools, in conjunction with various sharpening and blur algorithms.<br />

You will learn a lot about this work process over the course of this book, using common open-source software<br />

packages, such as GIMP. Masking can be a complex and involved work process. This chapter is intended to expose you<br />

to foundational knowledge that will underlie the processes you undertake while working through the book.<br />

A key consideration in the masking process is getting smooth, sharp edges around a masked object<br />

(subject matter). This is so that when you place a masked object (in this case, a game sprite) into (over) new<br />

background imagery, it looks as if it were photographed there in the first place. The key to doing this successfully lies<br />

in your selection work process, which entails using digital image software selection tools, such as the scissors tool in<br />

GIMP, or the magic wand tool in Photoshop, in the proper fashion. Choosing the correct work process is critical!<br />

For instance, if there are areas of uniform color around the object that you wish to mask (maybe you shot it<br />

against a blue screen), you will use a magic wand tool with a proper threshold setting to select everything except your<br />

object. Then, you invert the selection, which will give you a selection set containing the object. Often, the correct<br />

work process requires approaching something in reverse. Other selection tools contain complex algorithms that<br />

can look at color changes between pixels. These can be useful for edge detection, which you can use for other<br />

selection methods.<br />

Smoothing Digital Image Composites: Using Antialiasing to Smooth Image Edges<br />

Antialiasing is a popular digital image–compositing technique, in which two adjacent colors in a digital image are<br />

blended together along the edge that borders the two color areas. This tricks the viewer’s eye into seeing a smoother<br />

(less jagged) edge when the image is zoomed out, thereby eliminating what has come to be called image jaggies.<br />

Antialiasing provides an impressive result by using averaged color values (a color range that is a portion of the way<br />

between the two colors coming together), with just a few colored pixels along the edge that needs to be smoothed.<br />

Let’s take a look at an example to see what I am talking about. Figure 5-2 shows what appears to be a razor-sharp<br />

red circle on one layer, overlaying a yellow fill color on a background layer. I zoomed into the red circle’s edge and<br />

then made another screenshot, placing it to the right of the zoomed-out circle. This screenshot reveals a range of<br />

antialiasing color values (yellow-orange, to orange, to red-orange) right on the edge bordering the red and yellow<br />

colors, where the circle meets the background.<br />

Figure 5-2. A red circle composited on a yellow background (left) and a zoomed-in view (right) showing antialiasing<br />

110<br />

www.it-ebooks.info

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!