Jump to content
Sign in to follow this  
feersum.endjinn

Png2pac texture conversion tool

Recommended Posts

This is first version of PNG2PAC, only thing actually missing is GUI with preview and actual PNG support tounge_o.gif Current version reads 32 bpp TGA files (RLE compressed files are supported). This small command-line tool uses NVidia's DXT texture compression library, which gives superior quality compared to Texview while files are still same size.

Visual C++ source code is provided, no GUI features are used so probably this can be ported to other compilers as C++ Builder quite easily.

Download it here

Download GUI version here

NVidia DXT library can be downloaded from NVIdia developer pages

Share this post


Link to post
Share on other sites

Hmm ,I didn't realize the conversion process could alter the quality of your textures.I been using O2 to convert...any comparison from that?

Share this post


Link to post
Share on other sites

Probably O2's texture conversion is based on newer code than Texview but I haven't made any tests if quality is better.

Share this post


Link to post
Share on other sites
This small command-line tool uses NVidia's DXT texture compression library, which gives superior quality compared to Texview while files are still same size.

Good observation - yes we noticed this as well, and we will be providing a better texture compression quality with OFP2 tools. I am glad your utility will make texture quality improved for OFP addon makers right now, as our current internal utility with the improved quality is not suitable for release. Goog job.

One more hint: if I recall it correctly, nVidia sources are based on assumption decompression is done in 16-b color space as opposed to 32-b. This leads to unnecessary artifacts when compressing smooth gradiens, and it can be avoided by adapting the source code. Some older nVidia cards really peformed decompression this way, so you will see no improvents on them, but cards of other vendors, and recent nVidia cards as well, perform decompression in 32-b space - you can learn more about this on many web sites, including Epic Games web site.

Share this post


Link to post
Share on other sites

Excellent work feer, very very handy!

Kudos to you my friend smile_o.gif

Share this post


Link to post
Share on other sites
One more hint: if I recall it correctly, nVidia sources are based on assumption decompression is done in 16-b color space as opposed to 32-b. This leads to unnecessary artifacts when compressing smooth gradiens, and it can be avoided by adapting the source code. Some older nVidia cards really peformed decompression this way, so you will see no improvents on them, but cards of other vendors, and recent nVidia cards as well, perform decompression in 32-b space - you can learn more about this on many web sites, including Epic Games web site.

Unfortunately nVidia only provides source code to older version of DXT compression tools which is different codebase (and not actually even written by nVidia), but I'm hopeful that these issues are addressed in binary-only library since latest release is just couple of weeks old.

Now it seems OFP itself recognizes few additional texture formats like DXT2-DXT5, is there support for these formats since using DXT3 or DXT5 would help really cutting down size of textures with more than 1 bit of alpha channel in VRAM. OFP recognizes headers 0xFF02-0xFF05 but when trying use those formats it will display some error message ("invalid texture format (VRAM)" if I remember correctly) and crash OFP back to desktop.

Share this post


Link to post
Share on other sites

wow this is awsome! it actually gets rid of the pixilated crappy texview textures and preserves the original colors.

However the lack of a gui will make it super tedious to use for regular texturing.

Share this post


Link to post
Share on other sites
Quote[/b] ]Now it seems OFP itself recognizes few additional texture formats like DXT2-DXT5

Unfortunatelly, while DXT2-DXT5 (alpha DXT compression)are "recognized", they are not supported and they are not working in OFP1, as their implementation was not finished from our side at that time.

Share this post


Link to post
Share on other sites
Quote[/b] ]Unfortunately nVidia only provides source code to older version of DXT compression tools which is different codebase (and not actually even written by nVidia), but I'm hopeful that these issues are addressed in binary-only library since latest release is just couple of weeks old.

You may also want to try DirectX compression functions. The quality of compresion is very good with DX9 SDK, the usage is quite simple (if you are familiar with DirectX) and they handle 32-bit interpolation.

Share this post


Link to post
Share on other sites

Great, and source code provided, excellent for people who want to learn something from it. smile_o.gif

Share this post


Link to post
Share on other sites
Great, and source code provided, excellent for people who want to learn something from it.  smile_o.gif

Well, at least it is great example of how to not write code: for example compression code there would get you failed grade at any university course dealing with data compression. Brute force algorithm for finding longest match is really bad, it takes about 90 seconds to compress 512x256 texture on my AMD 1600+ tounge_o.gif

Share this post


Link to post
Share on other sites
Quote[/b] ]... compression code there would get you failed ...

I think you cry well, but on the wrong tomb - the brute force code used is the code found on nVidia web site. wow_o.gif

Share this post


Link to post
Share on other sites

Excellant work feersum! This will certainly help improve the quality of all addons.

PS. Iain Banks fan? - I love his books smile_o.gif

SelectThis

Share this post


Link to post
Share on other sites

Great work, and saves time in having to make a texture, convert it, test it to find out how the colours are,then go back and edit the texture...always a nightmare.

Any chance of a new version with a user friendly GUI in the near future though?

Share this post


Link to post
Share on other sites
Quote[/b] ]... compression code there would get you failed  ...

I think you cry well, but on the wrong tomb - the brute force code used is the code found on nVidia web site.  wow_o.gif

Code I'm talking about is one written by me in "compress.cpp", which is used to compress non-DXT1 textures. It's slowest LZ77 implementation I've seen so far, maybe I should be proud of myself tounge_o.gif

nVidias DXT library on the other hand is really fast.

Share this post


Link to post
Share on other sites

And since you've been asking, I made small GUI.

Download it here.

It also gives access to some of the effects provided by nVidias library but most of them aren't that useful, exception being maybe different mipmap filtering options and dithering.

I'm no Windows programming guru, so there's no preview option or support for some of more fancy features found in nVidia library and code is somewhat unstable (won't run at all when compiled on Debug configuration, something to do with different local heaps and callbacks from DXT library not liking each other)...

But it writes out valid .paa's 99% of the time so that's enough for me biggrin_o.gif

Share this post


Link to post
Share on other sites

Either way, it does an excellent job.

Nice work mate smile_o.gif (still)

Share this post


Link to post
Share on other sites
I'm no Windows programming guru, so there's no preview option or support for some of more fancy features found in nVidia library and code is somewhat unstable (won't run at all when compiled on Debug configuration, something to do with different local heaps and callbacks from DXT library not liking each other)...

This may help the mem management - right click on the PAA

project, select properties, and in C/C++ -> CodeGeneration,

set the Runtime Library to Multi-Threaded. This makes sure

that all the libs get their own local heap.

BTW - Use Of Weapons is excellent.

Share this post


Link to post
Share on other sites

First release was missing one MS Visual C++ runtime DLL, but I updated archive this morning and it should work now without any additional .DLL hunting.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×