1. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    Some of you probably remember Noesis made by Rich Whitehouse - big tool for extracting data from many games. It turns out that it has hidden function for tiling UE4 games textures.
    You need Unreal Engine 4.19!
    Code:
    #My modifications
    -Modified plugins\python\fmt_ue4.py:
    >>Added function '-ue4texungob' which swizzle texture. Based on '-ue4texgob', but with call extension 'tile_blocklineargob' instead of 'untile_blocklineargob'
    tile_blocklineargob is broken for some dimensions (it's cutting pieces of image), so it's preferable to have dimensions as multiplications of 128.
    
    >>For 'def ue4UntileTexture' changed:
            heightInBlocks = (height + (blockHeight - 1)) // blockHeight
            to
            heightInBlocks = (height + 4 + (blockHeight - 1)) // blockHeight
    
    >>For 'def ue4ConvertTextureData' changed:
            elif pixelFormat == "PF_DXT5":
                    textureData = ue4UntileTexture(asset, width, height, 4, 4, 16, textureData, 8)
            to
            elif pixelFormat == "PF_DXT5":
                if height <= 128:
                    textureData = ue4UntileTexture(asset, width, height, 4, 4, 16, textureData, 8)
                elif 128 < height <= 256:
                    textureData = ue4UntileTexture(asset, width, height, 2, 2, 8, textureData, 8)
                elif height > 256:
                    textureData = ue4UntileTexture(asset, width, height, 1, 1, 4, textureData, 8)
    
    #From this package I removed files that are not necessary for swizzling and to make this package lighter.
    

    Restrictions:
    Tiling works incorrectly for some dimensions.
    For best results textures should have dimensions as multiplications of 128 (for example 499x258 -> 512x384) or it looks like it can be 64.
    UE4 for Switch uses this method for their textures, so you can swap hex data between files if it's necessary.

    The best settings for cooking untiled textures in UE4:
    Compression Settings: UserInterface2D (RGBA) or Default (DXT1/5, BC1/3 on DX11) [second one tested only on DXT5]
    Texture Group: UI
    sRGB: unchecked
    Mip Gen Settings: NoMipMaps

    You can check if tool is tiling files correctly by using "Unswizzle.bat" for tiled cooked textures. If it's untiling wrongly, put it to "Unswizzle-nop.bat". If it's looks almost correctly, but something is amiss, then it's an noesis issue and you need to use different dimenions

    Both functions are working only with *.uasset (+ *.uexp & *.ubulk, but it's loaded by *.uasset file only), so you need installed Unreal Engine 4.19 to make textures.

    Making textures in Unreal Engine 4 will need tutorial for people who are too scared to learn by mistakes.
    Still I'm learning how this textures works.
    As it's a lot of informations, it will be added many days later.

    F.e. Octopath Traveler logo made by me.
    When it's untiled
    Bez nazwy2.png
    When it's tiled
    bez_nazwy2.png
    When putted to Octopath Traveler:
    Mapped.jpg

    You can download tiled image (make sure that this is 55,4 kB PNG, not recompressed image) and make from this cooked texture in Unreal Engine for Octopath Traveler and swap files with
    Code:
    \Content\UI\Title\Texture\UiTX_Title_logo_00.uexp
    \Content\UI\Title\Texture\UiTX_Title_logo_00.uasset
    How to get tiled image:
    Copy assets from Cooked folder to noesis folder. Drop *.uasset file ready for tiling to "Swizzle.cmd". It will create new png that needs to be cooked again in UE4 (better with version that your game uses) with the same settings. And that's it.

    How to untile texture:
    Copy assets to noesis folder. Drop *.uasset file ready for untiling to "Unswizzle.cmd". It will create PNG with the same name.

    Big thanks for making this tool by Rich Whitehouse. You can download whole tool here (without enabled tiling function and with broken untiling function for UE4 textures):
    https://www.richwhitehouse.com/index.php?content=inc_projects.php&showproject=91

    Code:
    #10.04.2019: added v2 with repaired untiling textures and tiling textures with dimensions different than multiplication of 128 (still not recommended for some files).
    //added Unswizzle-nop.bat for assets made by swizzle.bat without regular resolution (dimensions are not multiplications of 128 with padding)
    #27.04.2019: added v3 with support for DXT5 textures.
    #09.06.2019: added v4 with updated support for DXT5 textures (it was not working correctly for textures with height <= 256)
     

    Attached Files:

    Last edited by masagrator, Jun 9, 2019
    DanTaco, cots, ChaosEternal and 3 others like this.
  2. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    Added new version with working untiling textures. Added Unswizzling.bat.
    It was just a matter of adding "4" to height for correct untiling and swizzling textures with different dimensions than multiplication of 128 (still it's not working properly for some sizes).
    Now we can use in game textures with nonstandard dimensions without walking in hex edit.
     
    Last edited by masagrator, Apr 10, 2019
  3. fraggerman91

    fraggerman91 Member
    Newcomer

    Joined:
    Jan 4, 2016
    Messages:
    14
    Country:
    Germany
    The (un-)swizzling works fine for me. I can confirm that by looking at the textures in noesis and umodel.
    For some reason the re-cooking seems to mess something up though. The texture still looks fine(like it was swizzled on the switch) in noesis but when I load it on the switch it's all garbled.
    Some screenshots and the steps I take:
    • No changes done:
      [​IMG]
    • Unswizzle and re-cook:
      [​IMG]
    • Reswizzle and re-cook:
      [​IMG]
    • This is how it looks on the switch:
      [​IMG]
    Just loading the unchanged one works but if I run it through the un- and reswizzle and cook it it doesn't work any more even though it looks fine in noesis. Any idea why this happens? Do I need to set any special parameters or should the default parameters for dxt1 work?
     
    Last edited by fraggerman91, Apr 10, 2019
  4. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    I was uploading today many versions of this tool and I don't know if you have glitched version or not. Just now I came to the point of start.
    Uploaded again working mostly package.

    So there are cases when only what you can do is add paddings for right and bottom for your texture to make it multiplication of 128 (960x720 -> 1024x768), cook it, swizzle it, cook it and swap texture data from swizzled texture with texture data from original *.uexp by hex editor. It should be exactly the same size for b8g8r8a8. DXT5 and DXT1 is harder to do because of compression and you need to change file size inside *.uasset and probably *.uexp too.

    And please don't post big images. Thumbnails or take them to spoiler.
    And noesis itself has some issues with tiling some resolutions (except multiplications of 128). Already wrote bug report to author and waiting for reply, because it's an executable issue and I can't fix it.

    For now everything is possible.

    One more thing: if it's unswizzling in unswizzle.bat, then it should be correct for Switch. If it's unswizzling only with unswizzle-nop.bat, then it would not work on Switch and there is an issue with noesis.

    For now settings that I can confirm are working:
     
    Last edited by masagrator, Apr 10, 2019
    fraggerman91 likes this.
  5. fraggerman91

    fraggerman91 Member
    Newcomer

    Joined:
    Jan 4, 2016
    Messages:
    14
    Country:
    Germany
    These settings work! Thanks for the mod and help.
     
  6. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    So next thing I've probably discovered.
    For textures with one dimension lower than 64 pixels textures have dimensions as multiplications of 64. So 180x41 -> 192x64, 200x60 -> 256x64. (for lower than 32 I didn't checked)
    And then additional work space needs to be added after swizzling. Not before. But still noesis for this values is bugged. So there may be no way of adding textures with proper resolution with one dimension lower than 64. You can still add texture with higher resolution than original to game, but it will be downscaled.
     
    Last edited by masagrator, Apr 13, 2019
  7. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    Added new version with support for tiling and untiling DXT5 textures.
    DXT5 needs to be created for swizzling. Swizzling RGBA8 texture and putting it to DXT5 texture will not work.
     
    Last edited by masagrator, Apr 27, 2019
  8. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    Next update. Earlier (un)swizzling DXT5 textures with height <= 256 was not working correctly. Now it's working.
    I can't check if height >512 is working correctly. I'm waiting for textures to test. :P
     
    Last edited by masagrator, Jun 9, 2019
  9. eaZy41

    eaZy41 Newbie
    Newcomer

    Joined:
    Dec 15, 2009
    Messages:
    6
    Country:
    Russia
    Got this when trying to process 512x1024 file in v4:

    Noesis console mode activated.
    File "G:\Tools\noesisv4395-modv4\fmt_ue4.py", line 2779
    elif pixelFormat == "PF_DXT5":
    ^
    IndentationError: unindent does not match any outer indentation level
    Noesis initialized.
    Source file: G:\Tools\noesisv4395-modv4\font_0_0.uasset
    Dest file: png
    Options: -ue4texungob -ue4serialver "516" -ue4gamehack "0"
    ===
    Unknown option: -ue4texungob
    Unknown option: -ue4serialver
    Unknown option: 516
    Unknown option: -ue4gamehack
    Unknown option: 0
    Detected file type: Unknown
    Nothing was exported!
     
  10. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    And I tested it before uploading that this error will not show... Eh, it will be updated in couple of hours. This is bug in code, not a issue with file (There should be Tab key, but somehow there is a space used - probably I forgot to update package with correct file).
     
    Last edited by masagrator, Jun 10, 2019
  11. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    Now it should work.
     
    lh411 likes this.
  12. switchhunter666

    Newcomer

    Joined:
    Mar 2, 2020
    Messages:
    33
    Country:
    United States
    snip
     
    Last edited by switchhunter666, Jun 6, 2020
  13. masagrator

    OP masagrator The developper
    Member

    Joined:
    Oct 14, 2018
    Messages:
    3,536
    Country:
    Poland
    Why should I care? :P
     
  14. switchhunter666

    Newcomer

    Joined:
    Mar 2, 2020
    Messages:
    33
    Country:
    United States
    wrong place sorry.....
     
Draft saved Draft deleted
Loading...

Hide similar threads Similar threads with keywords - texture, Noesis, Tiling