microsoft / DirectXTex

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

Texconv, error when converting BC5 to .png #146

Closed dsnyder-bsi closed 5 years ago

dsnyder-bsi commented 5 years ago

After converting a 3-channel .png to a BC5 .dds using Texconv, i tried converting the .dds back to a .png from a command line. i get the following error message "FAILED (80070032)". Doing an internet search for that error number doesn't help me much.

However, I am able to convert the BC5 .dds to .png using Visual Studio. The BC5 .dds file looks good in Visual Studio.

I've tried all sorts of command line options, including the following simple command line, but no luck: texconv -ft png XXX.dds

I have attached a .zip of a BC5 .dds that is not working for me. Helmet_CbCr_Mip1_BC5.zip

Does anyone have a clue what is going wrong, here?

Thanks, Doug

walbourn commented 5 years ago

The error is an HRESULT which translates to ERROR_NOT_SUPPORTED.

Basically, you can't write BC5 format to a .png. What you need to do is provide a target pixel format that is supported by png:

texconv -ft png -f rgba XXX.dds

See the wiki.

dsnyder-bsi commented 5 years ago

Is this just a shortcoming of Texconv? Visual Studio can convert BC5 to .png, so it doesn't seem to be a fundamental problem with BC5, PNG or DDS. a 2-plane BC5 can be combined with a 0-filled plane and then written to a 3-plane PNG. This appears to be what Visual Studio is doing.

Shouldn't this functionality be added to Texconv as a way to visual a BC5 encoding?

are there formats other than PNG that Texconv supports for exporting from BC5?

doug

On Tue, Aug 6, 2019 at 3:45 PM Chuck Walbourn notifications@github.com wrote:

The error is an HRESULT which translates to ERROR_NOT_SUPPORTED.

Basically, you can't write BC5 format to a .png. What you need to do is provide a target pixel format that is supported by png:

texconv -ft png -f rgba XXX.dds

See the wiki https://github.com/microsoft/DirectXTex/wiki/Texconv.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/DirectXTex/issues/146?email_source=notifications&email_token=AB5YSZIHPUKVL4YVJTNXSFLQDH5HPA5CNFSM4IJOPL72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3WVRCQ#issuecomment-518871178, or mute the thread https://github.com/notifications/unsubscribe-auth/AB5YSZJEFGIU6CLETMWRTCDQDH5HPANCNFSM4IJOPL7Q .

walbourn commented 5 years ago

Visual Studio is actually using DirectXTex so will produce the same result.

This is mostly a matter of how the texconv command-line tool has historically worked from the legacy DirectX SDK. If you don't provide the -f argument, it assumes you don't want to change the target format.