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

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

  1. #1
    Member
    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
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    Try this:
    https://www.mediafire.com/file/7c8av...v/mtl.zip/file

    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
    Member
    Registered: Feb 2012
    Thanks a lot. Do you by any chances have mtl files for mesh and obj?

  4. #4
    Member
    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:
    https://www.mediafire.com/file/ybqei...rator.zip/file

    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
    Member
    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: https://www.ttlg.com/forums/showthre...er#post2226222
    Last edited by Nameless Voice; 14th May 2019 at 14:58.

  6. #6
    Member
    Registered: Feb 2012
    Thanks, I only upscale original textures by 4x, so tile_factor isn't used.
    I also intended to use illum_map and env_map.
    I already done about 2/3 of the illuminations maps for all the lighted glasses and windows.
    I think of some simple reflection (enviromental) map for metals, glass and bronze

    Something like this:

    terrain_scale blahdiblah
    tile_factor bluh bluh

    force_opaque
    edge_padding 0

    render_pass
    {
    texture tex\envmaps\diagenv
    alpha 0.5
    shaded 1
    blend SRC_ALPHA ONE
    uv_source ENVIRONMENT
    uv_mod SCALE 2 2
    }

    render_pass
    {
    texture $texture
    shaded
    }

    I really liked the result. Just need to sort metals from everything else.

    Also, new question, can I do several render passes for illumination maps with different alpha? So it would be like the light has some pulse rythm. For Voltage indicators in fam/metal for example. There was some example of animation done with render passes in documentation.
    Or can I set different alpha for all the mtl files for animation textures? Documentation in NewDark says that only the first of the mtl file for animation is used.
    Last edited by Akven; 2nd Jun 2019 at 11:45.

  7. #7
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Quote Originally Posted by Akven View Post
    Thanks, I only upscale original textures by 4x, so tile_factor isn't used.
    Or can I set different alpha for all the mtl files for animation textures? Documentation in NewDark says that only the first of the mtl file for animation is used.
    Every render pass can have its own everything. What part of the documentation says that?

  8. #8
    Member
    Registered: Feb 2012
    Quote Originally Posted by ZylonBane View Post
    Every render pass can have its own everything. What part of the documentation says that?
    material-format.txt
    "For animated textures only the base/root texture of the animation should have a material file."

  9. #9
    ZylonBane
    Registered: Sep 2000
    Location: ZylonBane
    Ah, that's what you meant. Yes, it has to work that way because the material system includes features for control of animated texture sequences. To try to assign a MTL to each frame of an animation would be madness. If you want an animated glow effect, just add it as another render pass, synchronized with the main animation.

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
  •