Skip to main content
gamedev.net
🔒 Locked

Lightning structure

Started by deffer 5 replies 850+ views
Original Post
deffer
deffer
Hi. What I want to do is a lightning effect. I'm not interested in visualization right now. Rather in it's overall shape. A lightning has, of course, a (binary) tree-shaped structure. I have a hard time trying to determine some general strategy for randomly creating it. I mean, lenghts of it's branches, directions. I think, there have to be a main path, and some sub-paths, coming one by one from tree nodes. But it looks rather simple and not interesting. Has anyone been doing this before, or can give any links to the theme? As usual, any ideas appreciated, no matter how little. /def
joanusdmentia
joanusdmentia
L-systems tend to be a good way of generating natural tree-like structures, I'd imagine it would work well for lightning as well.
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The nly verdict is vengeance; a vendett o
MdLeadG
MdLeadG
You could actually simulate the electrical charge, to some degree. Generate opposite charges from above and below, and start stepping down randomly, leaning towards the path of least resistance. The link below might be a good place to start. Hope this helps.

As an aside, is this for a skymap effect or an actual 3D implementation?

howstuffworks: lightning
deffer
deffer
Thanks, guys.

joanusdmentia:
The L-system seems to be too "unstable", meaning that the effect grows in a quite unpredictible way. Secondly, it is too much pattern-like.
However, they (www.ambientdesign.com/gallery-lightning.html) claim they modified it and seem to have nice results.

MdLeadG:
Simulating the leader's steps (main branch) is the actual problem here. So it is one step ahead of the article you suggested.


And yes, it is for an actual 3D implementation. For a lightning spell. What I need to find is some equation to determine behaviour of a single branch, or for splitting a branch. My previous experiments don't look too good.
I will bring a screen tomorrow, so you could see exactly what I mean.

Cheers.
/def
Ajare
Ajare
L-Systems need a fair bit of tweaking. However, if it's for a realtime effect, I wouldn't use them. To what extent does it need to be animated? Real lightning isn't of course, but do you want this for your spell?
deffer
deffer
So here's the shot of what I've managed to do already:

rainbow.mimuw.edu.pl/~mw209304/other/lightning.gif

And yes, it is for a real time effect. Graphic implementation is irrelevant at the moment. It's just for an algorithm Idea.

/def
Timkin
Timkin
It looks unrealistic because, even though you've got branches coming off (too many in my opinion for the width of the bolt) the connecting sections are too straight.

Anyway...

A lightening bolt is both a path of minimal resistance and a random walk through the atmosphere. Much of its visual shape is dependent on the circulation of ionised air at the time of the strike. If you want a realistic looking bolt you're going to need to consider these things (or something that approximates them).

Personally, I'd go with a probabilistic path generator with determinstic biases and a random bolt-split function.

Cheers,

Timkin

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.