-
Notifications
You must be signed in to change notification settings - Fork 18
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
DDS: BC6H/BC7 support #16
Comments
@nickbabcock |
Thank you for the good read! |
@nickbabcock |
I think I'm going to have to put this issue on hold. I've tried integrating CSharpImageLibrary's BC6/7, but I haven't been able to do it cleanly. I'm sure it's possible, but it does rely on APIs not available to .NET Standard in decoding. Also the first BC7 image I found did not load (but it is certainly impressive that it loaded BC6 nicely). Other libraries that you've found as well (I see you've asked for support in them too 😄 ) don't support BC6/7 -- BC6/7 is difficult. There's obviously a demand, but I feel like if we want a good portable C# implementation, there needs to be a company backing the development. If only Unity open sourced their implementation (afaik they support it)! To complete this issue would take someone with considerably more determism and knowledge in this space, and I fear that I'll easily burn out if given to me. Related, I shudder at what ASTC must take to implement. |
@nickbabcock |
Thanks for the tip, I'm bookmarking those! |
@nickbabcock |
Yeah, time constrained. A lot of projects I maintain. Nice link. I may be wrong, but all the heavy lifting is done through freeimage and nvidia text tools, so I don't know how applicable it is. |
DDS component is standalone, doesn't rely on any element from library. The only connection on DDS side to library - is the Surface class, which is used only when writing DDS to file. But there also Write methods that accept plain stream, so this Write() method which takes library's Surface class as input also can be safety removed. And DDS importer/exporter completely written in C#, so no any depend on nvtt/freeimage at all |
@nickbabcock |
Thank you for your example. I had been thinking that a MonoGame example would be tough, but your example shows that it is easy enough. But then why use Pfim at all when MonoGame supports more formats? (Is MonoGame missing DX10 dds?) |
Because I don't use MonoGame. I writing my own rendering engine :) So Pfim is useful to those, who working on their own game/rendering solutions like me. |
@nickbabcock Just in case, not sure whether I gave you it or not, but some time ago I found another image library that implemented BC6/BC7 - https://github.com/KFreon/CSharpImageLibrary (https://github.com/KFreon/CSharpImageLibrary/tree/master/CSharpImageLibrary/DDS), and seems like its working. But I guess TexImpNet is more preferred solution, because at least author is still supporting it and available for contact, in compare to CSharpImageLibrary which is abandoned. |
Right, I'll need to see how each library does the matrix / vector operations (like how DirectXTex uses DirectXMath). Creating an |
Originally posted by @Krakean in #26 (comment) (contents copied to keep everything in the main thread)
Let me try to help you a bit :) Second, reference library to start with. :) ** - small note about compiling. Its cannot resolve UsefulThings package, so just open 'Manage Nuget Package', uninstall UsefulCsharpThings package, and just type it in 'Browse' and install again. Made a few changes to CSharpImageLibrary, may be it will help you just a bit: |
@Krakean, if you want, you can try integrating the BC6/BC7 logic into Pfim and I can test it out along the way. It seems that if DirectXTex is continuously updated, then there'll need to be a long term BC6/BC7 champion in Pfim in order to keep up with the updates. |
All I can do is just take CsharpImageLibrary's DDS sources, place it somewhere in Pfim, and use its dds loading function for BC6H/BC7. It will be very rough and unpleasant approach. So to be honest better you as library author decide how you would like to integrate it. As-is for beginning, or more smoothly integrate it into current Pfim structures/logic/architecture (which you know better than I do).
Yes, it is. But translating from C++ to C# will take much more time, than integrating already working solution in case with CSharpImageLibrary (CSIL, for short). For you to get as fast working result as possible - a) is preferred. In long-play c) is better (may be) P.S. Dont forget to bring MonoGame-based example to Pfim samples [instead of or in addition to WinForms-based sample], so at least BC6/7 can be tested in their "natural" environment which is gfx hardware :) But even for DXT-based dds it will be good too, for consistency. |
I think you are being modest. It would be a huge boon if you could integrate CSIL and verify BC6H / BC7 images work. Even if the code isn't perfect, we can iteratively massage it to fit. Ah yes, MonoGame, I'll put it on my todo list (thanks for the example again) |
Well, if you will upload MonoGame-based example adapted to Pfim needs, then I'll have testbed for testing them (because BC6H/BC7 cant be displayed in current Pfim.Viewer), and then I can try to make initial dirty, but careful, work on integrating CSIL's DDS into Pfim :) |
For my curiosity, why is that? I figured if other dds formats can be displayed with Pfim.Viewer, why can't BC6H and BC7? |
It does not support drawing compressed GPU formats, since it uses a System.Drawing-like API not a rendering API like D3D11, so a block compressed format would have to be decompressed before drawn.
|
Right. DXT 1/3/5 are block compressed and are decompressed before displaying in Pfim.Viewer -- or am I missing something? |
@nickbabcock Loading currently made in very hacky way: https://i.imgur.com/7WJW0Tb.png Or, in my case better is to give you current state of work as it-is (at least, it is working), and you can finish the rest and impart all of this the final form within Pfim? |
Is there any update on this? Thank you. |
https://nofile.io/f/Oa1YSoHmwqX/BC7files.rar (BC7 files only)
If you need more, here you can download Compressonator (https://github.com/GPUOpen-Tools/Compressonator/releases) and produce BC7/BC6H files by yourself.
Also, useful command line examples (since GUI is kinda sux) - https://github.com/GPUOpen-Tools/Compressonator/blob/master/Compressonator/RunTime/example.bat
Hopefully not too much issues for one day :)
P.S. Didn't saw any C# dds reader that support BC6H/BC7. Plenty in C++, but none in C# :( Hopefully Pfim will be first one :)
P.P.S BC6/7 specification:
The text was updated successfully, but these errors were encountered: