0
$\begingroup$

Afaik, in alpha premultiplied color the components stored so:

[r * a, g * a, b * a, a]

So the fully opaque white color is:

[1 * 1, 1 * 1, 1 * 1, 1] = [1, 1, 1, 1]

Fully transparent white color is:

[1 * 0, 1 * 0, 1 * 0, 0] = [0, 0, 0, 0]

Half transparent white color is:

[1 * 0.5, 1 * 0.5, 1 * 0.5, 0.5] = [0.5, 0.5, 0.5, 0.5]

So I can't see a color channel that can be greater than the alpha. I'm asking because I have rendering artifacts and the library I'm using claims that textures stored as textures as sRGBA premultiplied pixels though I see values like

[0.4784314, 0.4784314, 0.4784314, 0.19607845]
$\endgroup$
5
  • 1
    $\begingroup$ This is true only if you insist 1 is the biggest color value. $\endgroup$
    – joojaa
    Commented Jun 2, 2021 at 21:05
  • $\begingroup$ @joojaa But sRGB assumes that, right? $\endgroup$ Commented Jun 3, 2021 at 7:54
  • 3
    $\begingroup$ yes because thst the device maximum, but then sRGB makes alot of assumptions that make no sense. In reality you really you should not do any computation in device space anyway. You should do this is some other space that is atleast computationally linear then convert than into sRGB. Why? Multiplication does not male any sense in a nonlinear space. $\endgroup$
    – joojaa
    Commented Jun 3, 2021 at 7:58
  • 1
    $\begingroup$ Agree with joojaa -- premultiplied sRGB is a stupid idea but unfortunately was included in a certain graphics standard: twitter.com/Simon_Fe1/status/1336357963821420544 $\endgroup$
    – Simon F
    Commented Jun 3, 2021 at 12:46
  • $\begingroup$ It sounds like this post is referring specifically to pre-multiplied alpha, and there are times when pre-multiplied alpha does make sense. But I also agree with joojaa, check your assumptions as it is possible to get non-sense values when those assumptions are broken. Here is a link supporting the use of pre-multiplied alpha: blog.demofox.org/2015/06/19/… $\endgroup$
    – pmw1234
    Commented Jun 8, 2021 at 14:23

1 Answer 1

1
$\begingroup$

As it turned out, the premultiplied color data was transformed to sRGB. Alpha stays linear. In that case, a component can be greater than the alpha. For example, with alpha 0.5 and color 1.0, the premultiplied value (0.5) is fed to the forward transformation (CIE XYZ to sRGB) formula that returns ~0.74.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.