1
votes

I load DDS images (DXT5) with transparent alpha into OpenGL. Because the alpha is not pre-multiplied and can not be pre-multiplied based on DXT5 specs I get thin black halo around the visible part of the texture because I do some blending operations on GPU.My question is: what can be the best workaround for it.My OpenGL renderer updates scene textures on each frame loading those from IO so if I decompress the DDS then pre-muliply , then compress back I get huge overhead.Another option I thought would be to add another render pass and do the pre-multiply in fragment shader and render to texture,then use it for the main pass.This one adds overhead to the whole pipeline because I already have a descent number of passes.What are additional options here?

2
"My OpenGL renderer updates scene textures on each frame loading those from IO" You're loading and compressing textures every frame? Why?Nicol Bolas
Can't explain here as it is commercial stuff but that is special purpose renderer.It is supposed to work that way :)Michael IV
That is ,btw,the reason I use DDS here - to speed up upload time.Ah sorry , I am not compressing the textures in real time.I load ready DDSsMichael IV

2 Answers

0
votes

Why not just have your shader do the pre-multiplication of the alpha in situ, then do whatever you were going to do normally?

There's no need to render that to a texture. Just always pre-multiply in your shader, for all textures where you need pre-multiplication.

0
votes

The issue solved.I had a corrupted DDS texture.The manual pre-multiplication I was doing by default in fragment shader works perfectly with valid DXT5.