Alpha hybrid Discussion

Source: Internet
Author: User

The Alpha hybrid technology is no stranger to those familiar with games, and has been used up in today's game special effects. 3D games won't be mentioned. In 2D games, this technology is also full of eyes.

Alpha mixing sounds mysterious and actually very simple. Its role is to achieve a translucent effect. Assume that the color of an opaque object is a, and the color of another transparent object is B. Then, through B, we can see a. The color C looks like a mixed color of B and, we can use this formula to approximate the transparency of the B object to alpha (the value 0-is completely transparent, and the value 1 is completely opaque)

R(C) = Alpha *R(B) + (1-alpha )*R()
G(C) = Alpha *G(B) + (1-alpha )*G()
B(C) = Alpha *B(B) + (1-alpha )*B()

R(X ),G(X ),B(X) respectively refers toRGBComponent. It seems that this is so simple, but the effect achieved with it is absolutely not simple, the application of Alpha hybrid technology, you can achieve the most dazzling fire, smoke, shadow, dynamic light sources, and other translucent effects you can imagine.

The effect of fire and smoke is to build a fire or fog diagram and an alpha channel diagram in advance (people who have used Photoshop should know what an alpha channel is ), when you draw a picture, each point is calculated to obtain the effect of the fire. The atomization effect still needs to be blurred in 3D, so it is free of charge here. There is a large amount of computing for Alpha mixing,AlgorithmIf optimization is not followed by blurring or other reasons, you are watching the slides. (I will talk about Optimization on the Internet later ).

The dynamic light source sounds like a deep collapse. Let me first talk about the shadow. This is simple. In the past, the game also had shadows (like "xianjian"). However, we upgraded it to a lower level and it never became translucent. It is to place a shadow image on the surface for Alpha mixing (and can be simplified, because the Alpha value of the shadow can be certain, so that the computing speed can be greatly improved.

This is about the dynamic light source. We imagine that there is no light source on the screen as a black screen, and nothing can be seen without light. Then we add a light source, which is equivalent to digging a hole in the black screen. The size of the hole is the scope of illumination. Now we can see the following. But now this effect is a light source, rather it is a window. To look like a light source, we need to make the center of the light source the brightest, gradually dark around, and finally we can't see anything, this is like a light source. The specific implementation is Alpha mixing. The mask color is black, the center Alpha value is 0, completely transparent, and the Alpha value at the end of the light source is 1, completely opaque. The result is like this, this is the case! When the light source is ready, the dynamic light source generates a dynamic Alpha mask in real time, and then it is covered.

Not hard! Some of the technologies in the game (not just games, but also many algorithms) sound very mysterious. It's just a matter of fact, but it's not just a matter of thought.

Diablo uses a large number of Alpha hybrid technologies (at least I look like it), the translucent effects produced by the dazzling magic, and the fireball that powers the maze, each fireball is a small light source. A pile of masks (that is, the corresponding Alpha addition, more than 255 will be truncated) are masked. (The True Light source should be like this: when the Alpha value exceeds 255, alpha = alpha-255, Alpha is a byte, that is, the echo, and the color of the mask becomes white, this is correct, but for the sake of simplicity, it would have been enough ).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.