Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect DDS file generated when compressing BC6H cubemap [4.2.5185] #196

Closed
sherief opened this issue Dec 5, 2021 · 5 comments · Fixed by #320
Closed

Incorrect DDS file generated when compressing BC6H cubemap [4.2.5185] #196

sherief opened this issue Dec 5, 2021 · 5 comments · Fixed by #320
Labels

Comments

@sherief
Copy link

sherief commented Dec 5, 2021

When compressing a an RGBA16F cubemap, the resulting files has 36 faces for each mip level instead of 6.

Input and output files attached:
grace_cross_mmp_ABGR16F.zip

Command line and output:

Source Texture size = 0 Bytes, width = 256 px  height = 256 px
Destination Texture size = 65536 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px  height = 256 px
Destination Texture size = 65536 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px  height = 256 px
Destination Texture size = 65536 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px  height = 256 px
Destination Texture size = 65536 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px  height = 256 px
Destination Texture size = 65536 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 256 px  height = 256 px
Destination Texture size = 65536 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px  height = 128 px
Destination Texture size = 16384 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px  height = 128 px
Destination Texture size = 16384 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px  height = 128 px
Destination Texture size = 16384 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px  height = 128 px
Destination Texture size = 16384 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px  height = 128 px
Destination Texture size = 16384 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 128 px  height = 128 px
Destination Texture size = 16384 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px  height = 64 px
Destination Texture size = 4096 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px  height = 64 px
Destination Texture size = 4096 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px  height = 64 px
Destination Texture size = 4096 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px  height = 64 px
Destination Texture size = 4096 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px  height = 64 px
Destination Texture size = 4096 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 64 px  height = 64 px
Destination Texture size = 4096 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px  height = 32 px
Destination Texture size = 1024 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px  height = 32 px
Destination Texture size = 1024 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px  height = 32 px
Destination Texture size = 1024 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px  height = 32 px
Destination Texture size = 1024 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px  height = 32 px
Destination Texture size = 1024 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 32 px  height = 32 px
Destination Texture size = 1024 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px  height = 16 px
Destination Texture size = 256 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px  height = 16 px
Destination Texture size = 256 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px  height = 16 px
Destination Texture size = 256 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px  height = 16 px
Destination Texture size = 256 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px  height = 16 px
Destination Texture size = 256 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 16 px  height = 16 px
Destination Texture size = 256 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px  height = 8 px
Destination Texture size = 64 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px  height = 8 px
Destination Texture size = 64 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px  height = 8 px
Destination Texture size = 64 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px  height = 8 px
Destination Texture size = 64 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px  height = 8 px
Destination Texture size = 64 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 8 px  height = 8 px
Destination Texture size = 64 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px  height = 4 px
Destination Texture size = 16 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px  height = 4 px
Destination Texture size = 16 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px  height = 4 px
Destination Texture size = 16 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px  height = 4 px
Destination Texture size = 16 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px  height = 4 px
Destination Texture size = 16 Bytes   Resulting compression ratio = 0.00:1
Source Texture size = 0 Bytes, width = 4 px  height = 4 px
Destination Texture size = 16 Bytes   Resulting compression ratio = 0.00:1
Compressed to BC6H with 42 iteration(s) in 2.245 seconds
Total time taken (includes file I/O): 2.246 seconds
Done Processing
Processed in 2.28 seconds```
@NPCompress NPCompress added the bug label Oct 20, 2022
@denislevesqueAMD
Copy link
Contributor

I'm not sure what the issue is here. The input image has 7 mipmap levels per cubemap face, and from the output here Compressonator processed 42 images (6 faces * 7 mipmap levels). I even tried to test myself using both older and newer versions of Compressonator, but it all looked correct to me.

Since this was reported quite a while ago we might just want to close this issue. Unless @sherief happens to remember more details about the issue.

@sherief
Copy link
Author

sherief commented Jul 17, 2023

Loading the output file from the attached .zip in Renderdoc shows the following:
image
Under the "Slice/Face" combo box there's six instances of six faces each. The input file only shows one instance of six faces:
image

In the former file, all cubemap faces other than the first six show as black.

@denislevesqueAMD
Copy link
Contributor

@sherief Thanks for the update! It looks like the extra cubemap faces only show up in RenderDoc, not in Compressonator. We will look into this further.

mosra added a commit to mosra/magnum-plugins that referenced this issue Jul 18, 2023
Apparently those files still exist in the wild, as can be seen in the
attachment at GPUOpen-Tools/compressonator#196.
@mosra
Copy link

mosra commented Jul 18, 2023

I think the error comes from the fact that arraySize is required to store number of cubes, not faces: https://learn.microsoft.com/en-us/windows/win32/direct3ddds/dds-header-dxt10#members

I came across the same issue when implementing my own DDS importer. Don't remember which "ground truth" tool I used to compare against, but I think either the legacy NVidia Texture Tools or the NVTT Exporter should be capable of producing correct DXT10 cubemaps.

The line here

thus should say 1 instead of 6. Similar changes will be needed for cube map arrays as well in case Compressonator supports them.

@denislevesqueAMD
Copy link
Contributor

@mosra Thanks for the suggestion! We'll see about implementing this fix in the near future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants