Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Alpha compositing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Comparison === The most significant advantage of premultiplied alpha is that it allows for correct blending, [[interpolation]], and [[Filter (signal processing)|filtering]]. Ordinary interpolation without premultiplied alpha leads to RGB information leaking out of fully transparent (A=0) regions, even though this RGB information is ideally invisible. When interpolating or filtering images with abrupt borders between transparent and opaque regions, this can result in borders of colors that were not visible in the original image. Errors also occur in areas of semitransparency because the RGB components are not correctly weighted, giving incorrectly high weighting to the color of the more transparent (lower alpha) pixels.<ref>{{cite web |title=Alpha Blending: To Pre or Not To Pre |url=https://developer.nvidia.com/content/alpha-blending-pre-or-not-pre |website=NVIDIA Developer |language=en |date=31 January 2013 |quote=However, something interesting happens when we generate the next mipmap level...}}</ref> Premultiplied alpha may also be used to allow regions of regular alpha blending (e.g. smoke) and regions with [[Blend modes#Addition|additive blending mode]] (e.g. flame and glitter effects) to be encoded within the same image.<ref>{{cite web|url=https://tomforsyth1000.github.io/blog.wiki.html#%5B%5BPremultiplied%20alpha%5D%5D |website=TomF's Tech Blog - It's only pretending to be a wiki |access-date=8 May 2018 |url-status=live |archive-url=https://web.archive.org/web/20171212111056/http://tomforsyth1000.github.io/blog.wiki.html#%5B%5BPremultiplied+alpha%5D%5D |archive-date=12 December 2017 |title=TomF's Tech Blog - It's only pretending to be a wiki }}</ref><ref>{{cite web |last1=Trebilco |first1=Damian |title=To close to draw call (presentation on Pre-multiplied alpha) |url=https://github.com/dtrebilco/PreMulAlpha |website=GitHub |quote=By switching to pre-multiplied blend mode for all particle effects, and entire scene can be done with one draw call (assuming atlasing/2D array for the textures)... Another neat trick with pre-multiplied alpha is that if you have overlapping textures that are in known positions, you can pre-process them all down to one texture.}}</ref> This is represented by an RGBA triplet that express emission with no occlusion, such as (0.4, 0.3, 0.2, 0.0). Another advantage of premultiplied alpha is performance; in certain situations, it can reduce the number of multiplication operations (e.g. if the image is used many times during later compositing). The Porter–Duff operations have a simple form only in premultiplied alpha.<ref name=Duff/> Some rendering pipelines expose a "straight alpha" API surface, but converts them into premultiplied alpha for performance.<ref>{{cite web |title=Premultiplied alpha |url=https://microsoft.github.io/Win2D/WinUI3/html/PremultipliedAlpha.htm |website=Win2D for WinUI3 |access-date=30 June 2023 |quote=Win2D uses straight alpha in its API surface, but premultiplied alpha for internal rendering operations.}}</ref> One disadvantage of premultiplied alpha is that it can reduce the available relative precision in the RGB values when using integer or fixed-point representation for the color components. This may cause a noticeable loss of quality if the color information is later brightened or if the alpha channel is removed. In practice, this is not usually noticeable because during typical composition operations, such as OVER, the influence of the low-precision color information in low-alpha areas on the final output image (after composition) is correspondingly reduced. This loss of precision also makes premultiplied images easier to [[Data compression|compress]] using certain compression schemes, as they do not record the color variations hidden inside transparent regions, and can allocate fewer bits to encode low-alpha areas. The same “limitations” of lower quantisation bit depths such as 8 bit per channel are also present in imagery without alpha, and this argument is problematic as a result.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)