TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 5 of 5

Thread: In need of a script to create .mtl files

  1. #1
    Registered: Feb 2012

    In need of a script to create .mtl files

    Is there is some automatic batch script to MASSIVELY create .mtl files with terrain_scale x y???!!! I'm creating ESRGAN texture update for Thief Gold, all fam textures already done. But I need some tool to create .mtl files without editing them by hand.

    And another question: what textures do need env_map or illum_map in .mtl and what should be there? I think glasses and windows need some sort of illumination map, do they?

  2. #2
    Registered: Jan 2001
    Location: Formby, NW England
    Try this:

    I wrote a program to go through each texture and write its dimensions to an mtl file using the same folder structure. I don't think in C# there's an inbuilt way of reading .pcx files so I first used IrfanView to convert them all to .gif, which can be read.

  3. #3
    Registered: Feb 2012
    Thanks a lot. Do you by any chances have mtl files for mesh and obj?

  4. #4
    Registered: Jan 2001
    Location: Formby, NW England
    Object/mesh textures are mapped differently. A texture that fits exactly onto a rectangular object face will always fit no matter how big the texture is.

    terrain_scale is therefore only for terrain textures. For objects we have tile_factor (see doc\material-format.txt). It's only for obj, not mesh. E.g. if an original object texture has 4 stone blocks in a square (2x2), and you make a replacement texture which is twice the size and has 16 blocks (4x4), you should use tile_factor 2 so that the renderer keeps the original blocks the same size. Disclaimer: I haven't used that code enough, or recently enough, to be confident that what I've said is 100% correct, but it's something like that.

    Here's the program I used to create the mtl files:

    Note it comes with two text files specifying the extracted textures dir and the dir in which the mtl files will be created - the program will create the latter itself. To prevent the program overwriting any previous work (e.g. if you modified some mtl files or you're running it again for T2 textures) it'll won't do anything if mtl folder exists.

    It writes the terrain_scale with the original dimensions. tile_factor isn't something that can be done automatically because it depends on what's been done with the new images.

  5. #5
    Registered: Mar 2001
    Location: Ireland
    You want to have the terrain_scale set to the size of the original texture, always.
    If your replacement texture doesn't match at that size (for example, your replacement has a 2x2 grid of different variations of the texture), then you need to use tile_factor to compensate for that.

    I have a program for viewing and comparing a "new" and "old" version of a texture, which also automatically creates .mtl files when you view them, but I'm not sure if that would be of much use to you

    Edit: You can find that program here:
    Last edited by Nameless Voice; 14th May 2019 at 14:58.

Tags for this Thread

Posting Permissions

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