5 Comments

It appears that you are using premultiplied alpha blending, but it looks like the colors you're sending to the GPU are not premultiplied, unless I missed something.

Expand full comment
author

I don't know. I'm a total beginner when it comes to graphics APIs.

Which part of the code sets up the premultiplied alpha blending?

Expand full comment

color_attachment_desc->setSourceRGBBlendFactor(.One) is premultiplied,

color_attachment_desc->setSourceRGBBlendFactor(.SourceAlpha) is straight alpha.

In the OpenGL version you used straight alpha blending.

Expand full comment
author

I fixed that part in the newest post. Not sure it has anything to do with the alpha being premultiplied though.

Expand full comment

If you use .One and then in the shader you do this:

color.r *= color.a;

color.b *= color.a;

color.g *= color.a;

Then you should get the same blending as using .SourceAlpha. If not, then .One wasn't using premultiplied alpha blending.

Expand full comment