vn-tools / arc_unpacker

CLI tool for extracting images and sounds from visual novels.
GNU General Public License v3.0
573 stars 83 forks source link

Possible problem with GXT file alpha? #25

Closed DaZombieKiller closed 8 years ago

DaZombieKiller commented 8 years ago

In Steins;Gate 0, the font files (FONT.GXT and FONT2.GXT), when converted to PNG, have completely opaque black backgrounds, which looks incorrect ingame:

The correct appearance would be the following:

rr- commented 8 years ago

It's a mystery. Observations:

  1. There's a chance that the file is supposed to encode one color, e.g. white, and the whole rest is a giant alpha mask. But this is unlikely, because...
  2. The correct text has dark border, i.e. the giant alpha mask theory doesn't seem legit. This can mean two things
    1. The image contains the border, but there is an additional alpha channel somewhere in the file which I don't read (unlikely, just checked the file)
    2. The border could have been created by the game engine itself (in which case the alpha mask theory has some justification)
  3. There's also option that if the image is a GXT image then it's treated as an alpha mask, and for PNG the game expects them to have their own alpha channel.

Let's confirm some things. First, let's test if the black borders are created by the game, or are read from the GXT files. Could you post a screenshot what happens if you replace FONT and FONT2 with these?

Note: these images appear to contain nothing, but in fact they contain white text with transparent background (= white on this page). This should become more evident once you open them in a new window.

FONT.png out FONT2.png out2

DaZombieKiller commented 8 years ago

it appears the outlines are generated by the engine

rr- commented 8 years ago

This means either

  1. The whole image has a matte color, and the rest is just a giant alpha mask. This is very unlikely, as I found no evidence of this in either GXT specification or in the file itself.
  2. The more probable option is that GXT are treated as masks to white color by the engine itself, and if the font is encoded as PNG, the game expects it to have alpha mask on its own.

Closing this as I suspect the option 2 is the right one, in which case you should just preprocess the PNG like above. Should you find more GXT problematic images, do not hesitate to add new issues.