Create CGFX from OBJ+PNG

Discussion in '3DS - ROM Hacking, Translations and Utilities' started by MDashK, Aug 16, 2015.

  1. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    Sorry if I'm posting this is the wrong section...
    If so, please any MOD move it.

    Anyone knows how to convert an OBJ+PNG objects to CGFX to be used in a Banner.bnr file?

    Already tried to open CGFX with EveryFileExplorer, but always get an error.
    BannerTool doesn't seem to support creating a CGFX file with a OBJ and PNG files to convert to banner.bnr...

    Specifically, I'm trying to change the GameGear VC banner so that one can change the image/title screen shown in the banner, but keep the rest intact.
    I managed to extract the CGFX content, and got 1 OBJ file (I assume it's the gamegear animation) and 2 PNG files (1 is the console textures, other is the title screen that I want to change).
    The problem now is getting everything back up into a CGFX.
    EveryFileExplorer doesn't let me create the CGFX from the OBJ, because it states that "Model without materials not supported!"

    Best regards,
     
    Last edited by MDashK, Aug 16, 2015
  2. dfsa3fdvc1

    dfsa3fdvc1 GBAtemp Regular

    Member
    228
    104
    Jan 3, 2015
    Albania
    How to delete comments?
     
    Last edited by dfsa3fdvc1, Aug 16, 2015
  3. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    OK, so I managed to find out that EveryFileExplorer will open the CGFX by drag-droping the file into it.
    Now, other 2 problems have arrised:

    1) I am able to create the bcres/cgfx animation, but... When I open the original, it shows up like this:

    [​IMG]

    You can clearly see the image I am trying to replace.
    When I open the newly created one with EFE, it looks like this:

    [​IMG]

    Meaning: Something is wrong...

    2) Another problem: EFE doesn't seem to acknowledge that the original CGFX file has Skeleton Animations. So when I export the Model to DAE/OBJ, the skeletal animation doesn't go with it. Only the textures...
    UPDATE: Found my answer to this here: http://gbatemp.net/threads/how-edit-a-gbc-banner.389807/#post-5517874

    BR,
     
    Last edited by MDashK, Aug 17, 2015
  4. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    You wanna modify the model?
     
  5. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    No, I just want to replace the title screen texture.
     
  6. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    Then replace the texture data in the origin file is OK. First check out the origin color format.
     
  7. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    OK. How do I do that? How do I replace the texture in the original CGFX file of the banner?
    I haven't had much luck with most of the tools available and replacing by HEX modification using WinHEX seems to be complicated, since I can't pinpoint the location of the texture I want in the CGFX. Also, I would have to convert the PNG to CGFX prior of injecting in the CGFX banner file, and all the converters from PNG to CGFX that I have found have limitations to the size of the PNG image...
     
  8. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    First use Texturipper to extract textures in the origin file, you can get format and texture data offset in the txt file. Then use this tool to generate a raw texture data file. Use WinHEX to do replace work is OK.
     
  9. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    I already had the textures extracted, but a new tool is always good to have.
    Also, the output of the texture I want to replace in the TXT file is:

    type:20000011 tformat:03 tofs:0000FD00 size:00008000 ofs:00001F14 format:00006754 formattype:00008363 mipmap:00000001 texobj:00000000 locflag:00000000
    name:COMMON2 revision:05000000 udictcount:00000000 udictOffset:00000000 w:128 h:128

    But the tool to convert to RAW texture asks me these options:

    Target Format: L8 A8 LA4 LA8 RGB565 RGBA5551 RGBA4444 RGB24 RGBA32 L4 A4

    Have no idea which one is to be used in this texture case....

    Also, in WinHEX, how can I find out where the texture is in the CGFX banner file? This TXT didn't output any offset directions of the original CGFX file. So for what string should I search in winHEX to get to the position of the texture?
     
  10. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
  11. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    Brutal! Seems to have worked:

    [​IMG]

    Thanks for all the help. Just gotta test it out on the 3DS. I'm currently at work (night shift), so I'll test it tomorrow.
     
  12. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    Oh, what's this
     
  13. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    Replaced Sonic 2 GG title screen from banner with Sonic Chaos GG title screen.

    UPDATE
    Re-checked the created banner modified CGFX...
    Something must not be right... Is there an updated version of this texture tool?

    Take a look:

    [​IMG]

    The image on the right is the original. The one on the left is the texture tool created one. Tried all the output options of the tool, and this is the closest one I can get to the original colors of the image. So, supposedly, according to you info, it was on RGB565 mode, but that mode turns out all greenish. The closest mode is RGBA5551, but still: that blue turns into almost black...

    I asked if there is an updated version because, all the other options of the tool fail to deliver image in good condition. This is the best you can get...

    Hmm... Seems to be some sort of pallete issue?

    [​IMG]

    When opening the CGFX in 3DSExplorer, one can clearly see that, although the image has similar compression, the values in the same spot/same color of the image differ from one CGFX to the other. Take a lookat the image values. Why does this happen?
     
    Last edited by MDashK, Aug 17, 2015
  14. LITTOMA

    LITTOMA Advanced Member

    Newcomer
    67
    42
    Nov 14, 2014
    Switzerland
    Because it's difficult to avoid image distortion while converting RGBA32 to RGB565.

    You can try RGBA4444 instead.
    Seek to offset: ofs(0x1F14 )+0x30, and change this flag to 0x4(RGBA4444). Then replace the texture data with RGBA4444 texture data.
     
    Last edited by LITTOMA, Aug 18, 2015
  15. MDashK
    OP

    MDashK GBAtemp Regular

    Member
    219
    58
    Jul 22, 2011
    Internetus Exploratis
    Yeah, I can convert the PNG to RGBA32, but that will spit out a 64KB file, instead of a 32KB one...

    That's it! Excelent. Now the colors are OK. =) Changed the flag, and got fixed.
    Thanks a lot for all the help!

    Just tested it on real 3DS hardware. Works marvelously. Thanks.
     
    Last edited by MDashK, Aug 17, 2015