Problem with using BC6H_SF compression for Normals map
All negative values in texture when rendering is equal to zero. Values range is -1.0 to 1.0. Texture using in OpenGL as GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT.
unsigned uiTextureSize = texWidth * texHeight * (Texture.texBPP / 8)
std::vector<float> vFloatDataBuffer(uiTextureSize);
glGetTexImage(GL_TEXTURE_2D, level, GL_RGBA, GL_FLOAT, vFloatDataBuffer.data());
CMP_Texture srcTexture;
srcTexture.dwSize = sizeof(CMP_Texture);
srcTexture.dwWidth = texWidth;
srcTexture.dwHeight = texHeight;
srcTexture.dwPitch = (((Texture.texBPP * texWidth) + Texture.texBPP - 1) / Texture.texBPP) * (Texture.texBPP / 8);
srcTexture.format = CMP_FORMAT_ARGB_32F;
srcTexture.dwDataSize = uiTextureSize;
srcTexture.pData = (CMP_BYTE*)vFloatDataBuffer.data();
CMP_Texture destTexture;
destTexture.dwSize = sizeof(CMP_Texture);
destTexture.dwWidth = texWidth;
destTexture.dwHeight = texHeight;
destTexture.dwPitch = 0;
destTexture.format = CMP_FORMAT_BC6H_SF;
destTexture.dwDataSize = CMP_CalculateBufferSize(&destTexture);
std::vector<CMP_BYTE> destTextureData(destTexture.dwDataSize);
destTexture.pData = destTextureData.data();
CMP_CompressOptions options = {0};
options.dwSize = sizeof(CMP_CompressOptions);
options.fquality = 0.05f;
options.dwnumThreads = 8;
CMP_ERROR cmp_status = CMP_ConvertTexture(&srcTexture, &destTexture, &options, &CompressionCallback, 0, 0);
CMP_FORMAT_RGBA_32F don`t working and CMP_FORMAT_ARGB_32F working as CMP_FORMAT_RGBA_32F. Loading and rendering of uncompressed signed float Normals is correct. All other types of compression don't cause any problems.
@daniilpetrov
Thank you for the details of the issue. The source texture format input setting is been investigated for BC6H.
In new release of library problem with negative values is remain...
The issue has not been resolved. It is still pending work.
When can you resolve my issue? I would like to solve it.
@daniilpetrov "When can you resolve my issue?" The BC6H codec is been reworked, it will take some time to complete. There is a release scheduled for next week, but the new code for BC6H will not be available until the release after that.
@daniilpetrov In the next release the negative value issue should be resolved. Also, the BC6H codec assumes the input data is in RGBA order, so ARGB won't work as you might want. To that end, CMP_FORMAT_RGBA_32F should no longer fail in the next release.
The issue has been resolved in current release