Googles appar
Huvudmeny

Post a Comment On: cbloom rants

"06-17-09 - DXTC More Followup"

13 Comments -

1 – 13 of 13
Blogger Tom Forsyth said...

Freaky confluence - I've also been looking at DXT4 luma, downsampled DXT5 chroma. I also looked at downsampling the chroma by 4x4 instead of 2x2, so it's only 4.5bpp. This produces images that are visually about the same sort of errors as DXT1 (smudged chroma), but the artifacts are far less objectionable because they're smooth (bilinear filtered up) rather than 4x4 blocky.

The other really important thing for my application is the compression time. Getting high-quality DXT1 compression takes a lot of time. Getting high-quality DXT4/DXT5 compression is nearly trivial because it's a 1D problem not a 3D one. If you're generating the textures on the fly (decompression from JPEG, or procedural generation), that's hugely important.

June 17, 2009 at 10:19 PM

Blogger cbloom said...

(you mean BC4/BC5 not DXT4/DXT5)

Yes, the BC4 compression is much simpler/faster than DXT1. You can do those realtime DXT1 compressors, but they sacrifice a huge amount of quality for speed. A fast BC4 compressor is close to full quality.

4x4 chroma subsampling will be fine for images where the "smooth chroma" hypothesis holds true; that does work fine on many natural images, but it can be very bad in some cases.

An easy way to fix that is to swap RGB channels around so that G is the one with the most variance.

June 17, 2009 at 10:31 PM

Blogger cbloom said...

BTW BC4-downsampled-BC5 is a pretty obvious idea, I came up with it myself as I was implementing DXT5-YCoCg. Ignacio tells me that Humus came up with it and published it first so I'm calling it "Humus BC4BC5" or something like that.

June 18, 2009 at 4:11 PM

Blogger won3d said...

I also came up with 1 + subsampled 2 independently, and I'm pretty sure Humus wasn't the first place I saw it either. There were variations on it that used 2 DXT1 textures before these fancy new formats were around. Anyway, yeah, obvious, but the Humus' demos certainly illustrate things well.

So one thing I wondered about and never tried: is it worth doing a LOD bias on the chroma texture so that more fetches come from lower-rez? Or, in the other direction, only doing anisotropic filtering on luma?

June 18, 2009 at 9:48 PM

Blogger Cyan said...

Quick question :

DXT1 texture can be displayed out-of-the-box by any graphic card nowadays.

But what about your proposed BC4+BC5 format ? Can it be fed "as is" to the graphic card (well, directly... using the right set of parameters i guess),
or should it be first transformed into something which can be more directly interpreted by the GPU ?

September 26, 2012 at 1:12 PM

Blogger cbloom said...

You mean the "Humus" representation? It is used as-is but requires a pixel shader that does two fetches and the inverse color transform.

September 26, 2012 at 2:52 PM

Blogger Cyan said...

OK, thanks.
So, it's not "straightforward", since it requires to load and run some pixel shader,
but at least, texture data in this format can be used without being transformed.

I guess there is also a performance cost, since DXT1 is "pre-wired" in the GPU, so a programmable shader is likely to get slower. Probably not a huge issue, but still, maybe something to measure for real-time applications.

Rgds

September 27, 2012 at 9:17 AM

Blogger Cyan said...

I'm currently considering an alternative compressed texture format, in order to "get around" some classical (and unsolvable) DXT1/DXT5 distortions.

Thanks to your study, YCoCg decomposition seems a fairly good candidate to me.

I tend to like the "Humus" format, since :
1) It mimics JPEG behavior
2) My second requirement is real-time compression, for which Humus encoding format seems to suit well.

Nonetheless, there are probably a few things i've not fully catched, and may prove this assumption wrong.

So i've got 2 questions :
1) Would you go for "Humus" texture compression format to improve texture quality, or would you suggest another route ?
2) It's unclear to me how "texture which size is not a multiple of 4" can be handled by these formats. DXT1 uses the "transparent bit" for these extra pixels. There is not such thing into YCoCg decomposition. Maybe a convention to define transparent pixels whould have to be created ?

Rgds

October 29, 2012 at 6:48 AM

Blogger cbloom said...

Yann,

1) Yes, Humus definitely improves quality for most images (it's best on smooth/natural images).

In the future, BC6/BC7 may be a better choice, dunno I haven't looked into them in great detail.

2) The normal way that's handled is you just pad up the texture to a multiple of 4 and then only use a portion of that. So you're sending some pixels that aren't used. The best way to pad is not to make them transparent, it's to copy the neighbor pixels.

October 29, 2012 at 12:41 PM

Blogger Cyan said...

Thanks for advises !

October 30, 2012 at 9:58 AM

Blogger Cyan said...

Just a quick feedback on experience : Quality of YCoCg in "Humus" format is very good ... for natural images, and smooth gradient ones. Almost perfect.

However, for synthetic images, with sharp chroma variations (luma variations are fine), it results in some color bleeding, and noticeable "blur" of the edges.

It's funny to note that, in constrast, DXT1 behaves fairly well on such "synthetic" samples.

November 25, 2012 at 5:44 AM

Blogger cbloom said...

Yup, I saw the same thing. You really need to support both, which is a tad unfortunate because it doubles your shader count.

November 26, 2012 at 12:43 PM

Blogger Cyan said...

As a sidenote, i also noticed that, should a second-pass lossless compression algorithm be taken into consideration, YCoCg texture tend to be much less compressible than DXT1 ones.

As a consequence, the final (compressed) result difference between YCoCg & DXT1 is quite much more than 50%. It's not unusual to see relative differences of 2 to 3 times larger. It kinda have an impact from a storage/archive perspective.

November 29, 2012 at 2:31 PM

You can use some HTML tags, such as <b>, <i>, <a>

This blog does not allow anonymous comments.

Comment moderation has been enabled. All comments must be approved by the blog author.

You will be asked to sign in after submitting your comment.