Archived

This topic is now archived and is closed to further replies.

NotTaxes

How do I do a torch?

Recommended Posts

NotTaxes    122
Hi, I think I''ve got a pretty good understanding of vertex lighting and lightmaps, but I just can''t figure out how I would do a directional light, like a hand-held torch, that would look half-decent. My geometry can get quite complicated at times, so using a lightmap doesn''t make much sense to me because I''d have to do serious amounts of texture co-ordinate calculations, after first doing hit-ray collision against all the vertices to see if they''re going to be affected by the beam. This just sounds way too hectic and slow. Any direction on this would be fantastic.

Share this post


Link to post
Share on other sites
Tessellator    1394
The only way i've experimented with so far is by projecting the light "area" - a bright circle - forward in the direction of the torch. However, if you don't have a texture unit spare, this means having to render quite a lot of geometry in a seperate pass... I was rendering anything I thought might get hit by the tourch beam, but it was quite costly (I sort of tacked the method on and my worldly chucks of vertices were pretty massive..).

There are other problems with this method - the main contender being that the back area of an object is also illuminated by the projected texture (although this is not much of a problem if the torch origin is near your view point since you can't see the back areas of illuminated objects).

There are a few references around about projected textureing on the net, but nvidia have some good examples on their site, with code included.

I've also seen a few torches implemented using a standard spot-light - but unless you geometry is nice and tessellated, these always look a bit turd .

T

[edited by - Tessellator on May 5, 2002 5:32:42 PM]

Share this post


Link to post
Share on other sites
NotTaxes    122
Dagnabit!

That can''t be right... my speed''s going to drop off the bottom of the single-digit scale!

Surely there''s got to be a better way? I mean, what about just doing simple circular shadows underneath characters (like in Q3)? If I have to go through the incredibly slow process of re-creating my vertex buffers with new texture co-ordinates just for a second pass with a light/dark circle it''s going to be just way too slow.

Sigh. I shall sacrifice visual looks for speed and hope for the best.

Share this post


Link to post
Share on other sites