Apr 132011

Blender.org Tracker –  BA Thread –  BlenderNation Article

UPDATE – 01.05.13 – v0.2.7
-Fixed the issue that prevented the addon from loading in Blender 2.63+. Also fixed a problem with the makeMeshCubes function.

UPDATE – 02.14.13 – v0.2.6
-An API change has made the addon not load. It has something to do bpy.scene.context. I’ll look into it when I have a chance. Fortunately the script will still run as a regular script. If you want to use it, just use the .blend file below or just load it in the text editor and hit run.

UPDATE – 06.20.11 – v0.2.6
-Moderate speedup.
-Cubes output scale/loc corrected.
-Tooltips added.
-Container insulators: Arbitrary mesh shapes can be used as insulator/cloud objects. Still quite imperfect though. May slow down generation. Best for simple containers; bowl, cup, bottle. A spiral pipe would not work well. Must have rot=0, scale=1, and origin set to geometry.
-Mesh origin objects:. If the origin obj is a mesh, vert locations will be used as initial charges. However this will disable multi-mesh output. May slow down generation.

UPDATE – 05.08.11 – v.0.2.5
-added ‘single mesh’ output option. use this mesh with build modifier to ‘grow’ lightning in animation.



This is a partial implementation of the algorithm presented in the paper ‘Fast Simulation of Laplacian Growth’
and some concepts borrowed from Fast Animation of Lightning Using an Adaptive Mesh

It currently uses simplified spherical boundary conditions and calculates potential at candidate growth sites using FSLG-Eqn. 9
To be properly influenced by an environment map of charges and
allow artistic manipulation of growth patterns I will need to
implement FSLG-Eqn. 15, which I don’t fully understand yet.

As compared to the simulation times reported in the paper, there is no comparison. This is not fast. They report 2000 particles in 6 seconds. So far 1000 particles will take a few minutes.

A good chunk of the reason for the slowness is the weighted random choice function. Another big reason is it’s python not c. Probably the biggest reason is that I’m a hack and I barely cobbled this together so it’ll take time to get it optimized.

Anyway I think it’s better than making lightning by hand, or at least might give you a good base mesh to mess with. So it might be useful to someone. I’ll keep working on it.

you can use the example .blend file or load as an addon.

-Download .blend* file, instructions in file. *right-click, save-as [works with Blender 2.5 – 2.62]
-Download .blend* file, instructions in file. *right-click, save-as [works with Blender 2.63+]

-Download script (object_laplace_lightningv026.rar) [this version of the addon only works with Blender 2.5 – 2.62]
-Download script (object_laplace_lightningv027.zip) [this version of the addon works with Blender 2.63+]
-Uncompress, Place in in Blender ‘addons’ folder:
Blender install folder/2.6x/scripts/addons/
-Enable addon
UI will be in >View3D>Tool Shelf>Laplacian Lightning (object mode)

-Hit ‘generate’ – try w/ defaults

-Play with the settings, try again.

iterations – how many times to run loop (number of particles) grid unit size – size of a ‘cell’ in BU
straighness – user variable to control branchiness/straighness
start charge – origin point
use ground charge plane – hacky method of simulating lightning strike. Terminate loop if lightning hits ‘ground’.
ground Z co – z coordinate of ground plane
ground charge – charge of ground plane
mesh, cube, voxel – visualization outputs
mesh – creates vert/edge mesh from data
cube – creates cube objects from data
voxel – creates a 64x64x64 voxel data file from data outputs to ‘FSLGvoxels.raw’ (experimental)

Hope you enjoy. Send me a link to some renders if you use it! Especially if you get >10,000 particles.

  32 Responses to “Blender Laplacian Lightning”

  1. Good job, and thanks!

  2. Oh GOOD GOD!!!
    “I hope it will be useful to someone!” !!!! LOLOLOLOL!!!!
    This is great. I’m working on my first episode of my sci-fi film, “Today Mars, Tomorrow The Stars.” The first ten-minutes is a huge space battle. I had the bright idea, since I found phasers and lasers and bullets so boring and old hat, of having my massive starships shoot lightning bolts at each other. Since there are 5 capital ships, maybe ten smaller escorts, and many (MANY) little spacefighters, all using lightning as their primary weapon, I was really sweating this!!!!!!
    “I hope it will be useful to someone”! I could die laughing.
    I’m MartianStories on YouTube. I sent you a friend request. Please write me. I’d like to credit you in my movie in effects, and use your system. Is there a way to tell it what to target….? 🙂

  3. The mobile lightning is really something! Seems to me I remember (though I don’t recall seeing it) that lightning actually “strikes” up from the ground. If somebody wanted to show it that way, how hard is it to reverse the flow?

  4. Nice.

    I think I will use this script. This could be quite useful.

    Thanks to the developer of this script.

  5. umm… I cannot get it to work. I get an error when I try to run the script it says:
    “Python script fail look in the console for now…”
    what is up? I have had this problem with multiple scripts I tried to run now. please assist.

  6. Very nice an Stormy Plugin! It’s very useful for me!

  7. […] an update to the Laplacian Lightning script and did some demo renders for a banner so I thought I’d post the full-res of those […]

  8. Great add-on!!!!

    is there a pertinent license for it?

  9. […] Blender Laplacian Lightning Generator has been accepted into the Blender Contrib […]

  10. […] Blender Laplacian Lightning » funkboxingApr 13, 2011 … Laplacian Lightning Generator Blender 2.5 at BlenderNation « ThruDreamsgate’s Blog says: June 27, 2011 at 5:30 am. […] More Information … […]

  11. very good collection.

  12. For some reason, the lightning generates fine, but is so thin that it doesn’t show up in the render…

  13. Hi I get heap of errors when I hit generate in 2.64… should it work with the latest version?


    • I apologize but I’m afraid I haven’t tested this since about v2.56 and it may be a little while before I can make any updates.

    • Actually I just tested it with 2.65 and it worked fine.
      Try the FSLG_Example.blend file, it should work out-of-the-box.

  14. Any progress on getting this to run with the latest blender? I’m thinking of possibly using this in my web comic in the future.

    • I haven’t updated it as an addon yet but it still runs fine if you just use ‘Run Script’ from the Text Console.

      Contact me if you need any help with this. I’d be very pleased to see it used in your web comic.

  15. Thanks! trying this in an animation now. I’ve used a skin modifier to give them volume and then using emission volume shaders. Will let you know when it’s done.

  16. Loved the “By the mighty hammer of Thor” Joke when generating lightning. Great great great job.

  17. […] initially tried to simulate arcs of electricity using a Laplacian Lightening Generator for blender but I couldn’t get any satisfying results. I did however convert some […]

  18. having a hard time with this ib blender 2.74

  19. Laplacian Lightning addon causes Blender to close instantly if you try to scroll in the tool bar.

  20. A video of how to operate it, a tutorial would be nice to see

  21. Does this work with 2.8 Version

  22. […] Laplacian Lightning | funkboxing […]

  23. […] experienced such need in my project long time ago. I did it with the help of Laplacian Lightning addon, too. My suggestion […]

  24. […] Laplacian Lightning Generator addon broke with some recent API changes, as reported in this […]

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



This site uses Akismet to reduce spam. Learn how your comment data is processed.