Game Development Reference
FIG 7.32 Average blur versus
and then divided by the number of pixels. Each pixel is then given the same
average value. Another familiar blur is Gaussian blur. It adds the pixel colors
together to determine an average; however, pixel colors in the center of the
selection are given more weight and therefore the blur appears to radiate
outward. The difference in the effects is illustrated in Figure 7.32 .
The blur effect in Unity is shown in Figure 7.30 .
Grayscale reduces colored images down to variations of gray such that it
looks like a black and white photograph. The simplest method for creating
grayscale from color is the average method that takes the red, green,
and blue components of a pixel and divides by three. This new value is
reassigned to the original pixel. The lightness method sets a pixel value to
the average of its highest and lowest color components. For example, if a
pixel had an RGB value of 255,45,60, the highest value 255 and the lowest
value 45 would be added together and divided by two. The final method,
called luminosity , gives the best grayscale result by cleverly weighting the
green value to account for human eye sensitivity. The luminosity algorithm
is 0.21 R + 0.71 G + 0.07 B.
Unity's blur effect is illustrated in Figure 7.30 .
7.4.4 Motion Blur
Motion blur is an effect used to make something look like it is moving
rapidly or to give the player a dreamy view of the environment. The pixels
appear to streak across the page in the direction of the motion. In addition,
objects can have ghosting effects surrounding them. The effect is achieved
by partially leaving the previous frame on the screen while rendering the
next one. This effect is also useful in persuading players that their character