Jump to content

Lightning beam effect


Hudo1979
 Share

Recommended Posts

You can apply the concept of lightning from other applications to Babylon. 

I looked at this for a small amount of time yesterday. What you need is a small glowing sphere white in the inside and blue on the outside I dont know how to do this. 

I checked this out but its not right http://www.babylonjs-playground.com/#1HECPU#52 .  

You need a direction and allowance for randomness in that direction. You use the random position to make the lightning bolt look real. You precreate the particles with 0 opcity. When its want a bolt to be shot you adjust the opacity position on the fly. 

lightning effect look this up via google. 

This has a generic version of what you need to do via math. 

http://webcache.googleusercontent.com/search?q=cache:IdgpUg97ajAJ:gamedevelopment.tutsplus.com/tutorials/how-to-generate-shockingly-good-2d-lightning-effects--gamedev-2681+&cd=1&hl=en&ct=clnk&gl=us

Link to comment
Share on other sites

Hi @Hudo1979

Very interesting question, 

I'm sure there are many ways of achieving this, it can probably be done with a shader,

but the particleSystem should also be able to achieve it :)

Edit:

 a quick proof of concept :) :

http://www.babylonjs-playground.com/#Q1CAF#3

and with a start/stop interval & timeout for "life-like" lightning flashes..

http://www.babylonjs-playground.com/#Q1CAF#5

 

Link to comment
Share on other sites

Thank All!!

 

For all the wonderfull tips.

I just have some consideration, if I need lightning in a game, I probably for performance using a texture with lightning sprite?

 

The particle really looks cool, but is is difficult to like set emitter and target to draw the lightning

Link to comment
Share on other sites

Hudo 1979 , you have to consider several things. Do you want the effect to be seen as growing and reaching out or just a flash?

Do you want the effect to be somewhat random controlled by parameters. These are some of the artistic choices you need to decide before you 

derive a solution. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...