mtl files for your textures question... - by GORT
Sliptip on 10/1/2013 at 17:49
This is excellent! Thanks for the pioneering work Renzatic!
Judith on 10/1/2013 at 18:40
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?
Renzatic on 11/1/2013 at 00:56
Quote 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?
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.
Renzatic on 11/1/2013 at 03:06
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)
Inline Image:
https://dl.dropbox.com/u/3018396/Ivy_Wall_D.jpgIt's alpha
Inline Image:
https://dl.dropbox.com/u/3018396/Ivy_Wall_A.jpgThe moon cubemap effect (that isn't a cubemap at all, and I'll explain why it's off center below)
Inline Image:
https://dl.dropbox.com/u/3018396/Ivy_Wall_Moon.jpgAnd the window glow effect
Inline Image:
https://dl.dropbox.com/u/3018396/Ivy_Wall_Glow.jpgThe code to get all this to come together is...
Quote:
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...
Inline Image:
https://dl.dropbox.com/u/3018396/Ivy_Wall_Final.jpg...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.
Wille on 11/1/2013 at 07:44
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.
Renzatic on 11/1/2013 at 08:16
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...
Quote:
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? (
https://dl.dropbox.com/u/3018396/Folder_Confusion.jpg) 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 Posted by Albert
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, (
https://dl.dropbox.com/u/3018396/Thief_Textures/Materials.zip) here's a link to the textures and mat files I've been talking about above. Just drag and drop it all.
Judith on 11/1/2013 at 09:42
Quote Posted by Renzatic
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?
Wille on 11/1/2013 at 10:07
Quote Posted by Renzatic
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 :thumb:.
PinkDot on 11/1/2013 at 13:32
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 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.
Lady Rowena on 11/1/2013 at 19:32
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. :)