Game Development Community

dev|Pro Game Development Curriculum

Lightning Anyone?

by Josh Moore · 10/07/2006 (9:50 pm) · 38 comments

After a long time of off-and-on development, I finaly have a functional, decent looking(IMHO) lightning effect for the Torque Shader Engine bounty packaged and submitted! It's taken about 5 major code reversions to get the current system. I experimented with more than a few object setups and rendering methods untill I came up with something solid enough for a general solution.

static.flickr.com/111/260032610_0e53bb5405_o.jpg
Currently the lightning is lacking some important features(such as SM 1.x support), but I think it's ready to be used. I've uploaded an initial version that can be dropped right into a TSE HEAD build. The download can be found on the TSE Lightning Bounty page. I'm waiting on some feedback from GarageGames and from the community before starting the next level of development.

More screenshots:
static.flickr.com/88/260032609_2a5a2e1b5a_o.png
static.flickr.com/91/260032608_aab82b507e_o.png
static.flickr.com/91/260032607_236ad5c3d8_o.png


From the lightning.h source file:
Quote:
The new lightning system uses a 2 datablock setup; one to define
a certain type of lightning strike, the other to define an actual
lightning object (or storm). I chose to go with this route as it
allows for mixing and matching of strikes and sounds (and other data)
inbetween different lightning object datablocks. It also allows for
for more control over a specific type of strike, and supports upto
eight different lightning strike types in a single object/storm instance.

Lightning objects themselves are SceneObjects that can now be placed
and moved anywhere in the map. The lightning strikes inside of the
object's scaled bounding box, so it can be confined to certain sections
of terrain, or even inside interiors. If need be, an option to use the
mission area as the strike zone could be added.

Lightning strikes are rendered via static vertex buffers(one buffer for each strike) that are built and filled when a strike is created. All information the strike needs is stored in the vertex buffer and is used by a custom shader. This includes: bolt size/width, power(or intensity), and life cycle times. Indexing is not used as it poses complications, so drawPrimitive is called for every lightning bolt/split tri-strip segment. Using triangle lists might produce better performance, but I haven't tested that yet.

I ask any TSE owners to go check out the code and post your comments here, on the bounty page, or in the forums.
Page «Previous 1 2
#1
10/07/2006 (10:20 pm)
This looks fantastic! Excellent work.
#2
10/08/2006 (12:01 am)
I thought that was real. I guess your doing a good job then.
#3
10/08/2006 (12:23 am)
Awesome!
#4
10/08/2006 (1:25 am)
It looks awesome.

It would look even better if it lit the sky up when it struck.
#5
10/08/2006 (2:08 am)
Very cool looking!
#6
10/08/2006 (2:19 am)
Really nice Josh!
#7
10/08/2006 (2:53 am)
that looks really good
#8
10/08/2006 (4:59 am)
That looks Amazingly realistic. All it needs now is a dynamic light, then it'd be perfect.
Thankyou very much for sharing this!
#9
10/08/2006 (5:30 am)
Great stuff, i've been watching your thread on this. Glad to see its finally ready. Cant wait to get my hands on it
#10
10/08/2006 (5:39 am)
Ha, I thought the pic was a reference photo, and scrolled down to see the in-engine shot. :D Nice job on that.
#11
10/08/2006 (8:54 am)
Looks good to me. I don't think the 1.x fallback is a big deal.
#12
10/08/2006 (9:19 am)
I almost thought the photo was a reference photo too, if not for the terrain in the corner. Amazing.
#13
10/08/2006 (9:26 am)
Where we can get this awesome piece of code?
#14
10/08/2006 (10:40 am)
I just asked the question "how can we make a nice lightning effect like WoW has for draining effects" too. Good timing! Too bad TGE doesnt use shaders!
#15
10/08/2006 (6:23 pm)
That looks fatastic! Excellent job, sir!
#16
10/12/2006 (1:35 pm)
Thanks for all the positive responses.
#17
03/27/2007 (6:51 pm)
Can someone send me the code?

My e-mail is sorind1@hotmail.com

I tried getting the code from the link above, but I can't get in.
I've tried to register several times, but to no avail.
I still haven't received a password to login.

Thanks in advance.
#18
03/27/2007 (7:02 pm)
Nevermind.

I finally got in and downloaded it.

Thanks, though.
#19
07/19/2007 (7:19 am)
For some reason it doesn't work? LightningShaderData can't be found.
#20
09/30/2007 (12:28 am)
link is broken send me the code at langhoffkevin@yahoo,com
Page «Previous 1 2