Webgl lightning strike example in BabylonJs?

I was wondering if anyone has tried to strike a lightning bold on click of a mouse.

or any tutorials out there ? Similar to this threejs demo three.js webgl - lightning strike


I don’t think we have an example of lightning in Babylon.js.

If anyone is up for the challenge, they could port the Threejs example!

Would be so coool, please please please :slight_smile:

I made it this so far. Wondering how do I achieve some glow and make my lines fat !
code: ts-parkover-game/LightningBolt.ts at main · steelx/ts-parkover-game · GitHub

I wish to do something like this if possible can someone help me with Node Material Editor from BabylonJS ?

1 Like

Here are several examples of lightning which I found in my bookmarks :slight_smile:

With sprite - Babylon.js Playground
With shader - https://playground.babylonjs.com/#26UUE1#25
With points - https://playground.babylonjs.com/#SPQEM6#1

I am using the 3rd one of @labris playgrounds. It is super easy to implement and looks decent. I added some emission to it. But to be fair, you know, if you look at this one there is a difference. The approach described here (check the Nvidia link) seems most promising.


hey thanks, sprites one looks great.
Even I’m using Points with LinesMesh and animating them with recreating points again. Do you think is there any way I can attach some glow to these lines/points ?

For more lines effects I would recommend to use MeshLine - more info here: BabylonJS MeshLine - a port of THREE.MeshLine

1 Like

thanks I tried this but it just creates ribbon alike shapes without any glow effect.
you have been a great help so far with previous links. do you know any other algorithm similar to this algorithm - How can I generate a lightning bolt effect? - Game Development Stack Exchange I really line LinesMesh.

I use a TubeMesh.

1 Like

Thanks Joe. Good thinking.
The results look better than before. I think I will try adding some particles on lines path next.

I don’t know if it’s helpful, but ChatGPT gave me a simple lightning strike example.


It is even better with Glow layer - https://playground.babylonjs.com/#XGUSZ3#1


Thanks for the great advice. that’s so cool.

1 Like

This is what I wanted all this time :two_hearts: thanks. I wasn’t aware of GlowLayer.

1 Like

Viva GreasedLine :rofl: :rofl: :rofl: