microsoft / DirectXTex

DirectXTex texture processing library
https://walbourn.github.io/directxtex/
MIT License
1.74k stars 425 forks source link

D3DFMT_X8L8V8U8 support #485

Open iMrShadow opened 5 days ago

iMrShadow commented 5 days ago

Hello! I am working on a texture converter, which extracts texture data from proprietary game files to DDS, and vice versa. The project is built with Avalonia UI, so I am using a wrapper of DirectXTex. Additionally, I have an image previewer in order for users to preview the textures they are converting.

The way the previewer works is to load the image using DirectXTex, convert it to raw pixel data and encode it in PNG format, because Avalonia's UI Image control only loads PNG files.

That worked great, until recently, I stumbled upon older textures using D3DFMT_X8L8V8U8, which is not supported by the library. Encoding is not really a priority, since noone will edit these types of textures (and there are alternative ways to create bumpmaps for those games), but being able to preview them would be nice.

One additional side question: Is there any more information regarding textures using the CTX1 (Xbox 360) compression? There's very limited material available, I am curious about it

Thanks

walbourn commented 4 days ago

Do you have an example D3DFMT_X8L8V8U8 texture to share?

What format would you expect BumpDuDv and BumpLuminance files to load as? Luminance would normally be loaded as a monochromatic format. The main problem is that in Direct3D 9 these are mixes of unsigned and signed channels, so they really don't work with any DXGI format like that.

CTX1 is a proprietary compression so I don't believe details on it are public.

Note that D3DFMT_CxV8U8 could be loaded as DXGI_FORMAT_R8G8B8A8_SNORM, but I've never seen such a file.

iMrShadow commented 4 days ago

Here are some examples (I could provide more if needed) X8L8V8U8_Textures.zip

As for loading - I have seen NVIDIA's Texture Tool loading them correctly as RGBA, with alpha channel being 1. Maybe it can function similarly, but I am not knowledgable enough on this topic. I could provide screenshots on what the bumpmaps look like from their tool