[Help] Extracting textures from BCH; alpha channel & ETC1A4

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by HelpTheWretched, Mar 16, 2017.

  1. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    57
    25
    Feb 4, 2010
    Canada
    I'm using Ohana3DS Rebirth to extract and replace textures from .bch files from Zelda: Tri Force Heroes. The textures are ETC1A4 encoded, but the alpha channels seem strangely tied to the brightness, so darker colours are coming out more transparent. Some dark parts are completely transparent.

    On the left: The extracted .png
    On the right: That .png flattened to 100% opacity, showing the "gaps"
    [​IMG]

    I tried editing that .png without flattening it by adjusting the hue in certain sections, and replacing it in the .bch.

    In the game, it works okay but you can see some of those completely transparent parts showing up as black, like on Link's palms and some little bits on the brim of his cap.
    [​IMG]

    Does anybody know what's up with the alpha channel on those textures or another way to extract them from the .bch?


    I have an unrelated issue with replacing sounds in this game, just gonna link to it here since it's had no replies yet.
     
  2. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    57
    25
    Feb 4, 2010
    Canada
    *BUMP*

    This issue is resolved. If anyone is interested, the problem was threefold:

    1. These were ETC1-encoded textures (no alpha channel), possibly being misread as ETC1(A4).
    2. Ohana3DS Rebirth was discarding the colour data of the 100% transparent spots when exporting the textures.
    3. My image editing environment would have also discarded that colour data.

    So to get around this, first I found a BCH2PNG program. It wasn't smealum's Python script, as that didn't seem to work for me (even after installing the imaging library), but a Windows EXE whose origin I can't remember. Drag & drop any BCH files into its window and it spits out PNG textures. They still had the partial-transparency issue, but the colour data for the invisible spots was retained. Then I loaded them with GIMP and used the Colors -> Curves feature to reduce the alpha channel to nothing.

    The only problem was that BCH2PNG program spat out just the top mip-level of each texture (there are 4 for each of Link's outfits), but the missing ones could easily be created after making the edits by making 3 copies of the texture and resizing them to 1/2, 1/4, and 1/8 size.
     
  3. HelpTheWretched
    OP

    HelpTheWretched Advanced Member

    Newcomer
    57
    25
    Feb 4, 2010
    Canada
    *BUMP with more info*

    Just in case anyone's interested, I found out something else. It turns out #1 on the last post's 3 problems was not true. Ohana 3DS Rebirth was correctly reading the textures as ETC1(A4)-encoded, and the strange alpha channels with the assorted transparent spots were actually intended.

    But the alpha channels weren't controlling the textures' transparency in the game - they were controlling the specularity. When I tried replacing some textures with my edits, I inserted them at full opacity thinking it wouldn't matter. When the game loaded the models with these edits, they were very shiny!