Question

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?

Was it helpful?

Solution 2

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top