-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
DDS BC5 / ATI2 (3Dc) support #5919
Comments
@expenses can you please test my PR, I have a limited number of test files that are all from the same source |
What should be the output of your image @expenses? When I use the code from @mmomtchev their PR I get the following output image: |
Looks like it's decoding correctly, but the blue channel isn't being derived. This is how it looks in gimp: So I don't know too much about this format, except that it's presumably intended for normal maps. Normals are vectors with a length of 1, but because non-HDR images can't handle negative numbers, they're encoded by mapping the values from -1 to +1 to 0 to +1. Afaik, the blue channel can be derived with |
https://developer.nvidia.com/orca/amazon-lumberyard-bistro contains a scene with a large number of DDS textures if you want something to test this on. |
@expenses, this is a compression scheme that can encode only 2 colors. It's advantage is that these are encoded at almost full precision with only 4 bits per pixel. It is frequently used to encode floating point data such as splatmaps - instead of actual image data. The real question is how are the colors selected if the image is rendered as an image, because I simply take them to be Red and Green - as defined by Microsoft. Could it be that GIMP does something else? |
There are two encoding schemes, |
No, in fact this is not true, no DDS codec in ImageMagick supports any @express texture opened with Microsoft tools (Visual Studio with DirectX development) is also red/green - AFAIK - there is no color selection information - there are simply two channels and Microsoft refers them as Red and Green. |
If you have only two channels of data, then typically the third channel is just set to zero (black). |
Is your feature request related to a problem? Please describe.
I'd like to be able to convert BC5 .DDS normal maps with imagemagick. Here's a sample:
Wood_Normal.dds.zip
Describe the solution you'd like
Support :D
Describe alternatives you've considered
Gimp supports loading these files, but it's annoying to script. Renderdoc loads these files as well.
Additional context
See https://en.wikipedia.org/wiki/3Dc
Maister has written about compressed GPU textures: https://themaister.net/blog/2020/08/12/compressed-gpu-texture-formats-a-review-and-compute-shader-decoders-part-1/ and has implemented a BC5 decoder at: https://github.com/Themaister/Granite/blob/master/assets/shaders/decode/rgtc.comp
The text was updated successfully, but these errors were encountered: