Premultiplied alpha and multisampling in OpenGL

583 Views Asked by At

I'm rendering some triangles into multisampled texture. Then blit this texture into normal texture and draw a textured quad onto screen.

I need the final texture to have premultiplied alpha. Is there a way to tell OpenGL to automatically premultiply semi-transparent pixels in multisampled texture (or when blitting)?

Or the only way is using an extra shader pass to perform multiplication manually?

1

There are 1 best solutions below

1
On BEST ANSWER

A multisample resolve blit can't perform pre-multiplication. You will have to pre-multiply the texture's pixels in the process that reads from the texture.