Blender Tutorial - Lightning with particles |
So... we wanna do lightning? Are you sure? Ok :|, but it's kinda dangerous. Oh, we do it in Blender!
Why didn't you say that right away? :)
We're gonna do it with particles, and use the curve guide features to our advantage! You can download the .blend file used in the tutorial
here. This tutorial requires Blender version 2.40
in order to be realized (curve guides).
|
First...
We'll create a curve path which will be the path of the lightning.
Try to make the shape look like real lightning, a bit blocky,
not very smooth, like in the pictures on the right.
Also remember to make it three-dimensional like in the image below
so that it's not flat from any viewpoint.

To get this result with a curve object, you need to convert
the curve mode to "polygon", which can be found in the F9 edit buttons.
Just click it once and you can edit the curve like polygons.
|

Then...
Ok, Now we can make the SOURCE of the lightning, which is... a simple plane. The plane won't be very big,
if you want a long and narrow lightning. We'll come the size matter later. Now we need to place the plane in the
top end of the curve. Ok, we have now got the objects to create the lightning from.
This is where the particle effects come to the picture...
Press F7 key, push the "physics button" (the small "meteor" button), click on "new" to add a new particle-effect.
Set the settings something like in the image below, depending on how big both your plane and curve object are.
The objects in the blend I made, were quite big, so you might need to reduce the values a bit if you got a smaller object.
Remember to go forward in the timeline/frames to see how it the effects look.
I rendered the scene somewhere between frames 81 - 120.

The Disp value (the percentage of particles to display)
is "5" so it displays only 5% of all the particles of the effect in the 3d-window/view. You might want to put it to 100%
while configuring/setting up the effect, so you know a bit how it will look in the render.
Turn on the Vect setting. This will make your particles "connect" together, making them look like consistent lines.
Make sure to set the value left to the bspline setting and set the amount to maximum, which is "100". This setting defines the
number of key positions in the particle effect. The more key positions, the more accurately it it follows the curve, and vice versa.
Disable particle emitting from Verts.

But BLARH? Why aren't the particles going along the curve object?
Well, we haven't yet set (jet set, hahhah...) the curve object to act as a curve guide.
Now that the particle effect is done select the curve and then in F7 buttons, where you should already be at,
click on the pulldown menu called fields under Fields and Deflection panel, and select "curve guide" from amongs the options.
Set the options something like the options on the right.
This isn't the logical order to work (to first set the whole effect then guide it), but I just wanted you to see the change,
how the curve guide actually affects the particles. You can press shift+alt+a now to see the particles flowing in animation.
If nothing seems different with the particles, select the curve, go to edit mode and press "W" and select switch direction.
See, the curve guide works from one end to another, if you use distances. Feel free to tweak the settings as much as you like,
you might even need to ;), since this tutorial is everything but perfectly accurate.
Anyway, now it's time to give an according material to the lightning source plane which emits the particles...
|
Materials... (F5 buttons)
Ok, we'll use a halo material. It has default value for the hardness, but it has
got some increased add value, about 0.500, to make the lightning glow. The A = alpha value
isn't on maximum, because we want it to be a bit transparent to make the edges a bit soft.
It also has lines and star options enabled, to give the lightning those sparkles of electricity.
Reduce the number of lines to under 10, and add some seed value to give random variety on to the lightning.
The halo size is quite small, giving the effect more details. If we didn't have so
many particles in the effect (amount of particles) we couldn't use such a small halo size, because then the lightning would look like
it had holes in it.
Enabling Ztransp (transparency) in Mirror Transp panel is recommended for this material,
too. Though it did not seem to cause any changes in the render, it can't do any harm, since usually the alpha value won't work without it.
If we render it now, it does look ok, but not very realistic, because it's very sharp from the edges. It could be a spark of electricity,
but it doesn't necessarely look like a lightning bolt.
What we'll do is a nice haze around the actual lightning bolt. (In the included .blend-file there is an object called "blur around").
We'll just duplicate (Shif+D) the plane that's in top of lightninng and scale it up just a bit. Then we will tweak the effect a bit. Below are some the settings
used in the included .blend file. Your effect might not be totally identical to it, because the size of the curve might be different.

