Alpha Fusion under OpenGL

Source: Internet
Author: User

Alpha mixing theory see previous blog: http://blog.csdn.net/dizuo/archive/2009/12/18/5035371.aspx

Alpha Fusion must set different Z values for the object. You can specify different Z values through glvertex3 * painting, or call gltranslate3f/d to set different Z values through glvertex2 * painting.

OpenGL draws two-dimensional images. When Alpha Fusion is performed, if all two-dimensional images have the same zvalue = 0.0f, even if correct Alpha Fusion settings are performed, each image is only merged with the window background, the fusion between images is not integrated.

 

Figure 1: alpha = 0.4f of the slice, alpha = 0.2f of the rectangle, and zvalue = 0.0f of the two. We can see that they both have a correct Alpha Fusion with the background gray, but they are not.

Figure 2: alpha = 0.4f, zvalue = 0.0f, alpha = 0.2f, and zvalue = 0.1f. At this time, the fusion is correct!

It is actually a bunch of nonsense, but it is because of a Z value that causes Alpha mixing failure. This problem has plagued me for a long time ~

 

-Ryf 2011/4/16

When drawingSort by Z value from small to largeIn order to correctly combine them !!

-Ryf 2012/3/3

Thank you.Gamemagic's advice,Draw 2DDisable the deep test and set the Alpha ValueTo achieve the expected results. orIn deep test mode, all elements must be sorted by depth value and drawn from the back to the front,, This approach is mainly for 3D space...

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.