简体   繁体   中英

Additive blending artefacts with OpenGL ES 2.0 on some Android devices

I am developing a cross-platform game for Android and iOS. For a couple of billboard-like objects I am using additive blending( glBlend(GL_ONE, GL_ONE) ) with black background textures. The rendered objects look fine(ie the black pixels from the texture look totally transparent) almost everywhere. However on two different Android devices with Adreno GPU's(one Nexus 4 and the other one Sony Xperia Go) I have artefacts like this: 在此处输入图片说明

As it is visible with the hamburger icon, the background color bleeds into the rendered quad. I am assuming it is the background color bleeding because the effect is not visible when the billboard quads are directly in front of the background. To make things weirder, the effect is not visible when I take a screenshot from the device, so I have to take a picture of the screen with another camera. I also noticed that the artefacts disappear when I enable Disable HW Overlays from the Android developer settings. Artefacts disappear also when I have another transparent window on the screen, such as the volume slider when I press the volume buttons.

When I am rendering my scene, I first render opaque objects in the first pass and then in the second pass I render my transparent billboards with glBlend(GL_ONE, GL_ONE) and with disabling depth-write.

Just for the record, it took me a long while to find the culprit but finally I found out the reason. It turns out that not all my "supposedly" opaque objects were really opaque(ie they had alpha value < 1.0).

Because of this, on the devices that use hardware overlays the artefacts become visible while on devices with single hardware overlay it looks fine. I'm not 100% sure but the effect that when I have an overlay window such as the system volume bar on top of my application window approves this has something to do with overlays.

After I made sure all my opaque objects are really opaque issues disappeared.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM