Monday, May 29, 2017

xna - Methods of Creating a "Lightning" effect in 2D


well i'm just wondering on the best way to go about create some form of "Lightning" effect to be used in a game, so for example:


-In my game, i would like to have this effect in the menus and in-game in some form of random weather system perhaps.



Just wondering on the methods available? I did read this blog post: http://drilian.com/2009/02/25/lightning-bolts/


And took a-look at the Lightning sample thats around. I like the method placed in the blog post, just really a bit unsure on how to create the vertices from the lightning segments. I would be great if someone could explain that seconded sub-heading (Adding glow) a bit more to me :).


But like i said, i'm really want to know if there's any other ways i could accomplish this?



Answer



Creating quads: http://msdn.microsoft.com/en-us/library/bb464051(v=xnagamestudio.10).aspx. You need only one quad per segment, as in image 9 "lightning vertices" of the linked article you mentioned.


Next, the glow is first created by having a bitmap, a simple circle will do nicely, which blends from hard bright center to soft darker outside, and alpha similarly solid in center and disappearing to edges. Black background works too, depending on shader. A shader with some blend effect smooths things out.


It really is the most impressive lightning effect, doing it with hand-drawn sprites only works if you have a scene for that specific situation.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...