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.

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:
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.

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.
About the author
#22
Kevin, Kory, sent an e-mail to you with the resource...
Have a nice time ;)
11/02/2007 (12:49 pm)
Hi there!Kevin, Kory, sent an e-mail to you with the resource...
Have a nice time ;)
#25
Can you send the code to Trojke3@yahoo.com ?
Please?
12/22/2007 (9:42 pm)
This looks incredible.. and is exactly what i have been looking for... Literally i was playing around in TGEA today and I wanted to make some lightning only to realize that it doesnt support it (yet) so i was going back through the TGE Lightning.h and .cc files to see if I could implement this.. then it hit me, look on the forums to see if anyone else already did. WowCan you send the code to Trojke3@yahoo.com ?
Please?
#26
It seems me too I cannot find anymore the links in this page... Fortunately I still having it in my "sent message" folder in thunderbird... :-P
Enjoy it!
01/03/2008 (8:12 am)
@ David: sent!It seems me too I cannot find anymore the links in this page... Fortunately I still having it in my "sent message" folder in thunderbird... :-P
Enjoy it!
#27
01/03/2008 (5:38 pm)
Thanks a million! im compiling it now, I think this should be IN TGEA, or maybe a resource... im sure your getting tired of sending E-mails to random people. Thanks again though!
#28
Anyway if someone want to host the file would be pretty for all the community...
;D
01/29/2008 (8:52 am)
Don't worry, you're wellcome, it's not so a big work ;)Anyway if someone want to host the file would be pretty for all the community...
;D
#29
... sorry I see your post only 1 minute ago... it seem your problem is you hadn't added this in your client/script/shaders.cs
remember to always implement there your shaders' datablocks when you're adding shaders.
;)
01/29/2008 (8:59 am)
@ Chris \"C2\" Byars :... sorry I see your post only 1 minute ago... it seem your problem is you hadn't added this in your client/script/shaders.cs
//-----------------------------------------------------------------------------
// LightningShaderData (see http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=11390)
//-----------------------------------------------------------------------------
new ShaderData( LightningShaderData )
{
DXVertexShaderFile = "shaders/lightningV.hlsl";
DXPixelShaderFile = "shaders/lightningP.hlsl";
pixVersion = 2.0;
};remember to always implement there your shaders' datablocks when you're adding shaders.
;)
#30
02/16/2008 (11:47 pm)
I'd love a copy of the lightning stuffs as well, nemesisxiii )at( gmail (dot) com. Thanks in advance!
#31
02/19/2008 (5:00 am)
David, check your mailbox, sent ;)
#32
03/02/2008 (5:59 am)
Any chance you could please send to me also? Thanks, I know it must be a pain 8
#33
It's not so a big problem sending a mail to someone so don't worry...
Anyway if there is someone out there that wanna host the file would be usefull to everyone will need it instead to wait for having me reading their e-mails :-)
So if someone wanna host it he only need to let me know posting there :-)
JoZ
03/02/2008 (1:24 pm)
Hi there :)It's not so a big problem sending a mail to someone so don't worry...
Anyway if there is someone out there that wanna host the file would be usefull to everyone will need it instead to wait for having me reading their e-mails :-)
So if someone wanna host it he only need to let me know posting there :-)
JoZ
#34
If we can get it working, I'll have a chat with the guy that does our site and see if there's anywhere we can host the files if you like 8)
Cheers
H.
03/05/2008 (4:21 am)
Thanks Joz, if you click on my name above you can see my email address...If we can get it working, I'll have a chat with the guy that does our site and see if there's anywhere we can host the files if you like 8)
Cheers
H.
#35
Thx.
07/27/2008 (7:24 am)
As no ones hosting it yet... Would love a copy of this myself. E-mail is in profile.Thx.
#36
03/21/2010 (7:15 pm)
I have an idea... how about someone e-mails it to me at tbalbi@gmail.com and I will host it so people who come to this thread can have a link to it :)
#37
05/27/2012 (4:33 am)
Anyone still have this? 
Torque Owner Kory Imaginism
innovative imaginations