PikminGuts92 / Mackiloha

A suite of modding software for hacking milo engine based games
MIT License
18 stars 8 forks source link

Rock Band 2 Wii texture transparency bugs (decoding and encoding) #18

Open LlysiX opened 7 months ago

LlysiX commented 7 months ago

When converting png_wii/tex files from Rock Band 2 that have transparency, the alpha channel is lost. Converting these textures back causes a black square to be shown around the texture. tex2png output: rb2_player_meter_background repacked in game representation: image expected: image

When the texture is read/extracted using Dolphin's texture dumper, it is output as 2 separate textures, one matching the tex2png output and another white one (possibly the missing alpha channel?): tex1_256x64_13692c25a38e52c1_14

Converting pngs with transparency to png_wii causes this to happen when loaded in game: image source png: player_meter_background_rb2

PikminGuts92 commented 7 months ago

What's the name and location of texture in the game?

PikminGuts92 commented 7 months ago

I'm gonna assume it's track\textures\gen\rb2_player_meter_background.bmp_wii. I looked at it and it appears there's a hidden alpha data after mip data. Interestingly, it's only for largest mip image. This seems to be indicated by a set of bytes after bytes per line in bitmap header.

https://github.com/PikminGuts92/re-notes/blob/476a86f963e839b898d7814f8d535f37e49c208b/templates/milo/bitmap.bt#L152 https://github.com/PikminGuts92/re-notes/blob/476a86f963e839b898d7814f8d535f37e49c208b/templates/milo/bitmap.bt#L201-L205

RGB image rb2_player_meter_background_noalpha

Alpha image rb2_player_meter_background_alpha

Combined image rb2_player_meter_background

I updated dev branch to properly read in this alpha data. Please test it out and see if that works for you. Note that converting png to png_wii will still use 8bpp encoding instead of this strange alternative.

GitHub Actions Download: https://github.com/PikminGuts92/Mackiloha/actions/runs/8166985000

LlysiX commented 7 months ago

Sorry for not responding, yes track\textures\gen\rb2_player_meter_background.bmp_wii is the file.

I can confirm that all textures that had a missing alpha channel previously now have their alphas intact with this new build.