Previous Blog Next Blog
Prev/Next Blog
by date

Lightning Anyone?

Lightning Anyone?
Name:Josh Moore
Date Posted:Oct 08, 2006
Rating:5.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Josh Moore

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

Recent Blog Posts
List:08/23/07 - What's up & T2d
10/08/06 - Lightning Anyone?
09/19/06 - Quick .plan - TSE works...
02/19/06 - Illumina: Development continues...
12/05/05 - Plan for Josh Moore
09/19/05 - Plan for Josh Moore
08/30/05 - Plan for Josh Moore
04/28/05 - Plan for Josh "The_Force" Moore

Submit ResourceSubmit your own resources!

Plague   (Oct 08, 2006 at 05:20 GMT)
This looks fantastic! Excellent work.

Ajari Wilson   (Oct 08, 2006 at 07:01 GMT)
I thought that was real. I guess your doing a good job then.

Jeremy Alessi   (Oct 08, 2006 at 07:23 GMT)
Awesome!

Maxwell Marsh   (Oct 08, 2006 at 08:25 GMT)
It looks awesome.

It would look even better if it lit the sky up when it struck.

Matt Fairfax   (Oct 08, 2006 at 09:08 GMT)
Very cool looking!

Ben -Djaggernaut- Chavigner   (Oct 08, 2006 at 09:19 GMT)   Resource Rating: 5
Really nice Josh!

Tom Bentz   (Oct 08, 2006 at 09:53 GMT)
that looks really good

Mincetro   (Oct 08, 2006 at 11:59 GMT)
That looks Amazingly realistic. All it needs now is a dynamic light, then it'd be perfect.
Thankyou very much for sharing this!

James Thompson   (Oct 08, 2006 at 12:30 GMT)
Great stuff, i've been watching your thread on this. Glad to see its finally ready. Cant wait to get my hands on it

Teck Lee Tan   (Oct 08, 2006 at 12:39 GMT)
Ha, I thought the pic was a reference photo, and scrolled down to see the in-engine shot. :D Nice job on that.

Vashner   (Oct 08, 2006 at 15:54 GMT)   Resource Rating: 5
Looks good to me. I don't think the 1.x fallback is a big deal.

Daniel Allessi   (Oct 08, 2006 at 16:19 GMT)
I almost thought the photo was a reference photo too, if not for the terrain in the corner. Amazing.

Juha Eerola   (Oct 08, 2006 at 16:26 GMT)
Where we can get this awesome piece of code?

Dave Young   (Oct 08, 2006 at 17:40 GMT)
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!

Don Hogan   (Oct 09, 2006 at 01:23 GMT)
That looks fatastic! Excellent job, sir!

Josh Moore   (Oct 12, 2006 at 20:35 GMT)
Thanks for all the positive responses.

Sorin Daraban   (Mar 28, 2007 at 01:51 GMT)
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.

Sorin Daraban   (Mar 28, 2007 at 02:02 GMT)
Nevermind.

I finally got in and downloaded it.

Thanks, though.

Chris \"C2\" Byars   (Jul 19, 2007 at 14:19 GMT)
For some reason it doesn't work? LightningShaderData can't be found.

KEVIN LANGHOFF   (Sep 30, 2007 at 07:28 GMT)
link is broken send me the code at langhoffkevin@yahoo,com

Kory James   (Nov 02, 2007 at 18:08 GMT)
can someone send my the code link is down or something jstanleynwo@yahoo.com

JoZ   (Nov 02, 2007 at 19:49 GMT)
Hi there!
Kevin, Kory, sent an e-mail to you with the resource...
Have a nice time ;)

Wigon   (Dec 03, 2007 at 16:05 GMT)
Can someone send me the code?

My e-mail is wigon@o2.pl

Thanks

JoZ   (Dec 04, 2007 at 14:48 GMT)
@Wigon: sent!
Enjoy it ;)

David J Weaver   (Dec 23, 2007 at 05:42 GMT)   Resource Rating: 5
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. Wow
Can you send the code to Trojke3@yahoo.com ?
Please?

JoZ   (Jan 03, 2008 at 16:12 GMT)
@ 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!

David J Weaver   (Jan 04, 2008 at 01:38 GMT)   Resource Rating: 5
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!

JoZ   (Jan 29, 2008 at 16:52 GMT)
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

JoZ   (Jan 29, 2008 at 16:59 GMT)
@ 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.

;)

David Jauregui   (Feb 17, 2008 at 07:47 GMT)
I'd love a copy of the lightning stuffs as well, nemesisxiii )at( gmail (dot) com. Thanks in advance!

JoZ   (Feb 19, 2008 at 13:00 GMT)
David, check your mailbox, sent ;)

Harvey Greensall   (Mar 02, 2008 at 13:59 GMT)
Any chance you could please send to me also? Thanks, I know it must be a pain 8

JoZ   (Mar 02, 2008 at 21:24 GMT)
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

Harvey Greensall   (Mar 05, 2008 at 12:21 GMT)
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.

John "Mythic" Henry   (Jul 27, 2008 at 14:24 GMT)
As no ones hosting it yet... Would love a copy of this myself. E-mail is in profile.
Thx.

You must be a member and be logged in to either append comments or rate this resource.