Handmade Hero » Forums » Code » Questions concerning pre-multiplied alpha
boagz57
Jason
98 posts
#20828 Questions concerning pre-multiplied alpha
1 month, 3 weeks ago Edited by Jason on March 31, 2019, 6:36 p.m.

I just finished watching the pre-multiplied alpha video and I'm still abit confused on it's applications. Does pre-multiplied alpha only apply to situations where you are using pre-composites? Or does it also give you advantages (besides performance) when just calculating everything and drawing to the screen every frame? I only ask because I'm currently in the latter situation (no pre-composites/pre rendered textures) and so far is seems like just linearly alpha blending everything gives me what I need. Though I've heard that pre-multiplied alpha can give you more accurate color information and better texture filtering effects in general (without pre-compositing).

I've been trying to experiment with pre-multiplied alpha with my current setup and I keep getting wrong outputs so just wanted to make sure this wasn't because pre-composites are a pre-requisite to using alpha blending (if not then my math is just wrong).
mrmixer
Simon Anciaux
600 posts
#20832 Questions concerning pre-multiplied alpha
1 month, 3 weeks ago

When you refer to a video, please add a link to it in the post (if possible to the relevant part).

I think premultiplied alpha is about getting the "correct result" when composing multiple elements. You can do it with any source since it always come down to pixel values if it's relevant to what you do.

Here are some articles about the subject:
Premultiplied alpha
This is probably more relevant to you: Premultiplied alpha and image composition
Alpha Blending: To Pre or Not To Pre
boagz57
Jason
98 posts
#20833 Questions concerning pre-multiplied alpha
1 month, 3 weeks ago

Sorry about that. I attached a link to my original post. And thanks for the references. And I guess, after looking at Shawn Hargreaves' article, it is the compositing of multiple elements with alpha values that brings about the need for per-multiplied alpha (for correct color anyway).