TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Page 1 of 2 12 LastLast
Results 1 to 25 of 30

Thread: mtl files for your textures question...

  1. #1
    Member
    Registered: Nov 2003
    Location: France

    mtl files for your textures question...

    I was wondering. Has anyone here been making those mtl files for your textures? I have did some things with the marble floor and metal textures (shiny or showing a fake reflection), but they're not as good as they could probably be.

  2. #2
    d. 30.4.16 Always remembered
    Registered: Apr 2002
    Location: in our hearts
    Until now I only used them to automatically resize the textures in game. But I'd really like to know what else we can do with them.

  3. #3
    Member
    Registered: Oct 2001
    Location: 0x0x0
    This is all new to me. But then clean socks would be new to me.

  4. #4
    Zombified
    Registered: Sep 2004
    you can do a lot of crazy stuff with mtls - reflections, movements and much more, check the documentation.

  5. #5
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    I've been stumbling around with them. So far, I've made a nice glow map for some mushrooms, and an almost but not quite skybox effect that's applied through a textures alpha channel.

    They're pretty neat. Seems like you can do quite a bit with them. The only problem is, without specific examples, it's all one big time consuming trial by error until you get something usable.

  6. #6
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Yeah. I'm looking forward to someone really smart and literate writing up a tutorial on their use.

  7. #7
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    That throws me out of the running. I'm only borderline functional and barely literate.

    I did come up with a cool faked specular effect, though. I'm gonna experiment with it more and see if I can make it a little more general use. What I've got so far is great for specific situations, but can't be used everywhere without looking weird.

    Like if you're underneath a bunch of blue moonlit windows, it's great. In a torchlit hallway, you get a blue reflection from orange light. In a dark room, you get clouds of weird blue spots floating out in the black.
    Last edited by Renzatic; 9th Jan 2013 at 22:32.

  8. #8
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    After playing around with a number of textures and effects, I've come up with a semi decent fake-specular. I'm still kinda rough with the code itself. All I've done so far is lift what was listed in the readme file, tweaked it a bit, and added a couple bits in there for flavor.

    First, some screenshots...

    Moon Glow
    Torch Glow

    Yeah, you'll see the color changed slightly, but like the window, it's an effect better seen in motion. So I made a video (and managed to crunch it down to 2 meg using Handbrake), and posted it...

    Hurrrr.

    I recommend saving it and watching it WMP. Playing it in Chrome makes it look sorta washed out, and I'm guessing it'll do the same on other browsers.

    This is all well and good, but it ain't worth nothing to you all if I don't show you how I did it. I'll try my best here, since I'm still rather vague on what does what when it comes to the code.

    First, what I do know. Alpha masks.

    You'll want to start out with your base textures. Mine looks like this (sized down to half so you all don't end up with huge ass pictures blocking everything)...



    Then, I made the mask and popped it into the alpha channel



    It works exactly the way an alpha does. White is opaque, black completely transparent, various shades of grey the levels between. Specifically, white = no glow, black = GLOOOOWWW, grey = diffuse glow.

    This is really just a brighter than usual inverted spec map, sorta like what you'd see in TDM. It's there to control how the environment map will display over the texture. A solid black alpha would just give you a flat glow, like it's covered in perfectly smooth glass. This makes it look like floor is scuffed up, but still reflective in places.

    Next up is the weird bit. Since this isn't an actual Honest To God specular map and isn't reflecting anything, I had to make a glow so it won't display straight out fullbright across the whole thing. I can't just throw in a solid blue texture. I had to make a blobby looking thing and experiment with the shape until I was happy.

    This is my environment map...



    Don't make a damn bit of sense, does it? I'll try to explain this...

    Imagine you have a gradient circle as your environment map. When you apply it in Thief, that circle will always be following right underneath Garrett. The effect would be that you get a glow that slowly disappears the farther away it is from him. Kinda like a reverse Fresnel. You'd only ever see the reflections directly below you when you look down. A solid white environment map would just go on forever. The black kinda marks where the effect ends. I wanted to end at a certain point, but not be perfectly even. Hence the lozenge shape.

    So why am I able to see the effect in my example all the way to the end of the room? Cuz I did something in the code to fix that.

    So here's the code itself...

    Quote Originally Posted by Code
    force_opaque
    edge_padding 0

    render_pass
    {
    texture material\Rorph\MoonSpec
    alpha 0.6
    blend SRC_ALPHA ONE
    uv_source ENVIRONMENT
    uv_mod SCALE 2 2
    }

    render_pass
    {
    texture $texture
    shaded
    }
    See that bit where it says uv_mod SCALE 2 2? What that does is sets it up so that my environment map is being displayed something like this in engine...



    So why didn't I just make my initial texture look like that? Well...I'm still kinda learning the ropes here. This allows me to goof around with it until I get an effect I'm happy with.

    So what does the code mean in general? As far as I know (and if I'm wrong, feel more than doubly free to correct me), it goes like this...

    force_opaque
    Tells the engine to draw the texture without any regard to the underlying alpha. In other words, the alpha doesn't effect the underlying texture itself. It just uses the alpha as a mask for your various effects.

    ...or at least that's what I think it does. Taking it out doesn't produce any noticeable differences as far as I can tell. Maybe I just wasn't looking hard enough.

    edge_padding 0
    Adds a layer of pixels surrounding the edges of your alpha. Like if you have a chain link fence texture with the black part of the alpha the spaces between the links, it'll draw a padding of purple pixels around those.

    render_pass
    {
    texture material\Rorph\MoonSpec
    Texture location. DERP!

    alpha 0.6
    Strenth of the overlaying alpha effect, going from 0.0 (not drawn) to 1.0 (overlaid in full without any blending whatsoever).

    I actually like my effect set at 0.4. It's more subtle, and looks better in darker sections of the map. I bumped it up to 0.6 for the videos and screenshots.

    blend SRC_ALPHA ONE
    Blending type. I'm a bit iffy on what does what here at the moment. Based on what little I know about programming, this isn't quite like layer effects in Photoshop, but more about the end results being sent from a source (which I think is your texture) to the destination (I think is the frame buffer). What you get are sorta like the layer effects in Photoshop, but...GAWWWW!

    Breaks my damn brains is what it does. I gotta play with this more to see what does what.


    uv_source ENVIRONMENT
    The readme does a good job explaining this bit. You can use this to overlay a texture, bake on a lightmap from a different source, give it an environment effect (what I did here), or make it display a cubemap in the alpha.

    ...though ENVIRONMENT and PROJECTION don't seem to produce different results from my limited experimentation with them. this might be because I don't have an actual cubemap to play with yet.

    uv_mod SCALE 2 2
    See above.

    render_pass
    {
    texture $texture
    shaded
    }

    Okay, this last bit. What I think it does is allows a materialed texture to have a lightmap baked onto it when you portalize your maps. Still not 100% sure on this one, either.

    Next up, I'll tell you all how I did my windows in the RIGHT NOW thread. It's basically the same thing, but with one extra step and a different alpha map configuration.
    Last edited by Renzatic; 10th Jan 2013 at 02:41.

  9. #9
    Member
    Registered: Nov 2003
    Location: France
    Nice work on that floor. I'll have to try something like that on some of my floor textures as well.

    On the section "blend SRC_ALPHA ONE". I used "blend SRC_COLOR ONE" instead. Maybe I'm wrong, but when I use that it seems to stay related to the color of the light sources.

  10. #10
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    Quote Originally Posted by GORT View Post

    On the section "blend SRC_ALPHA ONE". I used "blend SRC_COLOR ONE" instead. Maybe I'm wrong, but when I use that it seems to stay related to the color of the light sources.
    Just changed it, and yup...that does look a lot better. It's a more low key effect now, you have to be right over it to just barely see it in dark sections, and it gives things a more subtle sheen in brighter lights.

    What's weird though is that changing the alpha values doesn't produce any noticeable results now. It always remains the same strength from 0.1 all the way to 1.0. I guess that's because it's blending the colors between the glow texture and the floor texture, rather than overlaying one on top of the other now. The glowy spec effect is just it changing colors when the environment map rolls over that part of the texture, giving you the impression that it's reflecting light.

    Right now, I'm really wishing I had a list showing me exactly what all the different blend modes do. Googling doesn't bring up all that much info.
    Last edited by Renzatic; 10th Jan 2013 at 08:44.

  11. #11
    Member
    Registered: May 2002
    Location: Toronto
    This is excellent! Thanks for the pioneering work Renzatic!

  12. #12
    Member
    Registered: Dec 2001
    Looks cool, better than that fake reflection in TDS (it always looked like metal to me), although to have a proper specular it needs to be modified by bump or normalmap. Does NewDark have this feature?

  13. #13
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    Quote Originally Posted by Judith View Post
    Looks cool, better than that fake reflection in TDS (it always looked like metal to me), although to have a proper specular it needs to be modified by bump or normalmap. Does NewDark have this feature?
    Naw, it's nowhere near an actual specular. It doesn't react to any of the surrounding lighting or anything. Rather, it's an cubemap that's been masked to simulate one.

    You could probably do the same thing in TDS actually. Thing is, you have to design it for the environment you plan on having your texture/object in. Like the dark, moonlit room I have above needs a subtle blue glow to look like it reflects the light from the windows (or orange for torches). Something in a bright room will need...yeah...something brighter and lighter in color. Like I said above, it's situational.

    And I wish it had normalmaps. I wouldn't be having so much trouble making convincing plaster walls if I did. Best I can do right now is make detail textures like they had in Arx Fatalis.

  14. #14
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    Now it's time for MOON WINDOW!

    This is really just a slight extension to what I did above. All it's got is an extra stage I used for the grime and glow on the glass panes.

    These are the components that make up the texture.

    The diffuse (really a fancy word for texture in this case)


    It's alpha


    The moon cubemap effect (that isn't a cubemap at all, and I'll explain why it's off center below)


    And the window glow effect


    The code to get all this to come together is...

    force_opaque
    edge_padding 0

    render_pass
    {
    texture material\Rchurch\windowglow
    alpha 0.15
    blend SRC_ALPHA ONE
    }

    render_pass
    {
    texture material\Rchurch\moonglow2
    alpha 1.0
    blend SRC_ALPHA ONE
    uv_source PROJECTION
    uv_mod SCALE 1 1
    }

    render_pass
    {
    texture $texture
    shaded
    }
    The first part is the only part that hasn't been covered previously. What this does is simply takes my grime and glow texture, and overlays it on top of the glass panes. If I just wanted to add the grime effects, I could've done that within the alpha mask on the main texture. But I wanted to give the window a soft, ambient sheen. Overlaying a static texture to work as a dual light/grunge map works better to produce the intended results.

    Now, the faux cubemap itself. You're probably wondering why it's offset the way it is. I wanted the moon to be shining down from above. Setting it perfectly in the center made it look like the moon was directly on the horizon, almost but not quite in the middle of the window. I figured moving the texture up would fix that and give me the results I wanted, but...nope. Turns out up and down in game is mapped left to right on a projection texture. Why? No idea. It's one of the many things that makes me think I'm not doing everything 100% correctly here.

    The final texture looks like this...



    ...with the moon moving separately from the rest of the texture, giving it an illusion of depth.

    (I should also add that I changed the texture a bit from the video I made earlier for the other thread. It used to be set to uv_mod SCALE 2 2 to produce a smaller moon. What you're seeing above is SCALE 1 1. I ended up liking the bright sky look a little better than the freefloating moon.)

    That's basically it. Most of the work is setting up your textures properly. The code is fairly simple and straightforward once you know what it does.

    Next up, I'm gonna try playing with the animation settings. See if I can make a rippling water effect. I think I might be able to do that with the wave functions.
    Last edited by Renzatic; 10th Jan 2013 at 22:49.

  15. #15
    Member
    Registered: Mar 2001
    Location: Helsinki, Finland
    Good stuff Renzatic! However I have problems getting the effects appear.

    I have tile texture tile1.png, material file tile1.mtl and an environment map env.png in Thief2\fam\tiletest\. Material file has following code:

    force_opaque
    edge_padding 0

    render_pass
    {
    texture fam\tiletest\env
    alpha 0.6
    blend SRC_ALPHA ONE
    uv_source ENVIRONMENT
    uv_mod SCALE 2 2
    }

    render_pass
    {
    texture $texture
    shaded
    }

    My texture has an alpha made in similar style like in your tile texture and the environment map is just a copy of your moon specular. Any idea what I'm missing here? DromEd recognizes the material file as indicated by the small 'M' emblem in texture window.

  16. #16
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    It might be because of the way you have your material files organized, maybe? See, I keep my stuff divided into two folders. To make it more clear, I'll tell you how I have my floor texture and all the related materials to it set up.

    In my Thief2\Fam\Rorph folder, I have two files.

    BathFloorTileA.tga (the base texture)
    BathFloorTileA.mtl (the material)

    In my Thief2\Material\Rorph folder, I have...

    FloorSpec.inc (the actual material)
    Moonspec.tga (the lozenge shaped glow overlay I reference in FloorSpec.inc)

    The .mtl file isn't actually the material you pop all the code into. It's a reference connecting that texture to all the pertinent files lying inside your Thief2\Material folder. The only text I have inside my .mtl folder is this...

    include ../../material/Rorph/FloorSpec.inc
    FloorSpec.inc is another renamed .txt file, and it's the file I pop in all the code I've listed above into.

    In other words, your .mtl file is there to tell that texture what shaders to use in your material file. And what are your shaders? Those are your .inc files. That's where you put your code.

    Now your .inc file doesn't set by itself inside your materials folder. It's also got your effect .tga (your glows, clouds, ect) files in there alongside it.

    Confusing, huh? Here's a screenshot to help you out a little bit.

    So to break it down...

    Base texture and .mtl file go into Thief2\fam\MyFM

    Your .inc and image files related to those shaders go into Thief2\Material\MyFM

    If you've got it all set up right, when you launch into the game, you should see your effects in action.

    Clear? Probably not, but I'll be here for the next little bit if you've got any questions. :P

    Quote Originally Posted by Albert View Post
    I dunno if this would make any sense, but can a parralax effect be done using .mtl settings? Y'know, to create a false illusion of depth with certain things.
    Hmmm. Don't quote me on this, but I'm thinking probably not. If you're talking about those parallax effects like you see in DX: HR, I haven't seen any references to them in the readme file. The engine only seems to be able to use one type of cubemap.

    edit: to help you all out, here's a link to the textures and mat files I've been talking about above. Just drag and drop it all.
    Last edited by Renzatic; 11th Jan 2013 at 03:41.

  17. #17
    Member
    Registered: Dec 2001
    Quote Originally Posted by Renzatic View Post
    Naw, it's nowhere near an actual specular. It doesn't react to any of the surrounding lighting or anything. Rather, it's an cubemap that's been masked to simulate one.

    You could probably do the same thing in TDS actually. Thing is, you have to design it for the environment you plan on having your texture/object in. Like the dark, moonlit room I have above needs a subtle blue glow to look like it reflects the light from the windows (or orange for torches). Something in a bright room will need...yeah...something brighter and lighter in color. Like I said above, it's situational.

    And I wish it had normalmaps. I wouldn't be having so much trouble making convincing plaster walls if I did. Best I can do right now is make detail textures like they had in Arx Fatalis.
    Aw, that's a shame. So yes, it's more like this effect in TDS I tried to fiddle with long time ago. Normals wouldn't help here though, you can use them in TDS and the cubemap "bypasses" them completely, i.e. fake reflection is modified only by alpha map and intensity value :/

    Btw. this is a cubemap cubemap (6-layer image using reference to dimensional planes, +x, -x, +y, etc.) or a single image?

  18. #18
    Member
    Registered: Mar 2001
    Location: Helsinki, Finland
    Quote Originally Posted by Renzatic View Post
    Clear? Probably not, but I'll be here for the next little bit if you've got any questions. :P
    Many thanks, that all made it very clear. And thanks for the sample files too .

  19. #19
    Member
    Registered: Oct 2004
    Location: Ireland/Poland
    Great job Renzatic with discovering all the mysteries of the .mtl files. I gave it a go while back ago, but got a bit frustrated with the lack of expected results. Having some working examples is a great thing.

    There's one thing I'm wondering about - as Dromed still references textures, not materials, is it possible to have two (or more) materials using the same texture? Let's say you want another version of your window, without the moon glow effect. Can you just create a separate .mtl definition without duplicating the base texture file under a different name?


    Quote Originally Posted by Judith
    Looks cool, better than that fake reflection in TDS (it always looked like metal to me), although to have a proper specular it needs to be modified by bump or normalmap. Does NewDark have this feature?
    Before NewDark does normal bump mapping, it has to be able to do pixel shading. There is a long way, I suppose, but who knows - maybe not THAT long? It already runs under DX9...
    When I read the MTL files documentation for NewDark, my first impression was, that this is a strong basis for some more robust system to come in future. I hope the developers of this patch are still working on it, and they plan on extending it further.

  20. #20
    d. 30.4.16 Always remembered
    Registered: Apr 2002
    Location: in our hearts
    I'm totally fascinated. Too bad that all this is Greek to me. I Wouldn't even know how to start and how to make an alpha mask...

    Thanks for sharing.

  21. #21
    Member
    Registered: Dec 2001
    Quote Originally Posted by Lady Rowena View Post
    I'm totally fascinated. Too bad that all this is Greek to me. I Wouldn't even know how to start and how to make an alpha mask...

    Thanks for sharing.
    It's easy LR, you take a diffuse texture and use selection tool to define areas that are to be transparent or opaque and fill them with a proper color from grayscale range (0-255). Black color represents full transparency and white is fully opaque. Sometimes you can just desaturate diffuse texture and work on from there, other time it's more about selection tool and tedious manual work. Anyway it's not that hard At least I prefer modelling and working with textures to things like scripting, writing your own shaders or materials. Any code work really, even level design is so time consuming these days.


    Before NewDark does normal bump mapping, it has to be able to do pixel shading. There is a long way, I suppose, but who knows - maybe not THAT long? It already runs under DX9...
    True, I forgot about that. At least NewDark has the oportunity to get proper shaders, unfortunately TDS is based on DX 8.1...
    Last edited by Judith; 11th Jan 2013 at 16:12.

  22. #22
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    Quote Originally Posted by PinkDot View Post
    Great job Renzatic with discovering all the mysteries of the .mtl files. I gave it a go while back ago, but got a bit frustrated with the lack of expected results. Having some working examples is a great thing.
    No prob. It's kinda fun in a frustrating, tedious step by step sorta way. :P

    There's one thing I'm wondering about - as Dromed still references textures, not materials, is it possible to have two (or more) materials using the same texture? Let's say you want another version of your window, without the moon glow effect. Can you just create a separate .mtl definition without duplicating the base texture file under a different name?
    I thought about this myself, actually. Right now, I don't think it's possible, because the .mtl file has to directly reference the base texture it's being used on. If you want separate instances of WindowA with and without the moon effect, you'll have to make a copy of A, name it WindowB or something, then tie it to the new effect with another .mtl file.

    ...BUT (and I just thought of this...)

    You might be able set it up so that WindowA is a material effect itself, with the other effects being run underneath it. Your base could be some small 256x256 texture applied inside Dromed. You'd save a bit of texture memory doing this, but...well...we don't know the costs of having a bunch of materials packed in a single scene yet. You'd have to consider which would be worse. A potential performance hit, or a few extra megs of redundant textures?

  23. #23
    Moderator and Priest
    Registered: Mar 2002
    Location: Dinosaur Ladies of the Night
    Quote Originally Posted by Judith View Post
    True, I forgot about that. At least NewDark has the oportunity to get proper shaders, unfortunately TDS is based on DX 8.1...
    The questions here though are, 1. are the guys who originally worked on the new patch still at it, or is this a one time thing, and 2. if Dark goes full on pixelshaded realtime lighting, will people use it, or will it scare the everliving hell out of everyone?

    Then again, taking advantage of DX9 doesn't necessarily mean it has to use realtime lighting. It could use a setup similar to Source, where it uses normal and spec textures, but bakes radiosity in sorta like Dark does now.

    edit for great powah: Just found out how to make cubemaps from the modders-notes readme packed in docs.

    I'M AWN IT, SONS!
    Last edited by Renzatic; 12th Jan 2013 at 00:42.

  24. #24
    Member
    Registered: Dec 2001
    Quote Originally Posted by Renzatic View Post
    The questions here though are, 1. are the guys who originally worked on the new patch still at it, or is this a one time thing, and 2. if Dark goes full on pixelshaded realtime lighting, will people use it, or will it scare the everliving hell out of everyone?

    Then again, taking advantage of DX9 doesn't necessarily mean it has to use realtime lighting. It could use a setup similar to Source, where it uses normal and spec textures, but bakes radiosity in sorta like Dark does now.

    edit for great powah: Just found out how to make cubemaps from the modders-notes readme packed in docs.

    I'M AWN IT, SONS!
    I'd put my bet on radiosity/lightmapping, not dynamic lights. Apparently even modern game engines like UE 3.0 use mostly static lights. The effects like flicker or pulse are done with material effects, it still looks good.

  25. #25
    d. 30.4.16 Always remembered
    Registered: Apr 2002
    Location: in our hearts
    Quote Originally Posted by Judith View Post
    It's easy LR, you take a diffuse texture and use selection tool to define areas that are to be transparent or opaque and fill them with a proper color from grayscale range (0-255). Black color represents full transparency and white is fully opaque. Sometimes you can just desaturate diffuse texture and work on from there, other time it's more about selection tool and tedious manual work. Anyway it's not that hard At least I prefer modelling and working with textures to things like scripting, writing your own shaders or materials. Any code work really, even level design is so time consuming these days.
    I know how to make a simple mask using the selection tool, I did it before. But I can't understand how to make a "shaded" mask like the one in the 2nd picture.
    Maybe it's because my graphic program is too old and doesn't have this feature. I had it in bundle with a Matrox Millenium G200...
    Or maybe I just don't understand the English terms which are used, since I have the Italian version.
    But I don't want to derail this thread to a "how to use your graphic program" lesson. I have other programs that I neglected until now, i.e. Photoshop 6. maybe it's time to start learning and experiment with them.
    Thanks for answering.

Page 1 of 2 12 LastLast

Posting Permissions

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