Apr 132011
 

Blender.org TrackerBA ThreadBlenderNation Article

UPDATE – 01.05.13 – v0.2.7
FIXES:
-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
ISSUES:
-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
FIXES:
-Moderate speedup.
-Cubes output scale/loc corrected.
-Tooltips added.
NEW FEATURES:
-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
NEW STUFF:
-added ‘single mesh’ output option. use this mesh with build modifier to ‘grow’ lightning in animation.

If you find this really useful, please consider donating a little to the cause. Thanks!



I’m also grateful for bitcoin donations to: 1K5Yy77ejes2FZrHBG5fns3QAicnwZcduq

 

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.

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

BLEND FILE:
-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+]

ADDON:
-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.

  22 Responses to “Blender Laplacian Lightning”

  1. Good job, and thanks!

  2. Oh GOOD GOD!!!
    THANK YOU THANK YOU THANK YOU!
    “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.
    THANK YOU!
    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?

    • Pretty simple to reverse the flow, but from what I could tell the ‘laplacian growth’ phenomenon occurs downward. The main charge does seem to flow back up the bolt once it touches down a little.

  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.
    thanks

  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?

    Cheers
    Paul

    • 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.

Leave a Reply

%d bloggers like this: