I was always curious about what is happening during an alpha compositing process, especially how does premultiplied alpha in particular work. Mainly to completly understand the good use of blend factors, and be able to make really economic OpenGL shaders/render pipelines. So I made a clarification of alpha blending, and have modelled the whole process in Photoshop, that uses only multiplication (Multiply), and addition (Linear Dodge) as blending mode only. Having this, it is really the same is happening in the Photoshop file what is being calculated on the GPU during alpha compositing, thus it can be observed from a really close view. As I dig deeper, I found out that premultiplied alpha is mainly for “hardcode” alpha computation in advance, actually premultiply the alpha to not multiply at runtime on every frame. Without further expaination, you can follow the process below. DISCLAIMER. THE INFORMATION ON THIS BLOG (INCLUDING BUT NOT LIMITED TO ARTICLES, IMAGES, CODE SNIPPETS, SOURCE CODES, EXAMPLE PROJECTS, ETC.) IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE INFORMATION ON THIS BLOG (INCLUDING BUT NOT LIMITED TO ARTICLES, IMAGES, CODE SNIPPETS, SOURCE CODES, EXAMPLE PROJECTS, ETC.). Become a Patron! Tweet |
|