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

[Feature request] Support for .dds custom texture format? #1517

Open
Nerrel opened this Issue Jun 30, 2017 · 9 comments

Comments

Projects
None yet
4 participants
@Nerrel
Copy link

Nerrel commented Jun 30, 2017

I've searched and found no real information about supported texture formats, but .png is the only one I've gotten to work. DDS is generally supposed to be faster and if it were supported I could dramatically reduce the file size of some of the textures I'm working on, since even at max compression png files can still be very large. For example, one of the largest single textures I have is 2.7mb using .png with max compression, which is huge. Using DDS with DTX5 compression, the same file is 900kb with minimal quality loss. This would be a great help, since my only other option for reducing file sizes is to lower the texture resolution, which would dramatically drop the quality in some cases.

Is support for .dds textures something that would be practical to add at some point? Thanks.

@gonetz

This comment has been minimized.

Copy link
Owner

gonetz commented Jun 30, 2017

It does not matter, which format texture pack uses. Texture data will be converted to appropriate OpenGL format before use. It is possible to use compressed OpenGL texture formats too, but I removed compressed textures support because it causes noticeable quality degradation.

@Nerrel

This comment has been minimized.

Copy link
Author

Nerrel commented Jul 2, 2017

Thanks for the answer. I understand that .dds wouldn't provide a speed advantage in this case, but it would still be useful on my end as a texture creator by giving better flexibility when it comes to file sizes. Like I said, I really can't do anything to reduce the size of png textures beyond scaling them down dramatically. I'm 1/5 of the way through a Majora's Mask pack and the size is already 200mb on disk; with dds it would probably be well under 100mb. If it's something trivial to implement, I'd appreciate having dds as an option. If it isn't a trivial thing to implement, then by all means ignore this request.

@gonetz

This comment has been minimized.

Copy link
Owner

gonetz commented Jul 3, 2017

It can't be trivial. Png format is used for textures because it suits well for this task. Special powerful library is used to work with texture data, pnglib. Even with this library things are not easy.

@Nes-player4Life

This comment has been minimized.

Copy link

Nes-player4Life commented Jul 8, 2017

Maybe this would be a thought for a branch version development.

@ghost

This comment has been minimized.

Copy link

ghost commented Jul 16, 2017

DDS doesnt support paletted textures, only RGB and up textures.

@gonetz

This comment has been minimized.

Copy link
Owner

gonetz commented Jul 17, 2017

Lack of paletted textures support is not a problem. I don't remember a texture pack, which actually has paletted textures. Alpha channel is really important. If DDS supports only RGB, it is useless as texture format.

@ghost

This comment has been minimized.

Copy link

ghost commented Jul 23, 2017

no, it can support RGBA as well. Many, many modern games use DXT compression, however there is more modern GPU texture compression formats. I thought the Rice texture pack specs had usage of CI textures, which are palletized.

@BigheadSMZ

This comment has been minimized.

Copy link

BigheadSMZ commented Jan 3, 2018

DDS support would be great to have eventually, it has several advantages over PNG, the biggest being reduced RAM consumption. There are several types of DDS block compression, but the ones we should be most concerned with are DXT1, DXT5, BC7, and the uncompressed ARGB_8888.

To illustrate my points, lets use for example a 2048x2048 custom texture. As a PNG texture, this will consume 16MB of VRAM. The GPU also has to decode the pixels before its usable, so there is a delay when it is uploaded to the GPU. If you have many textures, you can see how this can quickly become a bottleneck.

DXT1 is the most lightweight of the bunch and is a D3D9 format. It only supports 1-bit alpha, but it consumes by far the least amount of RAM. This means DXT1 is ideal for textures without alpha. The requirement is only 1/8th of PNG, so in VRAM the same 2048x2048 texture will only consume 2MB.

DXT5 has full support for alpha, is also a D3D9 format, and has 1/4th the requirements of PNG. The same 2048x2048 texture will consume 4MB of VRAM.

BC7 is a newer format, and is only supported on DX11/OGL4 GPUs. This has the same requirements as DXT5, although with much less compression artifacts. Think of BC7 as the DXT5 replacement for modern graphics cards.

ARGB_8888 (aka ARGB32) is also a D3D9 format, but it does have a DX10 equivalent- B8G8R8A8. This is an uncompressed format, and has quality that is identical to PNG. The advantage here is loading speed: the pixels are already in a format that does not need to be decoded by the GPU. The disadvantage, is the VRAM requirement is the same as PNG, a 2048x2048 texture will consume 16MB of VRAM.

So the breakdown of the advantages:

  • DDS textures are decoded much faster on the GPU eliminating custom texture stutter.
  • DDS textures require far less VRAM, anywhere from 1/8th to 1/4th the requirement of PNG.
  • DDS texture compress much better in zip/rar/7z, meaning a smaller file to upload for pack creators.
  • DDS textures can have all mipmaps built-in, meaning only a single file for a texture and all mipmaps.

And the disadvantages:

  • DDS textures are usually larger on the hard drive than PNG.
  • DDS textures have reduced quality over PNG (although this quickly outweighs the RAM consumption).

I have created an example of quality comparisons here (I work on texture packs for Dolphin).
https://i.imgur.com/81uVfwI.png

@gonetz

This comment has been minimized.

Copy link
Owner

gonetz commented Jan 3, 2018

@BigheadSMZ Thanks for deep explanation of DDS format advantages. However,
"It does not matter, which format texture pack uses. Texture data will be converted to appropriate OpenGL format before use. It is possible to use compressed OpenGL texture formats too, but I removed compressed textures support because it causes noticeable quality degradation."
If it is not clear, GLideNHQ texture cache does not use png, it uses uncompressed OpenGL texture formats, but texture data is zipped to reduce RAM consumption.
May be BC7 format support will be added someday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.