[AddOn] Blender Lightning Generator [UPDATED 06.20.11]

“Blender Laplacian Lightning Generator”

script, information, and instructions here


high res

[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 (v0.2.5)
-Single mesh output option (useful with build modifier for animation)
[UPDATE] - 04.26.11 (v0.2.4)
-MOVED TO VIEW3D > TOOLSHELF
-fixed object selection in UI
[UPDATE] - 04.24.11 (v0.2.3)
-Origin and ground are defined by object locations.
-Cloud object (Thanks RickyBlender for suggestion). Bounding box of object becomes charged attractor, loop terminates if hit. This option overrides ground.
-Insulator object, restricts growth in an area. Right now it uses the bounding box so it’s of limited use.
-Secondary path orders temporarily disabled in UI (set to 1)
-Create setup objects button. Creates objects for basic setup.
2.57a- seems to work- but I haven’t been using it because there is no terminal output. Is there a command line switch for this or something? Seems weird that it’s gone.

[ORIGINAL POST]
…and here is yet another in my ever-growing catalog of semi-functional, quasi-useful, pseudo-educational, but entirely fun-to-code Blender scripts.

This script uses the part of the algorithm presented in the paper
‘Fast Simulation of Laplacian Growth’

Significantly, this script cannot yet accept an environment map as boundary conditions. So you don’t have a great deal of control over the path the lightning will take. You can insert point charges but more than a few starts to bog down the loop. I’ve included a hacky way of setting up a ground charge so you can make lightning.

It’s not a finished product but I thought it might be useful to someone right now and I’d like to get some feedback on it. Let me know what you think. Thanks!
also - if you happen to read the paper and fully understand Eqn. 15- please help me.

Attachments


2 Likes

Download link seems to be broken.

Fixed- sorry about that.

That is nice, just convert to curve and remove fill to be able to play with bevel, interpolation types and a modulated radius! It looks as tree branches or roots… I like :slight_smile:

yeah, very fun script. :slight_smile:

would it be possible to get only one object for the lightning bolt

like when i generate with cube i get 100 of objects
i think it would be easier to handle it if it was only one object if possible!

very nice to have this effect in 2.5

by the way i tried to save target or save blend file from your site and i cannot save it ?
is there a special way to download ?
thanks

The cubes were just the first visualization test so they’re not really set up well. They don’t have any of the branch/path info like the mesh. I did make it so they should be all selected after generating so just CTRL-J to join.

in latest built how do you change the font size for the text editor?

i’ll do a lot of testing today

anyway to make cloud to cloud sparks?

thanks

font size - in text editor - Properties (CTRL-F) -> font size.

cloud to cloud sparks… hmmm… really it would just be an origin charge in one and an attractor cell or plane in another…

I still have some work to do to allow arbitrary attractors/repulsors like this.

If you need this functionality now you can try this;

in the script in FSLG() there is a list ‘eChargeList’ that has some cells to be used to fake a ground plane- this list could be arbitrarily filled with any attractor/repulsor points.
eChargeList = [(xco, yco, zco, charge), …]

so for a cloud to cloud thing - (assuming cloudA is in the area of (-50,0,50) cloudB (50,0,50)
set scn.GROUNDBOOL = False
set scn.ORIGIN = (-50,0,50) —CLOUDA
and manually create your attractors and repulsors in eChargeList
example:
eChargeList = [(50,0,50,-100), (50,0,60,-100), (50,0,70,-100)]
this creates 3 charges around CLOUDB (better to use a few spaced out than just one)

now the problem here is that the loop should halt when the bolt hits CLOUDB but it wont right now. So you’ll have to play with iterations and maybe prune the bolt after running.

but that’s the quick-n-dirty method if you need it. I’ll get this functionality in the UI too, it’s just not ready yet.

i think it would be an interesting update cloud to cloud bolt

i mean i was thinking about that for some cloudy daylight set up with clouds and where to set the lighthning bolts
and in some instance it can go from cloud to cloud
but agreed most of the time goes from cloud to ground! LOL

having fun with sparks!

i also like a lot the high voltage generator in paper
i would like to see that one too look impressive!

Cool thing, I like it!
But it works good only with default settings.
Also I don’t see anything in Props-> World if I load my file. I see addon’s UI only when I do File -> New.
That’s what I tried:
I set Lamp to Origin, Plane to Ground and Insulator was Camera. With 500 iterations I got mesh.
Next I do File - New. Then try the same settings that was before - I got the error:


Sometimes it crashes Blender.
BTW, the console says



So maybe there is some error.
I didn’t tried a lot because of errors. And I don’t know what build will support it well.

@Moolah - Thanks for testing this out. I think I’ve addressed most of the problems in this last version. Some of the problem is that the dropdown boxes aren’t updated with the objects right, so you have up re-run the script after creating a new object to see it. This makes using the script as an ‘addon’ a little impractical so you may want to run it from the text editor for now.

@RickyBlender - Got something along the lines of a ‘cloud-to-cloud’ strike in the UI now.

very cool!

still working to make a shorter version and will see wht you did for cloud to cloud strike

did you upload latest version for this in first post!

by the way did you see one like that for solving the poisson equation alone for electrical charges?
it would be very cool!

thanks

hi, I’ve been testing this out a bit.
this works with 36242

It seems slow to compute the object.
The menu I think belongs in the toolbox, maybe you could try the Object Panel, but toolbox is usual.
Thanks, cool script.
You could submit the script here: http://projects.blender.org/projects/bf-extensions/
It would become a welcome addition. :slight_smile:

@Meta-Androcto - I went ahead and submitted the script, also changed to the toolbox as suggested. The pasteall link is to the first version, have been several improvements since. Glad you liked it, thanks for checking it out!

great job, thanks for participating :slight_smile:

i like your second pic in first post with integrated circuit
very cool picture
showing sparks with IC ! LOL

another example would be for vander graph generators with lots of sparks around
don’t know if it can be done cause there is a lot of sparks for this model!

nice work and nice additon as a special effect

this could also be used may be to make cracks in a window but would require another script i guess!

I love this thread, and I love the idea and the addon, and I love that Teldredge came up with this and is working on it, and I love all of you folks who are trying it out and coming up with new ideas. I just love you all.
I love you all so much because I’m working on my animated film, “Today Mars, Tomorrow The Stars.” The beginning of the film is a huge space battle. I’ve been working on these mammoth starships, and mammoth set for months, and I’ve just started getting movement going. There’s about 5 capital ships slugging it out in Jupiter orbit, and 6 escort ships, and a whole gaggle of little space fighters. What scares me about all this is that I’ve come to regard phasers and lasers and bullets as old-hat. I decided I wanted the weapon of choice in my movie to be ship-based lightning cannons. Do the math.
So you can see why I would be so overjoyed to find Teldredge and his addon and all you happy Blenderheads coding away. Anyone want to be mentioned in the special effects section credits in a sci-fi movie?
My wishlist: that the lightning bolts can be targeted to hit individual objects based on their UI names, and can be fired from the different cannons on the ships. That’s it, just a simple weapons system addon, like firing missiles or cannons or phasers or lasers or anything else you’ve seen in a million other movies. I just don’t want to have model and animate a million different lightning bolts in the course of a ten-minute space battle.
Pull it off and I’ll love you all forever. And ever.
Drop me a line or hit me up on YouTube: http://www.youtube.com/user/MartianStories
THANK YOU ALL again for your hard work and skullsweat. And THANK YOU TELDREDGE for the brilliant idea!

we all love you too :slight_smile:

@Adam - Word up dude, thanks. Happy to contribute.

As far as the targeting goes. Make the firing ship the ‘Origin Object’ and make the targeted ship the ‘Cloud Object’ and the lightning will be directed towards it. You’ll still need to do this individually for each ship but should help.
Let me know how it works out.

FYI - Update.
Also - I’ve been working on a few quick-n-dirty animation options but haven’t released them yet. Been busy with other things but should be able to put some time in on it this weekend.