10
$\begingroup$

How can you render a lightning bolt using Cycles?

$\endgroup$
  • 2
    $\begingroup$ blenderguru.com/tutorials/how-to-create-a-lightning-storm $\endgroup$ – someonewithpc Jan 4 '15 at 18:59
  • 2
    $\begingroup$ Granted part of this lies here blender.stackexchange.com/questions/1875/… so any answer need only concern rendering. $\endgroup$ – iKlsR Jan 4 '15 at 19:50
  • $\begingroup$ Okay thank you for the info l hope this will help me l hope and sorry for the small details why do l need to create a lightning bolt because this week l'm busy l have lot of things to do l'll try edit my question as soon as l can and l hope the people are not mad at me $\endgroup$ – Paulius Jan 5 '15 at 20:56
  • $\begingroup$ @someonewithpc That tutorial is in Blender Render, not Cycles. $\endgroup$ – meed96 May 2 '15 at 16:53
  • $\begingroup$ The hardest part is really not the Cycles materials, as you can make them similar to how is shown $\endgroup$ – someonewithpc May 2 '15 at 19:04
13
$\begingroup$

To create your lighting start with a mesh, you will need to add thickness to it, so apply a skin modifier, enter edit mode, and use CtrlA to scale the "thickness" of you mesh until your satisfied with you lighting.

There are now to approaches, the not so great looking and very very slow material only approach, or the materials and composting approach which will go much faster and look way better

Material Only

Approach

Lighting lights up the whole sky, since what it is in essence doing, is illuminating dust and water/mist in the atmosphere with its very intense glow. In this solution we will replicate that by using volumemetric rendering. For this we will need two materials, lightning and atmosphere

lightning materal

For the lighting, we will only need a simple two node shader:

enter image description here

The emission will create a very bright white mesh, and it will have a blue cast on surrounding objects.

Atmosphere material

The atmosphere will have a "haze", in order to do this, we need to give the world a volume by adding two nodes, volume scatter and volume absorption. The volume scatter will cause the light to spread inside the world, while the volume absorption will cause the light to fade, stopping our lighting for illuminating the entire atmosphere. Balancing the density of the volume scatter & volume absorption is the key too a good result. Having the volume scatter be two dense will cause the lighting to white out the sky, while having the absorption two dense will cause the lighting glow to all but disappear. The ratio between them controls the spread of the lighting glow.

enter image description here

Result

Rendered at 50,000 samples, taking 50 minutes

enter image description here

Approach Downsides

Renders will appear noisy even at sample counts as high as 50,000, and render times can take hours. it also just doesn't look that good.

Material & Compositing

Approach

Because of the incredibly time consuming render times of the previous approach, and the difficulty of fine tuning, this in many ways is the superior approach. Instead of using volume, we will try to fake the light spreading by using blue nodes in the compositor.

The lightning material will stay the same as above, but this time we won't modify the world material at all. Instead we will go into the compositor to add the glow

Scene setup

Set the lightnings material index to 1, instead of 0.

enter image description here

Next check the Object Index pass in the Scene properties

enter image description here

Node setup

enter image description here

I used the Object index here, since its values were 1 - 0 vs the render had values of several thousand for the whites, since the lightning was set to realistic brightness levels. I then used curves to raise the brightness to acquire more glow. I then used the glare node to blur (thanks, gandalf3 for the tip), which gives the best blur, to add the glow that occurs in the lens. Atmosphere can also be a factor, but not in this case. Finally I colorized it by raising the blue channel using the curves, as well as the green channel (to a lesser extent).

Result

Rendered at 1 samples, taking 0.9 minutes (including calculating the compsiting)

enter image description here

Approach Downsides

The main issue with this is that the lighting will still appear as a white line to surrounding object in the scene.. this answer details workarounds for that issue, but be aware that this may complicate the scene

Bonus: Awsome lightning gif by gandalf3 (creating using the compositing technique)

enter image description here

Bonus #2: I rendered the volumetric lightning at One Million Samples, taking 15 hours, 14 min, and 26.9 Seconds... and it still has some noticeable noise:

enter image description here

$\endgroup$
  • $\begingroup$ Hold up, 50,000 samples? 50,000 samples? Rendering the default scene with 50,000 samples on my GPU and Blender is telling me it's gonna take an hour and a half. And yet with lightning your render only took 50 minutes? $\endgroup$ – meed96 May 2 '15 at 16:56
  • $\begingroup$ @meed96 What system do you have? I was on a Nvidia GTX 670... could make a difference... $\endgroup$ – GiantCowFilms May 2 '15 at 17:00
  • $\begingroup$ Well I have a GTX 750TI so I suppose that makes sense. I've just never heard of anyone rendering at 50,000 samples. It's like someone casually telling me that they rendered at a million samples. $\endgroup$ – meed96 May 2 '15 at 17:02
  • 2
    $\begingroup$ @meed96 I was going to try a million samples (just 'cause)... but I figured it might take well over a night, and I needed my computer... $\endgroup$ – GiantCowFilms May 2 '15 at 17:04
  • $\begingroup$ @meed96 Also blender time est can be widely out somtimes. $\endgroup$ – GiantCowFilms May 2 '15 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.