Page 1 of 2 12 LastLast
Results 1 to 30 of 39

Thread: Converting .Texture to .DDS

  1. #1

    Default Converting .Texture to .DDS

    Hi All

    Playing around with the files that came with mt_unit_xmls.rar (sorry can't find the download link again), converting the uncompressed .TEXTURE files to .DDS files is fairly simple. You just strip the first 48 bytes from the .TEXTURE file and save the result as .DDS file. So extracting the .TEXTURE information to a DDS is fairly simple. However finding out the information to put back into a TEXTURE file may be more difficult, but probably do-able.

    For anybody else that wants to have a guess at the .TEXTURE header information, the values for the EN_Peasant_Padded_england.TEXTURE are :-

    (by 32 words)
    1
    48
    0
    7562340
    1237572
    51208848
    1235648
    576
    0
    2084197989
    3
    1024(depth/width of texture)

    My guess (and it's just that) would be that it would be pretty safe to use a silmilar header for a similar texture -ie cloth for cloth, mail for mail, etc. But when the unpacker comes out we'll know more .

    Cheers

    GrumpyOldMan

  2. #2

    Default Re: Converting .Texture to .DDS

    Interesting info - maybe we're not too far away from adding a new texture to the game?

    I've added it to the researchwiki.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  3. #3

    Default Re: Converting .Texture to .DDS

    I've been looking at the texture files in a hexeditor and comparing them, noticed some things. Between files of the same size and dxt type theres no change in the header, between files of the same size and different dxt types one byte changes, the 29th. This is 10 for DXT5 and 40 for DXT1. This applies to textures for units. Between textures for units ant those for other types of models, such as those in the attachment sets and new vegetations folder the 17th and 18th and 25th and 26th bytes change values.

    My guess is that as the header is only changing between different types of models and dxt formats, it should be safe to strip out the header, edit the dds and reinsert the header and try it ingame. I've made an attempt to do this but I only have the demo and it doesnt seem to use unpacked files so it came to nowt. If anyone else wants to try it the file is here: http://rapidshare.com/files/7762805/test.rar.html
    Unzip into the data folder, it should replace french chivalric or dismounted knights.

  4. #4

    Default Re: Converting .Texture to .DDS

    Never mind, I got it to work, never read the bit about the command line
    Screenies:



    I probably should have done something a bit better looking but it works.

  5. #5

    Default Re: Converting .Texture to .DDS

    Couple more tests, mounts buildings and banners:






    I've only noticed one other byte changing between files, the 46th seems to change value depending on the size of the file, although I've noticed two files of different dimensions but same area having the same value. Likewise I've noticed two files of the same dxt type having different values for the 29th byte, 10 and 20. I havent noticed two different dxt formats using the same value though. The other two byte sequences dont seem to have any effect ingame if you change them to those used by another type of model. Other than that I havent noticed any other changes between the headers in different files than those 6 bytes.

  6. #6

    Default Re: Converting .Texture to .DDS

    Apparently we weren't far away at all! This is great news - I'm going to have to try this out
    Last edited by Epistolary Richard; 12-17-2006 at 13:09.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  7. #7

    Default Re: Converting .Texture to .DDS

    Out of interest what hex editor software is available or do people recommend?

  8. #8
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Converting .Texture to .DDS

    I use Hex Workshop

  9. #9
    Man-at-Arms Member Dave1984's Avatar
    Join Date
    Jun 2006
    Location
    Staffordshire
    Posts
    255

    Default Re: Converting .Texture to .DDS

    I apologise if I appear stupid, but I do not have any experience with hex editors or understanding binary.
    Using GrumpyOldMan's converter, opening the .dds in photoshop (with .dds plugin) the file opens as blank.

    Opening the file with a hex editor (such as Hex Workshop) obviously displays the file in it's binary form (OK I'm striking out here, I don't know if that's what it's called) but it is not readable to the untrained eye.
    So when you all talk of deleting this byte or that byte, and the 46th byte changing between files, what does it mean, and how can those of us without hex editor knowledge apply it to converting the files so that we can begin reskinning?

    Thanks guys!

  10. #10

    Default Re: Converting .Texture to .DDS

    That is totally A+ work there! Is there any chance of us seeing a converter?

  11. #11

    Default Re: Converting .Texture to .DDS

    I dont use hex commander but the process with it should be similar. Make a copy of and open up the texture file you want to edit in your hex editor. Write down the numbers highlighted here:



    Delete them then save and exit. Change the file extension from .texture to .dds. Open it up in your graphics program and make note of the format, ie DXT1 or DXT5 and no. of mipmaps. Do your editing and save the file with the same settings. Now open up the dds in your hex editor and insert the hex string you deleted at the start. Compare it with the original file to make sure its correct. Save, exit and rename the files so the new one is used by the model. Start your game with the --io.file_first switch and you should be able to see your changes ingame. Remember to delete the two files that cause the game to crash as well.

  12. #12
    Man-at-Arms Member Dave1984's Avatar
    Join Date
    Jun 2006
    Location
    Staffordshire
    Posts
    255

    Default Re: Converting .Texture to .DDS

    Quote Originally Posted by Casuir
    I dont use hex commander but the process with it should be similar. Make a copy of and open up the texture file you want to edit in your hex editor. Write down the numbers highlighted here:



    Delete them then save and exit. Change the file extension from .texture to .dds. Open it up in your graphics program and make note of the format, ie DXT1 or DXT5 and no. of mipmaps. Do your editing and save the file with the same settings. Now open up the dds in your hex editor and insert the hex string you deleted at the start. Compare it with the original file to make sure its correct. Save, exit and rename the files so the new one is used by the model. Start your game with the --io.file_first switch and you should be able to see your changes ingame. Remember to delete the two files that cause the game to crash as well.

    Thanks Casuir, that's much appreciated.

    On opening the file in photoshop, it shows up fine but has replicated itself exactly on the right several times, each time progressively smaller. Is this normal?
    Last edited by Dave1984; 12-17-2006 at 16:22.

  13. #13

    Default Re: Converting .Texture to .DDS

    Those are mipmaps, they're smaller versions of the same texture the game engine uses when the model is further away to save memory. There should be a popup box when you open the files in photoshop which asks you if you want to load them:

    Uncheck it, when you save the file there'll be a dialogue which asks you if you want to generate them, make 11 if its 1024*1024. It'll ask you the format to save it as well, if there was an alpha channel DXT5 if not DXT1.

    Done some looking at the Normal maps, should be relatively simple to create some, just get the normal filter plugin for photoshop from nvidias website and apply it to your texture. By changing the scale to 6 in the settings dialog I got something which came very close to CA's own normal map for the texture I was using.

    Theres an alpha channel in the normal map dds as well, this seems to be what controls the specular lighting. I deleted it from one of the textures and this was the result:

    Same texture as the one on the gendarmes above, no alpha in the normal map, no shiny bits.

  14. #14

    Default Re: Converting .Texture to .DDS

    Okay, tried it out - totally worked.


    Absolutely great. Just wanted to give a couple of reminders of things that Casuir already said but I forgot!

    1) My photoshop defaulted to DXT3 - but use DXT5 for unit textures.

    2) Don't use this with a mod folder (might have to redo the path to do that) instead use:
    [io]
    file_first = true
    in the .cfg file or --io.file_first in the command line

    3) Remember to delete the two files that cause the game to crash as well:
    data\descr_geography_new.txt
    data\descr_geography_new.db



    BTW I'm using XVI32 as a hex editor, is there a quick way to paste the header back in? I had to retype it by hand
    Last edited by Epistolary Richard; 12-17-2006 at 23:37.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  15. #15

    Default Re: Converting .Texture to .DDS

    I'll wait until someone makes a converter program, or CA throws us a bone..

  16. #16
    Shaidar Haran Senior Member SAM Site Champion Myrddraal's Avatar
    Join Date
    Feb 2004
    Location
    UK
    Posts
    5,752

    Default Re: Converting .Texture to .DDS

    Wow, nice find!

  17. #17
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: Converting .Texture to .DDS

    If anybody has time to test a basic version of a converter tool, please send me a PM with your MSN address.

  18. #18

    Default Re: Converting .Texture to .DDS

    Quote Originally Posted by Epistolary Richard
    BTW I'm using XVI32 as a hex editor, is there a quick way to paste the header back in? I had to retype it by hand
    Yeah there is, sorry didnt actually look for one till you asked. Use the Block <n> chars in the edit menu, enter 48 with decimal checked and the header will be highlighted. You can cut and paste the header now but if you use the clipboard for anything else (like photoshop) the string will be lost. Best way to do it would be open up the original and copy and paste the header from that.

  19. #19

    Default Re: Converting .Texture to .DDS

    couple of questions:
    1.I was trying to add some textures using adobe photoshop,but when I try to convert it to .DDS it doesen't work(it's not combatibile)
    2.Does it works with 3DSmax???
    3. when trying covert .DDS file to .texture file(for editing the texture) i can't set the numbers very good:
    1
    48
    0
    7562582
    1237572
    51208848
    1233649
    556
    0
    2084197939
    3
    1024
    can you say how to correct it???
    and 4:does it works with an other width(512)???
    eg:
    1
    48
    0
    7562582
    1237572
    51208848
    1233649
    556
    0
    2084197939
    3
    512

  20. #20

    Default AW: Converting .Texture to .DDS

    to be honest: im too lazy to do all the stuff with the hex commander. Does anyone code a program to speed this things up? me - and i guess the total war community too - is waiting for it.

  21. #21

    Default Re: Converting .Texture to .DDS

    hey guys i got all the tools you talk about but i just can't find the unit texture files where are the files for me to mod the unit texture, please someone help me

  22. #22

    Default Re: Converting .Texture to .DDS

    data/unit_models/units/ after you unpack the files.

    -hgtm, I'm not sure exactly what you're doing, if you follow the steps above it should work. You shouldnt be using 3dsmax at all, thats for 3d models not 3d textures.

    Did a bit more testing and the two bytes which seem to relate to dxt type and file size dont have any effect ingame if you change them to different value. Given that the dxt type and file dimensions are in the dds portion of the file im guessing they're for reference only.

  23. #23

    Default Re: Converting .Texture to .DDS

    so.....how do you convert back to .texture ? or do I have to?

  24. #24

    Default Re: Converting .Texture to .DDS

    Yes, you have to. It's a matter of reinserting the header in the hex editor and then saving it as a .texture file.
    Epistolary Richard's modding Rules of Cool
    Cool modders make their mods with the :mod command line switch
    If they don't, then Cool mod-users use the Mod Enabler (JSGME)
    Cool modders use show_err
    Cool modders use the tutorials database Cool modders check out the Welcome to the Modding Forums! thread Cool modders keep backups Cool modders help each other out

  25. #25
    Man-at-Arms Member Dave1984's Avatar
    Join Date
    Jun 2006
    Location
    Staffordshire
    Posts
    255

    Default Re: Converting .Texture to .DDS

    How does one find out what the dxt type of the file is in the first place?

  26. #26

    Default Re: Converting .Texture to .DDS

    If you think that you have enough knowledge to create automated converter please send me a pm.
    Taking whole research into one post with explained header (size + purpose + possible values) and samples Original Texture / Stript to dds / Changed Texture converted back to M2TW format.
    I can create stand alone converter for you.
    Please also add what other options will be useful for skinners.
    I am not a skinner so your input will help make this tool easy in use for you.
    I also hope you can help to test this.

  27. #27

    Default Re: Converting .Texture to .DDS

    if somebody give me information how can convert .dds to .texture i will create tools for it

    i already created .texture to .dds converter but i haven't permitions to post url here
    imperiaonline.org

  28. #28

    Default Re: Converting .Texture to .DDS

    you can download .texture to .dds converter

    http://www.twcenter.net/forums/downl...do=file&id=961
    imperiaonline.org

  29. #29

    Default Re: Converting .Texture to .DDS

    Quote Originally Posted by iamnew
    you can download .texture to .dds converter

    http://www.twcenter.net/forums/downl...do=file&id=961

    You kick ass!

    Do I have to convert them back to be used by the game or can I just use the .dds files?

    edit: nevermind, I do have to, but is there a tool for it, too?

    regardless, i'm satisfied now just to view comfortably all the texture files..:-)


    edit: '/4 hrs later/ wow, people this much interested in this? or this sub forum is dead as a doornail?
    Last edited by Lovasìjász; 12-20-2006 at 06:14.

  30. #30
    CeltiberoRamiroI Member Monkwarrior's Avatar
    Join Date
    Apr 2004
    Location
    Salduie/Caesaraugusta/ Sarakusta/Saragossa
    Posts
    828

    Default Re: Converting .Texture to .DDS

    Thanks a lot, iamnew.

    Please, keep us informed if you are able to build a tool to convert .dds to .texture.

    Thanks again.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO