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

Thread: texture/dds converter

Hybrid View

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

    Default Re: texture/dds converter

    will119 I hope when you get back you'll have acquired better manners.

  2. #2

    Default Re: texture/dds converter

    Quote Originally Posted by alpaca
    I hope when you get back you'll have acquired better manners.
    I'll try but no promises

    but anyways i got it people:P a lot easier than before.

    [IMG][/IMG]
    Last edited by will119; 12-23-2006 at 23:21.

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

    Default Re: texture/dds converter

    Quote Originally Posted by will119
    or what? If i do not have better manners
    Then you will receive a warning by the forum administration ;)

  4. #4

    Default Re: texture/dds converter

    i cant post the image thats strange

  5. #5

    Default Re: texture/dds converter

    Great it worked.
    only test
    Medieval II : Total War userbars HERE
    www.totalwar.hotgames.cz < Admin of biggest Czech and Slovak fansite.

  6. #6

    Default Re: texture/dds converter

    Quote Originally Posted by AliAS
    Great it worked.
    only test
    LOL nice job!
    -"My horse for a kingdom!"

  7. #7

    Default Re: texture/dds converter

    I would love to have ago with this program and have an idea for a simple but useful mod. However I have only managed to download the first few KB and I also failed to get the Rome Battle Editor manual from this site.

    I have tried downloading with Explorer and Freedownload manager, my security settings with Explorer may be messing things up but this does not explain why the download manager only gets a few Kb before it thinks it is complete.

    Can anybody expert in these things explain what is going wrong?

  8. #8

    Default Re: texture/dds converter

    I managed to convert a texture file into DDS, but I cannot seem to manage to convert it back into a texture. No specific error comes up, it just says:



    Nevermind, I fixed it. I was saving in DXT3 instead of 1 or 5.
    Last edited by Sahran; 12-31-2006 at 02:58.

  9. #9
    Member Member L_Hybride's Avatar
    Join Date
    Dec 2006
    Location
    Bruxelles, Belgium
    Posts
    2

    Default Re: texture/dds converter

    Hi all, and thanks for all yours Python scripts alpaca, great job.

    My question is about the "mymod folder" users, what should I do in that case ? I still have to put the Io file first or I just have to convert the .texture, edit and put it back in .texture in my unit_sprit folder whiteout adding Io first in my "mymod.cfg" ?

    I hope, for my first post, that I was understandable, I m belgian (from the french side) and it's hard for me to write in english (but not to read it ).
    Be Aware :P (I'm belgian).

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

    Default Re: texture/dds converter

    Quote Originally Posted by L_Hybride
    Hi all, and thanks for all yours Python scripts alpaca, great job.

    My question is about the "mymod folder" users, what should I do in that case ? I still have to put the Io file first or I just have to convert the .texture, edit and put it back in .texture in my unit_sprit folder whiteout adding Io first in my "mymod.cfg" ?

    I hope, for my first post, that I was understandable, I m belgian (from the french side) and it's hard for me to write in english (but not to read it ).
    Unfortunately, you can't use the .modelsdb file in a mod folder.

  11. #11

    Default Re: texture/dds converter

    Do i just put the whole folder into M2TW/data?

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

    Default Re: texture/dds converter

    That depends. I would unpack the converter into some directory, copy all files you want to convert into that and then run one of the appropriate .bat files. That way you can control more easily what is converted, which has some advantages.
    You can theoretically convert all files in all subfolders, but that might have undesirable effects.

  13. #13

    Default Re: texture/dds converter

    hope this isnt too late for this thread....okay, so i'm following through Epistolary Richard's wonderful 'spoiler' and im done the second step, but adobe photoshop wont open the dds files, whats wrong, any help would rock, thanks.

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

    Default Re: texture/dds converter

    You need NVidia's dds plugin for Photoshop (you can find it somewhere on their homepage, just do a search for dds there).

  15. #15

    Default Re: texture/dds converter

    Quote Originally Posted by alpaca
    You need NVidia's dds plugin for Photoshop (you can find it somewhere on their homepage, just do a search for dds there).
    hey, thanks, didn't know that, new to the modding scene :D

  16. #16

    Default Re: texture/dds converter

    I ve got this problem.I did everything like on the pictures is.However when i want to open my .dds file in photoshop it shows this error :


    It is in Czech language so i translate: Can not open ......... because it is not right type of document.

    Do i have a bad photoshop or what?

  17. #17

    Default Re: texture/dds converter

    sry i didnt see post before me. So i need Nvidias dds plugin for Photoshop. OK

  18. #18

    Default Re: texture/dds converter

    Ok it works for me .But i have got one question.Where can i find textures of for example england peasants,town militia or dismouted feudal knights?I didnt find it anywhere.I am blind maybe.


    And when do i cease to be junior member?

  19. #19
    It was a trap, after all. Member DukeofSerbia's Avatar
    Join Date
    Feb 2005
    Location
    Sombor, Serbia (one day again Kingdom)
    Posts
    1,001

    Thumbs up Works

    It works! My new beautiful work...

    Watching
    EURO 2008 & Mobile Suit Gundam 00

    Waiting for: Wimbledon 2008.

  20. #20

    Default Re: texture/dds converter

    Ok it works for me .But i have got one question.Where can i find textures of for example england peasants,town militia or dismouted feudal knights?I didnt find it anywhere.I am blind maybe.


    And when do i cease to be junior member?

  21. #21

    Default Re: texture/dds converter

    Can you guys please resolve that via PM instead of hijacking my thread?
    Thanks.
    Sorry :(

    -----------------------

    i need help. Can somebody help me? the changes won't apply







    i launch the game with the batch file but the changes won't apply :/

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

    Default Re: texture/dds converter

    Those screenshots are no help. Please describe exactly what you did.

  23. #23

    Default Re: texture/dds converter

    i have deleted these files:

    -- data\descr_geography_new.txt
    -- data\descr_geography_new.db

    In the cfg file i have this line:

    [io]
    file_first = true


    + i put the texture file that i want reskining in my new created folder i made too convert.
    + i converted it to DDS
    + i open it with photosho+ when i have finished, i reconverted it back to TEXTURE. and i renamed it, then put it back in it's original location. (delete the original?)

    + i run the game with the batch file with this line :

    medieval2.exe --io.file_first

  24. #24
    Member Member thelonewolf40's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    16

    Default Re: texture/dds converter

    Quote Originally Posted by Icue
    i have deleted these files:

    -- data\descr_geography_new.txt
    -- data\descr_geography_new.db

    In the cfg file i have this line:

    [io]
    file_first = true


    + i put the texture file that i want reskining in my new created folder i made too convert.
    + i converted it to DDS
    + i open it with photosho+ when i have finished, i reconverted it back to TEXTURE. and i renamed it, then put it back in it's original location. (delete the original?)

    + i run the game with the batch file with this line :

    medieval2.exe --io.file_first
    HI Icue, looking at your screenshots it looks like your working with a models_strat unit, did you put it back in the models_strat folder or the
    unit_ models folder?

  25. #25

    Default Re: texture/dds converter

    in the units_model folder...

    i dont saw the models_strat folder... Is there? :/

  26. #26
    Join the ICLADOLLABOJADALLA! Member IrishArmenian's Avatar
    Join Date
    May 2006
    Location
    Writing the book, every day...
    Posts
    1,986

    Default Re: texture/dds converter

    Hello everyone,

    I'm having a problem with the texture converter. Everytime I try to run it, it gives me the "Press any key to continue" command. As instructed, I press any key (normally the enter key) and the window closes, without any changes.

    More information (I assume this can help): I am running convert_all_textures.bat, I have python, and the file is texture_converter_01 in my data file.

    "Half of your brain is that of a ten year old and the other half is that of a ten year old that chainsmokes and drinks his liver dead!" --Hagop Beegan

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

    Default Re: texture/dds converter

    Ideally, you'd set up a working folder in which you copy the tool and the textures you want to convert.
    I'm not 100% sure what could happen for you, if it doesn't present you with an error message it should run fine. Are you sure you don't have any converted files in your subfolders (where the appropriate .texture files are)?

  28. #28

    Default Re: texture/dds converter

    Quote Originally Posted by IrishArmenian View Post
    Hello everyone,

    I'm having a problem with the texture converter. Everytime I try to run it, it gives me the "Press any key to continue" command. As instructed, I press any key (normally the enter key) and the window closes, without any changes.

    More information (I assume this can help): I am running convert_all_textures.bat, I have python, and the file is texture_converter_01 in my data file.
    I have the same problem! How did you solve it? Can somebody help?

  29. #29

    Default Re: texture/dds converter

    Quote Originally Posted by salocin View Post
    I have the same problem! How did you solve it? Can somebody help?
    I'm not sure whether this thread is abandoned or not, but I figured out how to fix this issue.

    Problem is related to path in Python script used by Batches in order to either convert to DDS or to texture. Argument which represents path is initialized with '' and that gives no sense during execution, so you get an error.

    I edited script and fixed everything. Grab it:

    Code:
    # texture_converter.py version 0.1 (c) 2006 Stefan Reutter (alpaca)
     
    import sys
    import struct
    import os
    import math
     
    def convertTextureToDDS(path):
        f = open(path + '.texture', 'rb')
        fw = open(path + '.dds', 'wb')
        content = f.read()
        fw.write(content[48:])
        f.close()
        fw.close()
       
    def convertDDSToTexture(path):
        f = open(path + '.dds', 'rb')
        content = f.read()
       
        init = [0x01000000, 0x30000000, 0x00000000]
       
        # note: attachment sets don't seem to be used
        normHeader = [0x0044E212, 0x00986212, 0x03C0DA12]
        fill = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x65, 0x56, 0x3A, 0x7C, 0x03, 0x00, 0x00, 0x00]
       
        dxt = -1
       
        size = content[12:16]
        if content[84:88] == 'DXT5':
            dxt = 16384
        elif content[84:88] == 'DXT1':
            dxt = 4096
       
        if dxt == -1:
            print 'File '+path+' could not be converted'
        else:
            fw = open(path+'.texture','wb')
            for i in init:
                fw.write(struct.pack('>i', i))
            fw.write('dds')
       
            for i in normHeader:
                fw.write(struct.pack('>i', i))
            fw.write(struct.pack('h',dxt))
            for i in fill:
                fw.write(struct.pack('>b', i))
            fw.write(size)
            fw.write(content)
            fw.close()
        f.close()
       
       
       
       
       
       
    # Main script code
     
    convertAll = False
    subdirectories = False
    verbose = False
     
    files = []
     
    for i in sys.argv[1:]:
        if i.startswith('-'):
            i = i.strip('-')
            if i.lower().find('type') > -1:
                type = i.lower().split('=')[1]
            elif i.lower() == 'all' > -1:
                convertAll = True
            elif i.lower() == 'sub' > -1:
                subdirectories = True
            elif i.lower() == 't' or i.lower() == 'texture':
                type = 'texture'
            elif i.lower() == 'd' or i.lower() == 'dds':
                type = 'dds'
            elif i.lower() == 'v' or i.lower() == 'verbose':
                verbose = True
            elif i.lower() == 'h' or i.lower() == 'help':
                print """alpaca''s MTW2 .texture converter, version 0.1
               
               usage: texture_converter.py [options] files
               
               options:
               -all: Converts all files, if this option is supplied, filenames can be omitted
               -d,--dds: Convert .dds to .texture
               -h,--help: Display this page
               -sub: Also convert all files in all subfolders, can only be used with -all
               -t,--texture: Convert .texture to .dds (default, can be omitted)
               -v: Verbose option, extra output"""
        else:
            files.append(i)
           
    if type == 'dds' or type == 'd':
        if convertAll:
            if subdirectories:
                # Changed os.walk() arg from '' to os.getcwd() to get working directory.
                for tup in os.walk(os.getcwd()):
                    for filepath in tup[2]:
                        if filepath.find('.dds') > -1:
                            files.append(os.path.join(tup[0], filepath.split('.dds')[0]))
            else:
                # Changed os.walk() arg from '' to os.getcwd() to get working directory.
                for filepath in os.listdir(os.getcwd()):
                    if filepath.find('.dds') > -1:
                        files.append(filepath.split('.dds')[0])
            i = 0
            perc = 0
            perc2 = 0
            for filepath in files:
                if math.floor(i*100/len(files)) > perc:
                    perc = math.floor(i*100/len(files))
                if verbose:
                    print 'Converting file '+filepath+'.dds('+str(i+1)+' of '+str(len(files))+') - '+str(perc)+'%'
                elif perc > perc2:
                    print str(perc)+'% done'
                    perc2 = perc
                convertDDSToTexture(filepath)
                i += 1
        else:
            i = 0
            perc = 0
            perc2 = 0
            x = 0
            for filepath in files:
                if math.floor(i*100/len(files)) > perc:
                    perc = math.floor(i*100/len(files))
                if verbose:
                    print 'Converting file '+filepath+'.dds('+str(i+1)+' of '+str(len(files))+') - '+str(perc)+'%'
                elif perc > perc2:
                    print str(perc)+'% done'
                    perc2 = perc
                convertDDSToTexture(filepath)
                i += 1          
    else:
        if convertAll:
            if subdirectories:
                # Changed os.walk() arg from '' to os.getcwd() to get working directory.
                for tup in os.walk(os.getcwd()):
                    for filepath in tup[2]:
                        if filepath.find('.texture') > -1:
                            files.append(os.path.join(tup[0], filepath.split('.texture')[0]))
            else:
                # Changed os.walk() arg from '' to os.getcwd() to get working directory.
                for filepath in os.listdir(os.getcwd()):
                    if filepath.find('.texture') > -1:
                        files.append(filepath.split('.texture')[0])
            i = 0
            perc = 0
            perc2 = 0
            for filepath in files:
                if math.floor(i*100/len(files)) > perc:
                    perc = math.floor(i*100/len(files))
                if verbose:
                    print 'Converting file '+filepath+'.texture('+str(i+1)+' of '+str(len(files))+') - '+str(perc)+'%'
                elif perc > perc2:
                    print str(perc)+'% done'
                    perc2 = perc
                convertTextureToDDS(filepath)
                i += 1
        else:
            i = 0
            perc = 0
            perc2 = 0
            x = 0
            for filepath in files:
                if math.floor(i*100/len(files)) > perc:
                    perc = math.floor(i*100/len(files))
                if verbose:
                    print 'Converting file '+filepath+'.texture('+str(i+1)+' of '+str(len(files))+') - '+str(perc)+'%'
                elif perc > perc2:
                    print str(perc)+'% done'
                    perc2 = perc
                convertTextureToDDS(filepath)
                i += 1
    print 'Done'
    Then replace contents of your script with this one and use converter as usual.
    I also commented what has been changed.

    Enjoy I suppose.

    Member thankful for this post:

    Ludens 


  30. #30
    Arrogant Ashigaru Moderator Ludens's Avatar
    Join Date
    Nov 2003
    Posts
    9,065
    Blog Entries
    1

    Lightbulb Re: texture/dds converter

    Welcome to the .Org, and thanks for letting us know your solution.

    Looking for a good read? Visit the Library!

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