Page 1 of 1

Light cone proof of concept

Posted: Sat Nov 13, 2004 10:42 pm
by Kyouryuu
Image

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)

Posted: Sat Nov 13, 2004 10:53 pm
by Jon the Great
That's awesome!! Thanks dude! :D

Posted: Sat Nov 13, 2004 11:05 pm
by DCrazy
Same trick is used for the projector in cs_office. :P

Posted: Sat Nov 13, 2004 11:11 pm
by Sapphire Wolf
That is Awesome man!

Posted: Sun Nov 14, 2004 5:48 pm
by pipsqueak10
Very cool tip

Posted: Sun Nov 14, 2004 5:54 pm
by Stryker
Awesome! That'll be helpful, if somewhat tricky, for indoors areas.

Posted: Sun Nov 14, 2004 9:04 pm
by pipsqueak10
very nice effect!

Posted: Sun Nov 14, 2004 9:46 pm
by Duper
U Da Man!

How is it done in UT? I assume they have a function for that FX?

Posted: Sun Nov 14, 2004 10:03 pm
by Arbitar
Duper wrote:How is it done in UT? I assume they have a function for that FX?
I was going to ask the EXACT same question :D

Posted: Mon Nov 15, 2004 1:57 am
by Top Gun
I vote that Kyouryuu should get the custom title of "D3 Design God." :D

Posted: Mon Nov 15, 2004 3:32 am
by pATCheS
I tried a similar technique once before. The effect itself looked good, but I'm no level designer :P 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 ^^

Posted: Mon Nov 15, 2004 9:37 am
by Liquid Fire
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.

Posted: Mon Nov 15, 2004 9:23 pm
by Kyouryuu
Duper wrote:U Da Man!

How is it done in UT? I assume they have a function for that FX?
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.

Posted: Tue Nov 16, 2004 1:05 am
by Jon the Great
Top Gun wrote:I vote that Kyouryuu should get the custom title of "D3 Design God." :D
I like the idea but how about 'God of Level Making' ? :P

Posted: Tue Nov 16, 2004 7:04 pm
by Boo
We could just get down to the basics and call him "god" :P

Posted: Tue Nov 16, 2004 11:21 pm
by Kyouryuu
I really wouldn't go that far. :P

Posted: Wed Nov 17, 2004 1:23 am
by Arbitar
Hehe I don't think having [copypaste]Kyouryuu[/copypaste] as God would be good :wink:

We'd all be stuck in little glass tubes while he experiments his fancy lighting effects on us o.O


^_^