mtl files for your textures question... - by GORT
GORT on 9/1/2013 at 04:44
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. :p
Lady Rowena on 9/1/2013 at 16:25
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.
SlyFoxx on 9/1/2013 at 18:46
This is all new to me. But then clean socks would be new to me.:o
voodoo47 on 9/1/2013 at 20:41
you can do a lot of crazy stuff with mtls - reflections, movements and much more, check the documentation.
Renzatic on 10/1/2013 at 01:10
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.
LarryG on 10/1/2013 at 02:48
Yeah. I'm looking forward to someone really smart and literate writing up a tutorial on their use.
Renzatic on 10/1/2013 at 03:03
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.
Renzatic on 10/1/2013 at 07:02
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...
(
https://dl.dropbox.com/u/3018396/GlowMoon.jpg) Moon Glow
(
https://dl.dropbox.com/u/3018396/GlowTorch.jpg) 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...
(
https://dl.dropbox.com/u/3018396/Video/FloorSpec_Test.mp4) 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)...
Inline Image:
https://dl.dropbox.com/u/3018396/Effect_Floor.jpgThen, I made the mask and popped it into the alpha channel
Inline Image:
https://dl.dropbox.com/u/3018396/Effect_Floor_Alpha.jpgIt 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...
Inline Image:
https://dl.dropbox.com/u/3018396/Effect_Floor_Glow.jpgDon'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 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...
Inline Image:
https://dl.dropbox.com/u/3018396/Effect_Floor_Scale.jpgSo 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...
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.
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.
Quote:
render_pass
{
texture material\Rorph\MoonSpec
Texture location. DERP!
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.
Quote:
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.
Quote:
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.
See above.
Quote:
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.
GORT on 10/1/2013 at 12:35
:thumb: 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.
Renzatic on 10/1/2013 at 13:30
Quote Posted by GORT
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.