mob-sakai / UIEffect

UIEffect is an effect component for uGUI element in Unity. Let's decorate your UI with effects!
https://github.com/mob-sakai/UIEffect
MIT License
5.62k stars 773 forks source link

Separate Alpha Blend Support #193

Open amartinez1660 opened 4 years ago

amartinez1660 commented 4 years ago

Since the adoption of Custom Render Pipelines camera stacking, UI Layering, etc is more in the hands of each developer. However the proper way to blend a separately UI render after the fact is to clear a render target to a full clear color (black and alpha zero'ed), render all the UI on it with the preferred color blend mode BUT with the alpha channel always adding to the destination (separate alpha blend one one). This resulting image can then be combined properly to any other on top.

Describe the solution you'd like The option to use a UI-Effect shader with separate alpha blending op option.

Describe alternatives you've considered Can force it on the current shaders, but would probably be better to have official support from the library. Probabably behind a #define directive?

Additional context The default alpha blending behavior is that the last element that draws leaves it's alpha value "burned" on the image. So if by any chance one of the last elements during UI rendering happens to be very low opacity, it will leave that low value on the part of the image that it covers. Later on when combining them, that low value will wrongly make it low opacity.

mob-sakai commented 4 years ago

Hi @amartinez1660

Thank you for your feature request!