aboood40091 / XTX-Extractor

Switch 'XTX' Texture Extractor
GNU General Public License v3.0
17 stars 2 forks source link

Warning: colors might mess up!! #2

Open AnalogMan151 opened 6 years ago

AnalogMan151 commented 6 years ago

I'm using this tool to convert XTX files to DDS, edit the image, then reconvert back to XTX again however I am experiencing exactly what the error states, that colors are messed up. I am using Adobe Photoshop with a DDS plugin. Here is an example of the conversion to and from DDS:

XTX to DDS

// ----- NvTextureHeader Info ----- 
  imageSize       = 906240
  alignment       = 512
  width           = 400
  height          = 300
  depth           = 1
  target          = 1
  format          = NVN_FORMAT_RGBA8
  numMips         = 6
  sliceSize       = 906240

  bits per pixel  = 32
  bytes per pixel = 4

Processing 5 mipmaps:
1: 200x150
0x96000
2: 100x75
0xca000
3: 50x37
0xd8000
4: 25x18
0xdc000
5: 12x9
0xdd000

Altered DDS to XTX:

// ----- NvTextureHeader Info ----- 
  imageSize       = 480000
  alignment       = 512
  width           = 400
  height          = 300
  depth           = 1
  target          = 1
  format          = NVN_FORMAT_RGBA8
  numMips         = 1
  sliceSize       = 480000

  bits per pixel  = 32
  bytes per pixel = 4

Warning: colors might mess up!!

I was wondering if you had any recommended save settings to help prevent this or know why this can occur?

AnalogMan151 commented 6 years ago

Actually, converting to DDS, then immediately back to XTX also produces a messed up image, so it looks like it's not just my edits. The official Nintendo tool can convert TGA files to XTX as well with a parameter to declare how many mipmaps there are. Would it be possible to add TGA support too?

niemasd commented 6 years ago

I'm also having issues with messed up colors. I converted a PNG to DDS, and I'm sure the DDS is fine because converting back to PNG was fine. Then, when converting to XTX, the colors are messed up

aboood40091 commented 6 years ago

The warning means you are using ARGB8 instead of ABGR8.

AnalogMan151 commented 6 years ago

I don't see any flags to specify which type. The original XTX file is stored as RGB8, extracts to a RGB8 DDS, then (without edits) reconverts back into an invalid XTX. Does this tool only compile back into ABGR8 and that's the issue? It doesn't support RGB8?