[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
    64
    27
    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
    64
    27
    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
    64
    27
    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!
     
  4. netnei

    netnei Newbie

    Newcomer
    7
    0
    Aug 27, 2017
    United States
    Hey man, I hate the necropost but I've been having a similar issue and I was hoping you could help me out. I've been trying to rip the models from Dragon Quest Monsters: Joker 3, but for some reason that I can't figure out whenever I open the .bch files in ohana3ds rebirth massive portions are totally transparent. I saw your post on a similar topic and tried using the bch2png.exe converter you linked but that didn't seem to have much of an effect. I'm a total newbie to all of this so I have essentially zero clue what's going on, however I did try to follow your instructions in the aforementioned thread regarding adjusting the color curve of the alpha channel in order to make the transparent section
    s visible, both the pngs exported by ohana and bch2png.exe did not have alpha channels, and adjudting the color curve of the RGB channels didn't seem to produce any results.

    I really appreciate the instructions you've left in your posts, even though they didn't help me with this issue specifically I've learned a lot from then for future endeavors.

    I've attatched one of the offending .bch files and what seems to be a corresponding texture file found in a folder called "Masks" if you want to take a look at the problem yourself.

    I hope you can help here, I'm sorry I can't describe the problem in more detail, again I don't have much of an idea of what I'm doing. If you can help me solve this I will literally worship you.
     

    Attached Files: