Page 1 of 2 12 LastLast
Results 1 to 20 of 29

Thread: AGH->DDS and vice versa questions

  1. #1

    Default AGH->DDS and vice versa questions

    After dabbing some in the textures, I am actually working on a set of high-rez textures.

    I've noticed that Horizons (at least) supports DXT1, DXT3, and 8:8:8:8 ARGB.

    Currently, the AGH>DDS and DDS>AGH utilities that were hosted in the Tazoon customization forum only support the DXT1 and DXT3. They read the 8:8:8:8 format and can convert it back to DDS, but converting a uncompressed ARGB DDS texture over to AGH results in an error in the logs. Horizons complains that the size of the AGH is different than what it should be, and that there is 128 bytes of data missing. This tells Horizons that the file is corrupted and it won't display the texture at all.

    I'm wondering where I can get a hold of the author of the AGH>DDS tools, or if there is someone out there that is willing to write a more complete converter. Anyone know?

    Menkure

  2. #2
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Yeah, sorry, I never got around to making that program any more useful... there didn't seem to be a lot of interest in it at the time.

    May I ask what program you're using to generate and/or edit your DDS textures? I was stuck with the NVidia photoshopplugin, which had some problems. Additionally, let me know which texture you're trying to convert, and I'll see if there's anything I can do.

  3. #3

    Default Re: AGH->DDS and vice versa questions

    I'm using the photoshop plugin as well.. I'll try the dos converters and see what the results are.

    The textures I'm looking at and trying to edit are the boxers.. they are an uncompressed DDS with an alpha.. the decompiler works nicely on them, and the resulting file is in the 8:8:8:8 format.

    The AGH>DDS converter refers to it as an "Uncompressed DDS, Type 7(?)".. but when converting it back to AGH.. the DDS>AGH won't recgonize it. Not even as a Type 7(?)

    When trying to load the textures after attempting to convert them.. horizons won't load them. After examining the debug logs.. it says the file is corrupted and lists what the file size should be and what it actually is on disk..basically, there is128 bytes ofdata that horizons.exe says should be in the AGH file, but isn't. All of the textures I've tried converting to AGH that were uncompressed 8:8:8:8 result in this same error.

    the location of the texture I'm using to test this out is here: Resources\textures_agh\characters\characters\human _m\clothing

    name of file: human_m_sc00_legs_boxers06_c_reg.agh

    -Menkure

  4. #4
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Need to eat something, but I've seen the reply, and will edit this post later this evening with my findings, and maybe an update to the program if I'm feelign like coding that much.

    edit:

    A big problem with the plugin, is that it seems to only work on merged images (in PSP anyway) so there's no way to preserve alpha transparency when saving the file. I can't remember if I ever found a tool to propperly save a dds file with alpha or not. I guess I'll start looking again.

  5. #5

    Default Re: AGH->DDS and vice versa questions

    So far, all the files I've saved in photoshop had their alphas saved with them

    I also used the dos verstion of the DDS converter, and I still had the same error.

    When converting aDDS texture using the u8888 format to AGH, it still results in a gray model and an error in the debug log. AE apparently adds 128 bytes of data to the AGH, for a u8888 formatted DDS file, when they convert them. It possibly could be an identifier to tell the game what format it is (pure speculation on my part here, it could be anything, and I'm not a programmer nor very good with a hex editor, so I'm at a loss here)

    -Menkure


  6. #6
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Sheesh, I wish I had commented this block of code... I think I understand what it does again now, but it tooka while...



    FOR x = 0 TO DDSHeader.dwMipMapCount - 1
    MipSize[x] = (DDSHeader.dwPitchOrLinearSize / (4**x)) + 8
    AEHeader.dwMipMapSize[x] = MipSize[x]
    ReadMipMap$ = NULL$(MipSize[x]-8)
    READ[InFNum], ReadMipMap$
    MipMap$[x] = ReadMipMap$
    NEXT

    I think this code is what's messing things up, I'll work on re-writing it now... it's an optimized version of somethign I have commented out, but I can't remember what I changed if anything, so I guess I'll just start over.

    if you're curous, I have to add 8 bytes to the mipsize when converting from DDS, because AGH files add 2 dwords to each mipmap inside the file for no apparent reason. at the beginning of the mipmap it's the type (2nd dword in the AE header) at the end of the mipmap it's 0xdeeeedde (it looks like deedeede in calc) Why they couldn't just use standard DDS is beyond me.

  7. #7
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Oh, btw if you're getting a (?) at the end of the line where it says it's type 7, you've got an old version of the exe, try this one:

    http://mysite.verizon.net/fridlekh/HZUtils/Dds2Agh.exewhich. hmm. says it's a type 0, but doesn't have the data corruption problem my current codebase is having *digs up old source* wah!

    edit:

    The shorts are an interesting case that I hadn't seen enough to realize would be a problem... MOST textures are a nice power of 2 by poer of 2 in dimensions... those shorts however, are not. they are 368x144 and the mipmap calculations start to get messed up after the 5th one because of how odd sized mipmaps are calculated... bah!

    SO! Instead of using the original image size and extrapolating out mipmap sizes that way, it looks like I'm going to have to use temp variables and divide the width and height yb 2 each iteration being sure to floor each result before claculating the size of each mipmap. This is because dds doesn't store the size of each mipmap in the header, only the main image size and dimensions.

    fun!

  8. #8

    Default Re: AGH->DDS and vice versa questions

    Wow.. You know, I *think* I understand what you are saying, even though I'm not very familiar with coding or data formats. [:P]


    The boxers are indeed a very special case. I was going to edit them and make ones specific to each model. By specific, I do not mean changing the patterns (skeletons, pumpkins, hearts, etc..), but instead I was going to make them unique to various models. As an example, the same boxer texture..the one that isin Human_m/clothing.. is used on all models. This is so even though there are boxers in the human_f/clothing folder.

    I was going to make different types for each sex and race. and also redo them to fit the models a little better. ((The female Saris boxers have the 'crotch' painted on them way too high. If you really compare the texture on the model, you'll see that it looks 'strange'.))

    By different boxers,I mean keeping the boxers for the male models, but designing a sort of 'thong' or bikini for the females.

    But that is really a later project.. I have well over a hundred skins I'm editing and cleaning up, and improving on the quality.The problem isthat the texture compression from the DXT format is horrible... especially on detailed work.

    So really, the boxers were used more as an example to show that the u8888 format is used, and that there were AGH files with that compression. I'm sure that other types are supported. I have compiled other textures, using all the uncompressed formats. None of them load in-game, but each one does give an error message in the debug logs that tells why they aren't being loaded. Instead of just crashing and CTDing on me, I suspect that the support for the other formats is indeed there.

    The big part of the project is the normal skins for the player models.. and those are all a power of 2. So if that makes converting them much easier, then maybe it's best to ignore the boxers as a 'special case' and work on other things.

    What do you think?

    -Menkure

  9. #9
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    I descided that more people probably have time to play with this kind of stuff on the weekends, so I finished up the changes today and have a working dds -> agh converter again (I think).

    At least, it made a perfect conversion from agh -> dds -> agh woth the above mentioned boxer texture (no editing in the middle)

    so, this link should be to a better working file now, let me know if it works: http://mysite.verizon.net/fridlekh/HZUtils/Dds2Agh.exe

  10. #10

    Default Re: AGH->DDS and vice versa questions

    So far, it is working absolutely great! :)

    *Runs back to photoshop to work on more textures*

    -Menkure

  11. #11
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Yay! do post some results please. I guess I'll have to get PS so I can use the plugin effectively.

  12. #12
    Member
    Join Date
    Oct 2004
    Location
    Somewhere where the games are "fun"
    Posts
    135

    Default Re: AGH->DDS and vice versa questions

    Any chance of you publishing/sending me the file format specification?

  13. #13
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    I publighed what I knew before on the Tazoon boards, but those are gone/frozen at the moment, so... I'll try to see what I can remember...

    First off, the AGH format is merely a bastardized DDS format. the actual data is encoded the same way as DDS, but the arrangement of the data is all backwards and (to me) unelegant. For DXT compressed types, there are both AE's header, as well as the original DDS header (with somemissing, nonvital data). For uncompressed types, there is only the AE header.

    For more information of the DDS file format, check the MSDN


    Here is my AEHeader[] construction:


    TYPE AEHeaderType
    ULONG .dwReserved 'not used?
    ULONG .dwTextureType
    ULONG .dwHeight
    ULONG .dwWidth
    ULONG .dwMipMapCount
    ULONG .dwEmpty
    ULONG .dwMipMapSize[15]
    ULONG .dwUnknown
    ULONG .dwReserved1[ 8 ] 'edit, space added to prevent 'music': [8]
    END TYPE

    Mst of these should be self-explanitory.
    Nte: indexes start at 0, so the arrays [#] mean there is one more DWord in them than # suggests (space for 16 mipmaps is allocated even if fewer are used)

    The first DWord is always
    0x00000000 (not used?)
    The second DWord is the 'type' and uniquely identifies a specific dds format, I've seen types: 0, 3,5,7, 8, 14, 15, 65535
    unhandled types: 8, 65535
    type 0: 8bpp
    type 3: 16bpp
    type 5: 24bpp
    type 7: 32bpp
    type 14: DXT1
    type 15: DXT3

    now, as to the structure of the actual texture data, it goes something like this:

    DDS file:
    [DDS Header][Full sized texture][Mipmap][Smaller mipmap][even smaller mipmap][etc...]

    AGH file:
    [AE Header]{DDS Header if DXT}|type DWord|[smallest mipmap]|0xdeeeedde||type DWord|[Next smallest mipmap]|0xdeeeedde||type DWord|[etc until full sized image]|0xdeeeedde|

    as you can see, the mipmaps are arranged backwards in the file, and have an extra 8 bytes tacked onto them for no apparent reason, the texture type in front, and3740135134at the end. (0xdeeeedde or deedeede in Calc)

    That's about all I can remember.

  14. #14
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Just a note... I've updated the utilities to recognize Type 3 textures. These would be tintable armors, dryad tattoos, dragon skins, etc.

    Many of these textures are at an odd resolution though, so the photoshop plugin won't work. I'm currently using ddsview to view and convert to psd or tiff. I'm still looking for another easy to use program for converting back to dds.

    Agh -> Dds converter

    Dds -> Agh converter

  15. #15
    safaia
    Guest

    Default Re: AGH->DDS and vice versa questions

    I just downloaded and tried agh2dds but it stil doesn't knows type 3 :(
    Is it a broken link to the old exe or something more odd?

  16. #16
    safaia
    Guest

    Default Re: AGH->DDS and vice versa questions

    to be more specific I tried it with the dryad female body tattoo textures

  17. #17
    Fridlekh
    Guest

    Default Re: AGH->DDS and vice versa questions

    Have you tried using ddsview to open the resulting dds file? I get an error with the photoshop plugin, but not with ddsview. It's probably still buggy, but I'm working with trial and error here...

    I think I'm about done programming this in XBasic. Futher development will be in C#, so don't expect more than simple bugfixes for a while.

  18. #18
    safaia
    Guest

    Default Re: AGH->DDS and vice versa questions

    there are no files to view, there is nothing generated except the default body texture 00 that is not type 3.
    Yes, normally I use ddsview to watch them. To convert to othr formats I use DDS Converter 2.

  19. #19
    safaia
    Guest

    Default Re: AGH->DDS and vice versa questions

    I just downloaded the two exes again. Seems as if I got still old files as I last tried it. Now they seem to work :)

  20. #20

    Default Re: AGH->DDS and vice versa questions

    Cool, now I can see the types of dragon skins/decals!

    But lots are in greyscale, and I'm still looking to know if it's possible to get Nisse's textures ? I didn't see then anywhere :/
    Nisse 100 Helian/Nissei 100 Lunus/SShiak biped (All on Chaos)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •