Quote Posted by Renzatic
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
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...
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.
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.
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.
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.
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.