TerraformersMC / Terrestria

A Fabric mod enhancing the detail of Minecraft with unique and vibrant biomes. Inspired by ExtrabiomesXL.
https://www.curseforge.com/minecraft/mc-mods/terrestria
GNU Lesser General Public License v3.0
201 stars 43 forks source link

compress all textures #83

Closed reoseah closed 5 years ago

reoseah commented 5 years ago

compressed all images (used freeware PNGGauntlet)

liach commented 5 years ago

Does it decrease bit depth? If yes, that would be catastrophic

NeusFear commented 5 years ago

I have done some research on the program and it does seem like it makes the images 8bit, which as liach stated isn't great for us.

NeusFear commented 5 years ago

What compression option did you use?

reoseah commented 5 years ago

default ones xD Снимок Снимок2

by the way, I just quickly run it just as experiment after seeing coderbot's post in discord

coderbotСегодня, в 0:31 Terrestria is 1MB because there's like 150 16x16 textures

NeusFear commented 5 years ago

I think that I'll convert this into an issue instead of a pull request, We do need to look into compression, but I dont think that this option is the best at the time. There are more lossless methods to image compression that we will look into in the future. Thanks for the PR, but we may have to look into a more lossless way of doing it.

NeusFear commented 5 years ago

We can discuss image compression options here: https://github.com/TerraformersMC/Terrestria/issues/84

falkreon commented 4 years ago

IMO this should have been merged; PNGGauntlet and OptiPNG are both completely lossless.

Prospector commented 4 years ago

Does it preserve the color of fully transparent pixels? I remember having loads of issues with texture compression in the past because minecraft uses the color of fully transparent pixels and most of these nuke them for optimization.

NeusFear commented 4 years ago

Yeah I was going to mention that

unascribed commented 4 years ago

OptiPNG and possibly PNGGauntlet "reduce bit depth" by detecting existing palettes and making use of paletted mode; it's lossless.

What you're mentioning with opaque pixels is not these optimizers being lossy, or Minecraft using information they remove; it's a longstanding bug in ImageIO's PNG loader related to transparent colors in palette mode. Toolkit does not exhibit this behavior, and neither does the sixlegs PNG decoder from long ago.

The only good way to deal with this is disable palettization; in OptiPNG this can be done with -nx

coderbot16 commented 4 years ago

It could make sense to just apply compression to opaque textures, since those won't result in issues when compressed with OptiPNG.

NeusFear commented 4 years ago

That is an option.

reoseah commented 4 years ago

In PNGGauntlet there's no OptiPNG settings exposed apart from optimization level, unfortunately. There's a bug in OptiPNG in that if you'll run PNGGauntlet second time on same images it still converts them to paletted mode. You'll have to go to OptiPNG settings and either disable it at all, or set optimization level to 0.

Without palletization it makes png files about 1.5-2 times larger, but that's still about 4 times less than when Photoshop saves.