Game Development Community

Lightning in TSE

by Bryan Stroebel · in Torque Game Engine Advanced · 02/14/2006 (8:14 am) · 29 replies

Has anyone got lightning to work in TSE? If so, How did you do it? The lightning.h/lightning.cpp files are in the game/fx directory but they are not included in the project. If I include them it wants more files and things that I'm not sure would work in TSE.
Page «Previous 1 2
#1
02/14/2006 (9:05 am)
Lighting is part of the next milestone.
#2
02/17/2006 (1:48 pm)
David: Note that he said lightning. ;)
#3
02/17/2006 (2:14 pm)
Ah, well crap. And here I was, all excited to point to the milestone list.
#4
02/17/2006 (4:40 pm)
Well, the lightning could also produce lighting :)
#5
02/17/2006 (8:27 pm)
I believe there was a TSE bounty for it and someone had a working prototype for it, I remember seeing the screenshot of it in that thread, with a nice glow effect. They had a problem at some point though and it looks lik it may have been aborted because this was months ago.
#6
02/26/2006 (5:42 pm)
I was the guy working(if you can call it that) on the lightning so long ago. I stopped working on it because I desired alot more functionality out of the lightning then the stock code could offer. In the past few days, I've pretty much rewritten a new lightning system from scratch, taking what I could from the stock lightning. So far it supports in 3 different "modes": "storm" (normal top-to-bottom lightning strikes), "discharge" (lightning in all directions), and "static" (lightning strikes from a 3d offset to another), and can be attached(mounted) to any SceneObject. Just with this basic functionality, you can make some pretty cool effects: projectiles that emit lightning, tesla coils, "spark gaps", ect.

Storm on the left, discharge in the back right, and static lightning in the front

From left to right: Static, discharge, and storm.

Right now the rendering is just generic PrimBuild line strips, but I'm hoping to beable to render it with a custom shader of some sort(tho I don't know shaders worth a damn).
#7
02/27/2006 (9:50 am)
The actual lightning paths don't need shaders, you just need to make them color/alpha fade right. I can see a few uses for shaders though. After-image and especially diffuse glow would round out the effects to make them more realistic. Also, shaders could be used for some of the vertex calculation, perhaps you could make a really fast system with this (data representation might be really hard...). The biggest problem with electricity I've seen is that it doesn't seem fluid enough, though with lightning strikes this isn't really as big an issue.

Can you make the storm strikes have more branches than pictured?
#8
02/27/2006 (1:13 pm)
It's all datablock controlled, but there's hard-coded limitations.
#9
02/27/2006 (2:48 pm)
@Josh - Looking good! Don't forget to use google images for inspiration.

To me it seems that you need alot more fine grained zigs in the bolts if your going purely geometric. You also need to vary the width of the bolt, so that generally it goes from wider to thinner as you get further from the source (although there seems to be instances where that isn't the case).

You slap some glow on to the sucker and a little particle system at the source and you're golden.
#10
02/27/2006 (3:10 pm)
Thanks for the link! Particle effects for both start and end points of the strikes are already planned. ;)

I was actualy wanting to hook it all up to a static vertex buffer and animate/color/blur it in a shader. I'm definetly going to experiment with a couple different methods untill I get something that works(render to texture and post-process, maybe).
#11
02/27/2006 (3:30 pm)
Animating it the shader is a cool idea, but you may need to at least animate the high level bends on the CPU to detect collision with objects. The low level fractal-ish noise would do great in a vert shader although i can't think off the top of my head how to do that. =)
#12
03/11/2006 (10:20 am)
Kinda-sorta related. I happened across these recently:

video.google.com/videoplay?docid=4468957986746104671
video.google.com/videoplay?docid=-3005249485929960832&q=345Kv+Switch+Opening

Almost looks like fire really. But they're both heated gas/plasma so I guess it makes sense.
#13
06/19/2006 (2:00 pm)
I finaly have an update for you guys with my work on the new TSE lightning system. I was able to write a neat custom shader for rendering dynamic lightning. It currently handles bolt generation, animation, coloring, glow, and 'ambient' glow in the pixel shader(PS 2.0 only, for now).

static.flickr.com/62/170722770_da090457b0_o.pngstatic.flickr.com/75/170735389_7a8daf848d_o.png
I know that leaves alot to be desired, but at least it proves the concept actualy works. I'm currently having trouble getting the vertex shader to do what I want, so progress has stopped untill I can figure that out.

Questions, comments, or suggestions?
#14
06/19/2006 (3:27 pm)
I'm extremely interested in this. We had a dynamic weather system for our game under TGE but when we moved to TSE we had to abandon it because the lightning was gone. I would help but I don't know anything about shaders. When you're done are you going to have essentially the same exposure to the console via the LightningData datablock?
#15
06/25/2006 (7:28 am)
Looks cool :)
#16
07/22/2006 (11:44 am)
Here's another update on my TSE lightning system for anyone that's interested...

I'm on the 4th or 5th code reversion, and I think I finaly have the 'look' down:
Lightning
Glow Buffer Lightning

There's some major flaws with using the glow buffer ATM, so it probably won't make the cut. There's still alot of work to be done untill I'll be happy with it, but it's comming along. The shader I'm using renders a dynamic lightning bolt via a datablock defined (2d) noise texture, similar to the Render Monkey electricity effect.
#17
07/22/2006 (12:17 pm)
Josh - Nice, I dig it!
#18
07/22/2006 (1:39 pm)
Very nice work.
#19
07/22/2006 (1:49 pm)
Indeed, nice work.
#20
07/22/2006 (2:31 pm)
That looks very nice. Is there a point at which you will be sharing your code in some form with the rest of the TSE community? This would look awesome in our MMORPG representation of the 2nd century holy land. Keep us informed! :D

Blessings to you,
-Sparkling
http://www.visionsgame.com
Page «Previous 1 2