cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Bernie
Journeyman III

ATI_TC_CompressOptions is not working (static lib)

It appears that the compression options (ATI_TC_CompressOptions) are being ignored by Compressonator (ATI_TC_ConvertTexture). Specifically I'm trying to set the per-channel weighting and it's having no effect - I have bUseChannelWeighting = TRUE and fWeightingRed,GreenBlue = {1, 0.1, 0.1} and the results are identical to when I set the weighting to {0.1, 1, 0.1} or any other values. I've tried setting bUseAdaptiveWeighting to TRUE as well and this does not help. The input format is floating point (A32B32G32R32F). The version of the static lib is 1.7, which as far as I'm aware is current ..

What's especially strange is that the standalone Compressonator exe (version 1.5) does appear to respect the per-channel weighting options. However our art pipeline uses the static lib since we need to batch convert thousands of textures when we build our assets. Is there anything I can do to make ATI_TC_CompressOptions work with the static lib version of Compressonator?

Thanks,

Bernie Freidin

Rockstar North

0 Likes
5 Replies
AghaJan
Staff

Can you send me one of the assets that you’re having trouble with so that I can trace it through the code? A code snippet of how you’re using the library would be great too.

0 Likes

Here's a snippet of the code I'm using to compress a texture. In this example I'm setting fWeightingRed to 1.0 and the other two weights to 0, so I would expect that the red channel would have higher quality (assuming each of the channels has a smooth gradient going in a different direction, say).

http://img94.imageshack.us/i/testgradientrgb.jpg/

If you change fWeightingRed to 0 and fWeightingBlue to 1.0, I would expect the blue channel would have the higher quality. However when I call ATI_TC_ConvertTexture I get the exact same results regardless of what my fWeighting settings are.

If I run TheCompressonator.exe from a command line and pass in args "+red 1.0 +green 0.0 +blue 0.0" then I get the expected result.

Thanks for taking a look at this. Calling the compressonator exe from the command line unfortunately is not a good solution for us, we would really prefer to use ATI_TC_ConvertTexture.

bool CDXTCompressor::Compress_ATI(grcImage* dst, const void* src) const { ATI_TC_Texture dstDesc; ATI_TC_Texture srcDesc; ATI_TC_CompressOptions options; memset(&dstDesc, 0, sizeof(dstDesc)); memset(&srcDesc, 0, sizeof(srcDesc)); memset(&options, 0, sizeof(options)); dstDesc.dwSize = sizeof(dstDesc); dstDesc.dwWidth = width; dstDesc.dwHeight = height; dstDesc.dwPitch = 0; dstDesc.format = ATI_TC_FORMAT_DXT1; dstDesc.dwDataSize = ATI_TC_CalculateBufferSize(&dstDesc); dstDesc.pData = (u8*)dst->GetBits(); srcDesc.dwSize = sizeof(srcDesc); srcDesc.dwWidth = width; srcDesc.dwHeight = height; srcDesc.dwPitch = width*sizeof(float)*4; srcDesc.format = ATI_TC_FORMAT_ARGB_32F srcDesc.dwDataSize = ATI_TC_CalculateBufferSize(&srcDesc); srcDesc.pData = (u8*)src; if (1) // these don't seem to work, why is that? { options.bUseChannelWeighting = TRUE; options.bUseAdaptiveWeighting = FALSE; // also tried TRUE .. options.fWeightingRed = 1.0; options.fWeightingGreen = 0.0; options.fWeightingBlue = 0.0; } const unsigned prev_controlfp = _controlfp(~0, _MCW_EM); const ATI_TC_ERROR err = ATI_TC_ConvertTexture(&srcDesc, &dstDesc, &options, NULL, NULL, NULL); _controlfp(prev_controlfp, _MCW_EM); if (err) { Errorf("ATI_TC_ConvertTexture returned %d", err); return false; } return true; }

0 Likes

Bump!

Hi guys,

Has anyone any idea of what we're doing wrong ?

Thanks,

Alex.

0 Likes

I Just wanted to give you an update. I downloaded the sample image you provided and ran some tests with Compressonator. I was able to use the exe to reproduce cases when it worked and cases when it does not work, unfortunately I was unable to identify why the bad cases did not work. Stepping through the code, it appears to use the supplied options, but still the generated image has all three channels.

Can you please tell me if using a different compression format than DXT1 is viable for you at this time. It may allow you to move forward as I continue to investigate the issue.

0 Likes

Hi,

Thanks for looking into this. We're currently bypassing the issue by either suffering the imperfections brought by DXT1 compression or using a less compact texture format.

We can run the Compressonator tool on its own and get the desired results, but this doesn't play nice with our pipeline.

The one thing I don't understand though, is that if the Compressonator is built using the same libraries, either we are passing different/bad parameters to the lib, or the exe is doing something different than our code.

Thanks,

Alex.

0 Likes