Alpha mixed technology will not be unfamiliar with those who are familiar with games, this technology has been used in today's game special effects. 3D games don't say, 2D games, this technology is full of eyes.
Alpha mixed is very mysterious, actually very simple, its role is to achieve a translucent effect. Suppose a color of an opaque thing is A, another transparent color is B, then see A through B, look at the color c is the mixed color of B and A, can be used in this style, The transparency of the B object is Alpha (value of 0-1, 0 is completely transparent, 1 is completely opaque)
R (c) = alpha * R (b) (1-alpha) * R (a) g (c) = alpha * g (b) (1-alpha) * g (a) b (c) = alpha * B (b) (1-alpha) * b (a)
R (x), g (x), b (x) refers to the RGB component of color X, respectively. It seems that this thing is so simple, but it is absolutely not simple to use, applying Alpha hybrid technology, you can achieve the most dazzling flare, smoke, shadow, dynamic source, etc. You can imagine the half-transparent effect.
Fire, the effect of smoke is a picture of a fire or fog and an alpha channel map (people who have used Photoshop should know what is Alpha channel). When the painting, each point is calculated, the result is the fire mask Effect. The atomization effect also needs to be blurred in 3D. It is exempt here. Original alpha mixes have a small computation amount, the algorithm is not optimized to add blur or other reason, then you are watching slideshow . (About optimization, online seeing, I will talk about it again).
Dynamic light source, sounds high-profile collapses. Then I will talk about the shadow first, this is simple, the past game also has a shadow (like "Xianjian"), but we upgrade it, from opaque to become translucent. That is to put a shadow diagram on the surface on the surface to mix (and can be simplified, because the alpha value of the shadow can be certain so that the calculation speed can be significantly ok.
This is a dynamic source. We imagine the place where no light source is imagined into a shady. On the screen, you can't see anything. Then we add a light source, which is equivalent to digging a hole on the shady. The size of this hole is illuminated. Now we can see the following things. But now this effect is a light source, but it is better to say that it is a window. It is necessary to make the light source to the brightest, gradually went down, and finally, I can't see it, this is like a light source. The specific implementation is the alpha mix, the color of the mask is black, the center alpha value is 0, completely transparent, the alpha value of the light source is 1, completely opaque, the results are like this, like this! The light source is done, the dynamic source is to generate a dynamic alpha mask in real time, then cover it.
Not difficult! Some of the techniques of the game (in fact, not only a game, a lot of algorithms is also like this), saying that it is true, but it is just that it is not a bit.