简体   繁体   中英

Xamarin IOS Opentk - BlendFunc with transparent textures

I'm trying to render some label textures with transparent background using OpenTK in Xamarin. At first the labels seemed display properly (see picture 1) but when the view rotated, the some label background are not transparent any more (see picture 2).

The enabled BlendFunc is GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha).

My question is how can I always have labels transparency on despite of their positions? The same code and shader can run properly on Android Devices by the way. 标签显示正常

标签相互覆盖

Ah yes, the good old transparency problem. Unfortunately this is one that a graphics programmer has to solve on his own.

For just a few labels, the most straight foward solution is likely to sort your labels by z-depth and then render them from farthest to closest. You'd probably need to do some matrix math on that label position to adjust for viewport rotation.

For the 3d game I'm working on I have chosen to implement the order-independent transparency method called WBOIT by Morgan McGuire , which is fairly simple to implement and yields relatively good results.

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