For instance, when loading an image that is SRGB, which of these is correct?

  • Simple premultiply:
    • Take SRGB color from file and multiply RGB by alpha


  • Convert to linear before premultiply:
    • Take SRGB color from and convert RGB to Linear
    • Multiply Linear RGB by alpha
    • Take Linear RGB and convert back to SRGB

This article seems to imply that the most efficient method is the latter: multiply by alpha, then convert to SRGB.

As far as correctness, I realized that if your texture and framebuffer are SRGB, the GPU does SRGB conversion and then blends in linear space. Therefore if you are using SRGB textures and framebuffers, you should premultiply alpha in linear space (the latter approach). If you're rolling your own blending, the order of operations shouldn't matter as long as you undo them in the right order.

This also agrees with the findings that led me to this question: When exporting my premultiplied render target to PNG, my colors had greater RGB values than my alpha value, but converting the RGB value to linear made them equal to alpha.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .