Light cone proof of concept
Light cone proof of concept
So here's something I kinda' figured out today. Cones of light eminating from lamps. It's a feature seen in Unreal Tournament and it can also be pulled off in Descent 3, although it has a couple minor quirks.
Basically, you prepare a custom texture that's a 24-bit uncompressed TGA image of a white to black gradient, 128x128, with white on top and black on the bottom. use GAMTool to create a custom texture with the following properties:
Alpha: 0.10
Flags:
- Fly through
- Alpha
Import it into your level. Now, create cones by extruding a face from the light fixture and expanding the bottom of this cone. Apply your custom texture onto it and use texture alignment -> face map to stretch the gradient over the entire face. You may wish to use the "Outrage Test" texture to align it correctly, since it seems to appear as colored fuzz in D3Edit.
And there you go!
I mentioned it has a couple little quirks. First, around the edges, particularly at the bottom, you can sometimes see a glowy edge. Second, sometimes when you fly from the right angles, you can see a "sheen" over the face. It's better than nothing though.
(The level? Never mind it. It's a test bed and nothing more)
- Jon the Great
- DBB Captain
- Posts: 538
- Joined: Fri Nov 28, 2003 3:01 am
- Location: California
- Sapphire Wolf
- DBB Admiral
- Posts: 1463
- Joined: Mon Nov 24, 2003 3:01 am
- Location: Nope.avi , gender: male
- Contact:
-
- DBB Ace
- Posts: 484
- Joined: Fri Nov 16, 2001 3:01 am
- Location: Staten Island, New York USA
-
- DBB Ace
- Posts: 484
- Joined: Fri Nov 16, 2001 3:01 am
- Location: Staten Island, New York USA
I tried a similar technique once before. The effect itself looked good, but I'm no level designer Here's a few things to point out:
In the GAM table, setting the Saturate flag should make blending additive, which is what light actually does and is hence more realistic (look at the bottoms of your light cones). A low alpha value is good for this (.1 is a good value by the looks of the screenshot). Or you could make the whole texture white, and put the gradient in the alpha channel (quite easy to do in Photoshop, although there really really ought to be a way to directly draw in the alpha channel, instead of messing around with selection masks). Not as realistic as actual additive blending, but it depends on how it's used. It's the result that counts.
"First, around the edges, particularly at the bottom, you can sometimes see a glowy edge."
This might be due to mipping of the texture, which would cause texture coordinates that would otherwise be on the edge of the bottom to be beyond the bottom, which would produce some abnormally bright texels. In whatever tool you use to create the OGF, try disabling mipmap generation. You should also be able to use a smaller texture than 128x128, since it is just a vertical gradient. 64x64 is about right, methinks. You could also try using a 16 bit dithering plugin (not very common, for more or less obvious reasons) to help tame any banding.
"Second, sometimes when you fly from the right angles, you can see a "sheen" over the face."
I'm not sure what you mean by "sheen", but it might be because of either D3's screen clipping and triangulation (which D3 had to perform manually since Glide didn't offer any such functionality, and it doesn't do a particularly good job it), or because of mipmapping. In the latter case, disabling mipmap generation should fix this as well.
Hope this helps ^^
In the GAM table, setting the Saturate flag should make blending additive, which is what light actually does and is hence more realistic (look at the bottoms of your light cones). A low alpha value is good for this (.1 is a good value by the looks of the screenshot). Or you could make the whole texture white, and put the gradient in the alpha channel (quite easy to do in Photoshop, although there really really ought to be a way to directly draw in the alpha channel, instead of messing around with selection masks). Not as realistic as actual additive blending, but it depends on how it's used. It's the result that counts.
"First, around the edges, particularly at the bottom, you can sometimes see a glowy edge."
This might be due to mipping of the texture, which would cause texture coordinates that would otherwise be on the edge of the bottom to be beyond the bottom, which would produce some abnormally bright texels. In whatever tool you use to create the OGF, try disabling mipmap generation. You should also be able to use a smaller texture than 128x128, since it is just a vertical gradient. 64x64 is about right, methinks. You could also try using a 16 bit dithering plugin (not very common, for more or less obvious reasons) to help tame any banding.
"Second, sometimes when you fly from the right angles, you can see a "sheen" over the face."
I'm not sure what you mean by "sheen", but it might be because of either D3's screen clipping and triangulation (which D3 had to perform manually since Glide didn't offer any such functionality, and it doesn't do a particularly good job it), or because of mipmapping. In the latter case, disabling mipmap generation should fix this as well.
Hope this helps ^^
- Liquid Fire
- DBB Ace
- Posts: 403
- Joined: Wed Oct 15, 2003 2:01 am
- Location: Los Gatos, CA, USA
- Contact:
That's pretty spiffy, although I could make one suggestion. Instead of having the rectangle on the light connect to a larger rectangle on the floor like you have there, have the one on the floor be an octagon. Light rarely ends up perfectly square and having it assume a shape which at least resembles a circle might look better.
In all of the UT games, these are essentially pre-canned meshes. In the old UT, it's lightcone and lightbox, which are cone-shaped and pyramidal-shaped with a gradient texture on them. These props could then be scaled to fit the light in question. You could also make your own by constructing a brush and sticking a light in the middle and texturing it with the texture on the light cones. Various maps make use of these. UT2K3/2K4 has these as static meshes, often with a bit of animation so the glow tapers in and out. You see these in DM-Gael, for example. In UT2K3/2K4, you can also approximate the effect using a particle emitter that creates a short chain of glowy particles (see DM-Sulphur). This cheat is useful for when you need the effect to appear behind something that's already alpha transparent, like glass. For me, at least, I couldn't have a semi-transparent lightcone appear behind glass. Don't know if that's an Unreal issue or a video card issue.Duper wrote:U Da Man!
How is it done in UT? I assume they have a function for that FX?
- Jon the Great
- DBB Captain
- Posts: 538
- Joined: Fri Nov 28, 2003 3:01 am
- Location: California