The important thing is to make is effect a bit thicker/fatter than the actual lightning effect.
Since the effect's properties were also copied when you duplicated the plane, you only need to tweak
some of the settings. The key thing to make it a bigger is the random value.
Set it about three times the value of the first effect. This will give more "freedom" to the particles
and thus make the effect a bit fatter. Also, the amount of the particles is reduced a bit, about a third,
in my scene I changed it from 7000 to 5000 as you can see.
Don't bother rendering the scene yet, it'll only look like a crack between two
dimensions (got you rendering didn't I). So, we need to give the "haze" object
it's own material. We can do this by selecting the object, ok, it has a material,
don't delete it, but click on the material's pulldown menu and select add new.
Now we get a copy of the original lightning material, and just like with the effect, we only need to tweak some particular values
to get what we wan't instead of having to create the material from scratch. Check the picture below for the material settings.
This material has got a lot bigger halo size and minorly more add value, fewer lines and the alpha values has dropped near zero. Other
settings have remaided the same. In fact, increasing the halo size is where we really make the effect fatter, and also it makes the haze smoother,
since the bigger halos have a larger fade-out radius on the rendered picture than small ones with these settings.
The halo size value is dependable on the object sizes, so you possibly might need to change it a bit the model you've made.
In this case, size does matter.
Anyhow, the lightning it self is now about ready. We can add a couple of details to give it some extra boost :).
|
Final Steps...
I bet you're now almost peeing your pants of excitement (either because this tutorial has taken so long or you need to use the toilet).
Anyway, if you wanna give your lightning the finishing touch, you better not let it flow now.
Lightning bolts usually create a bright flash when they split the sky with an immersive speed.
A lightning also lights the sky, and the clouds, and we wan't our lightning bolt to do those things as well.
First we create a third plane approximately to the same location as the previous planes, to the top of the curve guide.
Give it the first lightning material we made, then create a new material based to it (pulldown menu-> add new),
and tweak it into something like the material on the picture below.
 
You only need to increase the halo size to get this result since the rest of the settings remain same as in the original material.
Ok, now we got the "flash" that bursts from the top of the lightning high just beneath the cloud zone. We wan't also some clouds,
and those can be achieved with a plane and a cloud texture.
Just create a big plane a bit above the objects you've already created. The scene should now look something like the picture on the right.
Then add a new material to the plane.

It should have about the same settings as displayed on the images on the left and below.

Alpha in Map Imput and Ztransp in Mirror Transp panel are important settings
when creating transparent clouds. In this case, also the multiply blending mode is required to get transparency.
We also need to add the texture, without which we can't even set the texture settings at all. Add it in Texture Buttons (F6)
after creating the material. Select the Clouds as the Texture Type.
The texture should have somewhat the settings as the ones on the picture below.

Reduce the noise size a bit and increase the noise depth to 5 or 6 and
change the noise type to hard noise to really get it look like the menacing type of raging stormy clouds.
We still need a light to illuminate the clouds when the lightning strikes from the the sky.
Add a lamp on top of the lightning/curve guide. The lamp has to have relatively much Energy
and Distance to light it's location under the clouds nicely. And again, below on the left is an example of the lamp's settings.
It doesn't have to be a ray light unless you have objects which you want to be casting shadows on your scene. Besides,
in this case a ray light on the scene will take a bit longer to render, so there's no use for the ray setting for us.

To finish up our scene, we want to get some mist around the view to create an atmosphere of "a dark and stormy night" ;).
So, like on the picture above on the right, click on the "mist" and enable it. Then select the Quad option, because
with that setting the mist will spread to every directing the same way, like a sphere. After that, you define the Start
(the starting distance, where one starts to see mist/fog) and the Dimension (the distance in which the fog will become inpenetrabable by vision).
Leave the Height (Hi) setting alone, since we don't need it. It defines the height of the fog.
If you go to the Camera Settings (select your camera and press F9) and enable Limits and Mist in the Show:
panel, you can easily see in the 3d-view where the mist starts and where it becomes too thick to see through (dimension). You can also try
rendering the scene without any mist, it can look even better when rendering from an upwards looking view. In the included .blend file, the
camera was positioned like in the pic below. You can see the starting point of the mist, it's the yellow part of the black line coming from the camera.

Ok, we're done now! (only this tutorial I hope)
Now just render, tweak, and try different camera angles, and you should get a decent lightning effect in no time :).
Here is what the render from the included .blend file from a frame I don't remember, with some post-processing (a sharpen filter in photoshop).
So, I hope you got something out of this and maybe learned new tricks with Blender. If you encounter problems (with achieving the desired
results) during this tutorial, come to #blenderchat @ brown.freenode.net / vinge.freenode.net, and ask me or someone else.
Happy neverending, vertice bending, sahweet blending!
-Falgor
|