GithubHelp home page GithubHelp logo

Comments (1)

walbourn avatar walbourn commented on June 30, 2024 1

The default decompress format for BC4 maps to DXGI_FORMAT_R8_UNORM which is a single red channel (BC4 encodes just one channel). When DXGI_FORMAT_R8_UNORM is passed to the WIC writer, the default format for WIC maps to GUID_WICPixelFormat8bppGray. For the .BMP codec, this is written as a BI_RLE8 which is a palette mode, and the BMP palette is the identity (0-255 maps to greyscale colors 0-255).

The default decompress format for BC5 maps to DXGI_FORMAT_R8G8_UNORM which is a two channel format (BC5 encodes two channels). When DXGI_FORMAT_R8G8_UNORM is passed to the WIC writer, there is no WIC format that exactly matches so that writer fails. Therefore, you have to provide the target format you want to use.

With that out the way, when you provide -f rgba the target format for the conversion becomes DXGI_FORMAT_R8G8B8A8_UNORM. The tool first decompresses BC4 to R8, then converts from R8 to R8G8B8A8. The default behavior for such conversions is to do a 'greyscale expansion' as you see to set the RED channel to R, GREEN channel to R, and BLUE channel to R, and the ALPHA channel to 1.

If on the other hand you provide a BC5, then it decompresses to R8G8, then converts R8G8 to R8G8B8A8. The default behavior for such conversions is to copy R to red, G to green, and set B to zero, and A to 1.

From my understanding of your question, you want BC4 to write out to R8G8B8A8 where R is red, G is 0, B is zero, and A is 1. You can do this with the -swizzle option. In your case -swizzle r001 which will copy the red channel and then set the other channels to fixed values.

from directxtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.