Textures - override skip lightning vs. emissive masks - by Judith
Judith on 31/8/2009 at 09:09
I thought you might find it useful, because I haven't found any article on this in Fleshworks wiki.
You probably know that
Override skip lightning option in Ion Shader is used mostly for making that glowing effect you see on windows or stained glass, where you need an illusion of light coming from the inside. The problem is, such material will only use its diffuse channel, your normalmap texture won't be used.
No worries though, there's a way to have nicely lit window with a normalmap, that's what the
emissive channel is for. If you have a diffuse and a normalmap for your window, make a copy of the first one and open it in Photoshop or Gimp. Now, desaturate it and make an image similar to a specular map, where the bright parts will be emitting light and the black ones won't be lit. Unfortunately, the emissive channel doesn't recognize the colour of your texture, so no yellow windows with pink glow, etc. ;)
Now press Ctrl + C and fill the whole image with white colour. Add the layer mask to the image (full opacity) and paste the image into it. Now you have a nice emissive texture, this is what I got while working with my stained glass:
(
http://img207.imageshack.us/i/24124051.jpg/)
Inline Image:
http://img207.imageshack.us/img207/5151/24124051.th.jpgIf you want the effect to be more subtle, i.e. light more dim, you can use the Levels in layer mask mode to decrease the maximum level of white colour. When you're done, apply your layer mask and save the .dds image using the DXT 3 or 5 compression format. Remember to give your texture a suffix you'll easily recognize, like _E.dds or _EM.dds. Now open the Ion Shader, put the diffuse and normal textures to their slots. Scroll down to the
emissive mask field and put your EM texture here. Put the whole material to your library, save it, export it to mlb, put the textures in appropriate TDS folders (Textures/PCTextures), and test it in the editor.
The difference between override skip lightning option (left cube) and emissive mask (right cube):
(
http://img171.imageshack.us/i/88105616.jpg/)
Inline Image:
http://img171.imageshack.us/img171/2875/88105616.th.jpgYou can see that on the left the contrast of this window is altered, the black parts of this window are brighter than usual.
Also I thought that more subtle use of this technique might be useful in other areas, like in metals, where you'd like to emphasize some shiny parts. You'll have to be careful though, it will be "shining" in the dark as well ;) Not so subtle example of that technique below:
(
http://img143.imageshack.us/i/57934369.jpg/)
Inline Image:
http://img143.imageshack.us/img143/8859/57934369.th.jpgNote: unfortunately, you can't use cubemaps neither with skip lightning nor with emissive masks.
Beleg Cúthalion on 31/8/2009 at 12:56
The right stained glass box in the second image looks awesome. :thumb: One more great thing to use... somewhen in the future. :erg:
Judith on 31/8/2009 at 21:15
Don't give up, you'll get your mission to work, eventually.
Ok, it will be quite hard to draw conclusions from that but... I took my old stained glass window to see whether the emissive mask works with it. As you might remember, I used this window with alpha testing option to make the transparent glass. So it was saved with alpha channel with all the glass parts cut out. I made the emissive mask texture for it as well, it looks like this:
(
http://img220.imageshack.us/i/48716730.jpg/)
Inline Image:
http://img220.imageshack.us/img220/8427/48716730.th.jpgFirst of all, I didn't check the
alpha testing box, just to test the emissive texture. Ingame it looks like this:
(
http://img442.imageshack.us/i/85134102.jpg/)
Inline Image:
http://img442.imageshack.us/img442/7229/85134102.th.jpgOk, it works like it should. The alpha channel in the diffuse isn't taken into account, we have nicely lit opaque window. When I check the
alpha testing box with the value at 0, the window looks like this:
(
http://img220.imageshack.us/i/16741022.jpg/)
Inline Image:
http://img220.imageshack.us/img220/5170/16741022.th.jpgHmm... You can see through the glass, but the frame is no longer black, the brightness changed but unlike the first stained glass, the contrast isn't preserved.
Then I tried to change the value to something higher, like 128:
(
http://img70.imageshack.us/i/72453617.jpg/)
Inline Image:
http://img70.imageshack.us/img70/2346/72453617.th.jpgNow that's :weird: Is the value of alpha testing is a threshold for colour range?
But that's not all, it's the material with no transparency in the diffuse where it gets really interesting. This railing is fully opaque in the diffuse, has a subtle emissive texture to highlight some of its parts and alpha testing checked with the value of 0:
(
http://img74.imageshack.us/i/57216962.jpg/)
Inline Image:
http://img74.imageshack.us/img74/4641/57216962.th.jpg:eek: Honestly, I don't know how we might use this one, but again it looks like the value of alpha testing is a kind of threshold for colour range. Some parts of the diffuse look like they were scraped off and all that's left is the normalmap "underneath"...
Notice that in the green window, the "scraped off" parts are visible only where the glass is. Is it the alpha channel in the diffuse or the emissive texture that defines it? I'd vote for emissive, for the railing texture is opaque and the result is similar. Green window diffuse has it's transparent areas and it's emissive texture covers those as well, so that's why it's transparent? My head hurts... :sweat:
str8g8 on 1/9/2009 at 12:42
it's sometimes usefull to work with test maps when trying to figure out what does what in a shader - checkerboard textures etc.
the stained glass looks much better with proper blacks.
massimilianogoi on 1/9/2009 at 20:55
Those images of railing doesn't give the idea, we can have the right idea seeing them in an animation, detailed of course. (HD)
Judith on 1/9/2009 at 21:55
Don't know if it helps really, but here goes the video:
(
http://www.sendspace.com/file/bwf96m)
The first railing is the example from the first post, notice how the shiny parts glow in the dark due to the emissive mask, that doesn't look right but some more subtle version of that might actually work.
The second example is a railing from the last shot.
massimilianogoi on 2/9/2009 at 02:36
Hm.... the second ones are interesting... are they detached from that green stuff?
Judith on 2/9/2009 at 06:30
Yes, and they're tilable, but it's the same model in both cases, just a different material setup.
massimilianogoi on 7/9/2009 at 09:02
Are them for private use or public? Those rusting railings would fit well in my butcherey...
Judith on 7/9/2009 at 10:49
It was exported from my Gears of War map, so it might be a little unoptimized for T3. It has 1224 faces. But if you want it, no problem :)
There you go:
(
http://www.sendspace.com/file/3s5fht)
Since you got max I thought you'd like to make the material library yourself.