it there any compress method which is better than dxt[n]?

Started by
10 comments, last by Paradigm Shifter 10 years, 6 months ago

You get problems with DXT1 for 1 bit alpha if you want to add filtering to the texture (around the edges, the pixels with alpha 0 are assumed to be black, by the hardware, you can't specify a non-black transparent fill colour). I saw an article about using a different source/dest blending equation for that case but after bouncing back and forth between myself (tools dept.) and the graphics guy we failed to come to a conclusion that it would be a satisfactory solution. I can't recall the exact reasons why I was convinced to drop it in favour of a DXT5 with a uniform colour for the transparent parts of the bitmap (may have been tools change hassle combined with needless worrying on the graphics dept. side).

With DXT1 transparencies, and the black outlines, this is something that always annoys me when I see it in other games, because it's an easy fix.

As the alpha channel fades from white to black, the colour channel also fades to black, which is as if it's already been multiplied by the alpha channel, so when you multiply it with the alpha channel again during blending, you get black outlines.

The solution is that instead of using alpha blending (result = src*a + dst*(1-a)), you need to use pre-multiplied alpha blending (result = src + dst*(1-a)).

Pre-multiplied alpha blending is actually much more versatile, as it allows you to render both regular "alpha" style effects (e.g. smoke) and additive style effects (e.g. fire) at the same time (no need for each of these to use it's own blend mode). You can even pre-paint smoke and fire onto the same sprite/texture if you want to.

Advertisement

Yeah I had this exact same argument with my gfx prog. He wasn't buying it. I'm pretty sure he came up with a counter argument although it may have been "let's keep it the way it is". I'm pretty sure he came up with a counter example though (something to do with the PS3 GFX hardware I think). Maybe state changes complicating the material sorting order (that's fairly weak tho). Artists are the trump card but it could be preprocessed in tools. I forget, it was over a year ago.

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley

This topic is closed to new replies.

Advertisement