Giter Site home page Giter Site logo

Comments (6)

drewcassidy avatar drewcassidy commented on June 18, 2024 1

See this is the thing: there kinda isn't a format specification since DXT1 originated as a semi-proprietary format of a now-defunct graphics company. Microsoft's docs for BC1 (their name for DXT1 in DirectX 11) just says

This algorithm lends itself to data that contains 1-bit alpha also.

Without specifying if the alpha should always be there or not. The OpenGL wiki states

A DXT1-compressed image is an RGB image format. As such, the alpha of any color is assumed to be 1

and treats "DXT1 with alpha" as a separate pseudo-format. The Nvidia Texture Tools toolset treats it the same way, and as far as I can tell this was the original intention of the format with the alpha information tacked on after the fact.

In the end there's not much consensus with these formats besides what the GPUs themselves will accept, and its impossible to make it in a way that pleases everyone with all these fuzzy rules in place

from quicktex.

drewcassidy avatar drewcassidy commented on June 18, 2024

This is the default behavior, since a lot of BC1 textures are designed around the transparent pixels being decoded as black. The solution is to pass an instance of BC1Decoder with write_alpha set to true, though I guess that isn't very convenient when using the dds.read function. I'll look into a better solution

from quicktex.

RunDevelopment avatar RunDevelopment commented on June 18, 2024

So the default behavior is to ignore transparent pixels and use black instead? May I ask in what context it is useful to ignore the transparency of DDS images and (effectively) apply a black background?

from quicktex.

drewcassidy avatar drewcassidy commented on June 18, 2024

BC1 is MOSTLY used for images without transparency. This allows for the transparent pixels to be used for black in order to get better quality, a trick quicktex and many other encoders employ

from quicktex.

RunDevelopment avatar RunDevelopment commented on June 18, 2024

Is this behavior covered by the format specification?

from quicktex.

RunDevelopment avatar RunDevelopment commented on June 18, 2024

You are right. It seems like I assumed that DXT1 was more similar to BC1_UNORM_SRGB than it actually is.

from quicktex.

Related Issues (11)

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.