WalkerMx / AutoCrispy

Automatically apply AI Upscaling on Dumped Textures
GNU General Public License v3.0
100 stars 9 forks source link

Normal maps #13

Closed ziher123 closed 1 year ago

ziher123 commented 1 year ago

Hi, i'm having problems upscaling normal maps with texconv>SRMD>texconv. Low RGB values get premultiplied into normal map from alpha specular (for Skyrim). So the normal map ends up broken if specularity on alpha channel is dark. I tried every combination of texconv alpha settings but couldn't get this resolved. I also have problems with resulting filenames, any longer name gets truncated like, for example: texturemain.dds filename gets truncated into textur~1.dds which makes batch conversion of certain files not practical.

WalkerMx commented 1 year ago

Hey there.

I'm not sure about the normal maps - I think I've implemented all of the texconv features related to Alpha already.

If you'd like, if you can figure how to do your normal maps with TexConv and determine which features you need, I will implement them into AutoCrispy.

About the filenames being truncated - I'm pretty sure I know why it does that, and I think I can fix it. Hopefully, I can have this done pretty soon.

WalkerMx commented 1 year ago

Hello, an update for you.

I believe I've solved the truncated path issue. Find attached a Beta version of AutoCrispy to test.

Please let me know if this solves that issue. If so, I can add this change to the next release.

Also, have you made any progress with your Normal Maps? I was thinking that using the DXT5 format and Feature Level 11.1 on the input, then using the DXT5 format, Feature Level 11.1, checking Premultiply Alpha, and setting Force Dx10 on the output might work.

AutoCrispy (BETA).zip

ziher123 commented 1 year ago

Thanks, beta fixed file names:) As for normals no luck, if i convert manually with texconv using these command lines it works fine: texconv.exe -f R32G32B32A32_FLOAT -nologo -y -o .\out2 .dds //for input texconv.exe -f B8G8R8A8_UNORM -nologo -y -o .\out .dds //for output (any other common type like DXT5, BC7_UNORM also works) Resulting normal example with specular (right) on alpha channel: https://i.postimg.cc/LX0zfZ6h/examp1.jpg

Running it through chaining with same settings or any other i tried (without upscaler) makes bad output normals like this (it even bakes max alpha RGB values into normal): https://i.postimg.cc/hvzV0Pfs/examp2.jpg

WalkerMx commented 1 year ago

texconv.exe -f R32G32B32A32_FLOAT -nologo -y -o .\out2 .dds //for input texconv.exe -f B8G8R8A8_UNORM -nologo -y -o .\out .dds //for output

I notice, neither of your commands specify -ft (file type)... Which means, you're converting .dds --> .dds --> .dds with those commands.

Does it still work, if you specify, say, "-ft png" for the input command?

WalkerMx commented 1 year ago

If you'd like, I believe you can Zip one of your normal maps and attach it to your reply.

I don't mind helping you look in to this!

ziher123 commented 1 year ago

Thanks for help, appreciated.

I tried again with these two and result turned ok: texconv.exe -f B8G8R8A8_UNORM -ft png -nologo -y -o .\out2 .dds texconv.exe -f B8G8R8A8_UNORM -nologo -y -o .\out .png

Here's example normal in BC7 bell_n.zip

WalkerMx commented 1 year ago

Alright, I believe I've solved the issue!

Find attached, another beta copy of AutoCrispy, and let me know if this solves it for you!

AutoCrispy (BETA).zip

WalkerMx commented 1 year ago

When you get a chance, check out the latest release - I believe, these issues will all be resolved.

Thanks for bringing these to my attention!

ziher123 commented 1 year ago

It worked, although i had to add another step to get correct brightness out. I tried these chaining combinations:

R32G32B32A32_FLOAT in >> B8G8R8A8_UNORM out //works R32G32B32A32_FLOAT in > SRMD upscaler PNG > B8G8R8A8_UNORM out //output image is correct brightness but alpha is missing (any float mode at input will have missing alpha after upscaler) B8G8R8A8_UNORM in > SRMD upscaler PNG > B8G8R8A8_UNORM out //alpha is present but output image brightness is incorrect (too dark). This goes for any non-float mode. (maybe i'm doing something wrong here?) B8G8R8A8_UNORM in > SRMD upscaler PNG > R32G32B32A32_FLOAT out > B8G8R8A8_UNORM out //this combo works:) Output brightness is correct and has alpha channel.

WalkerMx commented 1 year ago

Great, I'm glad this all worked out!