marco-calautti / Rainbow

A texture format converter for different consoles' graphics formats.
GNU General Public License v2.0
83 stars 8 forks source link

[Request] Adding the import/save feature for .nut files #21

Open rikool050 opened 3 years ago

rikool050 commented 3 years ago

Hello, I discovered your nice tool two days ago. I used it to export some textures from files of Donkey Konga 3.

Exporting is fine, but because import isn't implemented I tried to implement it. After 1 day and half of fails, I decided to create a new issue.

Here are my "best" pictures using import :

encoded_x(4_for_x4_ix1_color1

encoded_x1_for_x8_ix1_color1

ddd

And here is the original : original

This is the original nut file : select_tex.zip

I tried to understand your wiki page on the NUT File Format but unfortunately I understood nothing.

My final goal is to translate Donkey Konga 3. Cause it was released only in Japan.

So could you please add the import feature and possibly add the save feature, it would be amazing !

If you have any questions I would be glad to answer you.

Best regards

marco-calautti commented 3 years ago

Hi, and thanks for your message! The main part that is not implemented is the DXT1 encoder. This is quite a complex image format, that requires some better study on how to optimally lossy-encode the blocks. The other issue is that there seems to be some legal restrictions on implementing encoders for this format, as there is a patent on the format. So, making open source encoders for this format is tricky. I was considering the option to rely on external encoders, like nvidia's but this would not work for the DXT1 variant the Game Cube/Wii use.

rikool050 commented 3 years ago

Hi, and again thanks for your tool !

Legal restrictions are only for encoder but not decoder ?

So if a day, you succeed in implementing the encoder it could be difficult to release the code because of legal restrictions. I tried to find some articles about "DXT1 encoder open source" but didn't find interesting stuff.

Aside I tried to extract textures from .nut with a python tool but it isn't easy. I can find info about the first texture but I'm not able to reach the second one. I read that usually .nut had .dds files so I thought I would be able to extract those .dds modify them then do the opposite way but without success. But maybe that not all .nut files have .dds. Cause I saw that "NTWU" was .nut too.

And it wouldn't be possible to use the nvidia one and add some exceptions to be able to use it on Gamecube/Wii .nut files ?

Best regards.

marco-calautti commented 3 years ago

The point is that the DXT1 codec the Gamecube/Wii use is slightly different than the standard PC one, so using an off-the-shelf decoder will not work. That is why I ended up implementing my own decoder (in the same way as the Dolphin emulator does).

I do not understand all the legal details, but I guess, since the Gamecube/Wii DXT1 codec is slightly different than the standard one, all these legal restrictions might not apply, but I am not sure about that.

radioshadow commented 1 year ago

Is there any reason you couldn't use this "Goofy - Realtime DXT1/ETC1 encoder"? https://github.com/SergeyMakeev/Goofy

Brian151 commented 1 year ago

Legal restrictions are only for encoder but not decoder ?

not unlike the author/development tools costing a small fortune [now via nickle-dime subscription services...grr] while it's cheap/free to access/use the files made for them. swf [somewhat, you don't need flash/animate for everything anymore] , pdf, game engines, etc...

that said, software patents are the worst and some countries had the brains to recognize this, rendering them invalid. other countries [USA still being one, yay for my right to deny someone else theirs!] unfortunately still recognize them. there's efforts and court cases every now and again to challenge/change that. sadly, the US PTO has a track record of complete lack of due diligence, so even the patent classifications that are not legal still get approved and require legal battles to overturn. [a certain DMCA issue is the same story. red flags everywere and none of those with legal reaposibility/obligation to fact-check have done so.]

the encoder would be patented so, we'll just say "DX1Shop" can be a patented product/serivce made by "DX1Ware" and sold for a $1k lifetime license or now like $20/m or whatever the going rate is. and if anyone else wants to use it, they can charge some 6-7 digit license fee + royalties and bind the other developers to an NDA. fun, huh?

bit of a textwall and a biit unrelated, but yeh, but hope that helps!

NewGBAXL commented 1 year ago

I am also working with Donkey Konga 3 textures, and I was wondering if it would be possible to copy/paste/move unmodified textures from File A Index 123 to File B Index 456. The textures wouldn't be modified so there should not be any need to encode or decode them, just copy the raw data.

rikool050 commented 10 months ago

Hi @NewGBAXL that's what I started to do at some point when I would still work on it. I'd use Hex Editor, to change some graphical Japanese texts to English ones.

As long as the size is the same it will/should work yeah !

radioshadow commented 3 months ago

@marco-calautti

So a tool has been made that does allow you to save the edited graphics into the .nut file (https://github.com/JosephS068/Donkey-Konga-2-Texture-Editor). Granted, it doesn't always import the correct colors, and issues with transparency, but I have raised this issue.

They have released the source code for the tool. Maybe you could use the DXT1 codec for this tool?