TimvanScherpenzeel / texture-compressor

CLI tool for texture compression using ASTC, ETC, PVRTC and S3TC in a KTX container.
MIT License
200 stars 40 forks source link

[BREAKING] Major refactor and port of texture-compressor to Typescript #21

Closed TimvanScherpenzeel closed 5 years ago

TimvanScherpenzeel commented 5 years ago

This PR incorporates a private fork of the repo (alpine-texture-packer) into the public repo. The API has changed quite significantly and makes less assumptions about quality and compression. The application is now embeddable from within another application (as explained in the README).

TimvanScherpenzeel commented 5 years ago

If you have any feedback or suggestions please let me know!

Makio64 commented 5 years ago

Thanks for the update!

Fews things in my mind :

Thanks again !

TimvanScherpenzeel commented 5 years ago

Thanks @Makio64,

Have an exhaustive list of the parameters like "astcmedium".

What I've done is that the CLI dynamically supports certain parameters based on the current ones selected which means that if you pass -t s3tc it will limit the other possible compression parameters to DXT1,DXT1A,DXT3,DXT5 for example. I think it is an improvement in that sense but it definitely can't hurt to document all general parameters (for tool-specific parameters I would recommend referring to the tool manuals).

➜  texture-compressor git:(typescript-port) node ./bin/texture-compressor.js -i input/example.png -t s3tc
usage: texture-compressor.js [-h] [-v] [-i INPUT] -o OUTPUT -t
                             {astc,etc,pvr,s3tc} -c {DXT1,DXT1A,DXT3,DXT5} -q
                             {superfast,fast,normal,better,uber} [-m] [-y]
                             [-f [FLAGS [FLAGS ...]]] [-vb]

texture-compressor.js: error: Argument "-o/--output" is required

Provide configuration for what you think the best balance in term of quality/size.

I feel like I don't have enough production experience yet myself to give solid recommendations however if anyone else could help document their experiences that would be great. I will be able to give some initial recommendations.

Not totally related but did you have any problem with the normal map after compression? (looking really terriblewith alot of artefact). I wonder if this version will fix it.

I haven't tried this yet myself but from what I've read online it is generally not recommended to apply usual compression techniques on normal maps without special care as it can introduce a lot of errors. Under the hood I'm using https://github.com/BinomialLLC/crunch and https://www.imgtec.com/developers/powervr-sdk-tools/pvrtextool/, perhaps there is more information online regarding normal map compression.

Unfortunately this version does not change anything in the underlying binaries (that handle to compressing) but only the Typescript wrapper around it.

TimvanScherpenzeel commented 5 years ago

Update:

Have an exhaustive list of the parameters like "astcmedium".

Added a document that shows all parameters: https://github.com/TimvanScherpenzeel/texture-compressor/blob/typescript-port/docs/SUPPORTED_PARAMETERS.md. These you can also find in the source code constants: https://github.com/TimvanScherpenzeel/texture-compressor/blob/typescript-port/lib/constants.ts. For a explanation what these settings really mean you will have to dig into the referred tooling documentation.

TimvanScherpenzeel commented 5 years ago

Update:

Provide configuration for what you think the best balance in term of quality/size.

Added a document that shows my recommendations in terms of speed and quality. Please note that they are my personal preferences and I'm open for suggestions 👍

https://github.com/TimvanScherpenzeel/texture-compressor/blob/typescript-port/docs/RECOMMENDED_PARAMETERS.md