Unity 2017 - Game VFX -Lightning and Thunder Effect

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome to tutorial number 21 of the series visual effects for games and today we are going to see how to create lightning there are mainly three ways we can do this the first method is by using the noise and trails features of the particle system inside unity to create something like this this one is fairly easy the other one is by going to Photoshop or and start creating one or two textures similar to this one this one is a bit hard disease you will require some skill to do it and the last one is by using After Effects to create a spreadsheet like this one which is fairly easy but you require After Effects after all alright so let's see how you can create lightning with these three methods alright so let's start by creating the simplest one which is the noise and trails and for that we can create a particle system I'm going to rename it to lightening noise in trail I'm going to rotate it 90 degrees and the first thing we want to do is reduce the start life time since lightning is something very fast and something between 0.4 and 0.6 is enough you can make it even quicker if you want and in the mission I'm going to use one in the right over time which means one particle each second now the start speed it really depends on your scene on the size of your scene my scene is a little bit too big and I'm gonna set values between 100 and 150 maybe even more and for the third size we actually want something very small since we are going to use trails and we can control the size in the wide / tail but as you can see we have a warning here saying that we need to assign a trail material and we can keep going on with the default particle so you simply need to drag to the trail material and you can also increase the max particle size so when we get closer it doesn't shrink now like I was saying we can increase the size of our trail by pushing the valleys of wide over tail to between two and eight and the next thing we are going to need is the noise the noise is where we control all spikey our lightning is going to be and we can set the frequency of 10 which is basically scaling up the nice pattern and then we can increase the strength values to create contrast and we start seeing already some Lightning you can also increase the scroll speed and if you want even more details you can set the activists for and up to the scale to higher values as well as the multiplier and as you can see this is the core concept of how we can make lightning with noise and trail to improve this just a little bit we can use a gradient for the color of a lifetime similar to this one for those who don't know the keys on top control the opacity and the keys at the bottom controls the color so you can create something similar to these and this will basically make the tender or lightning flash next thing we can do is give some start color to our lightning and I'm gonna use some purple and pinkish color something like this by the way let's increase the wide over tail we want some bigger lightning something like this which I think looks much better and I will recommend that you play with the noise module you can create some cool effects and improve your lightning let's just turn on collisions and set the type to world and now we need to set the bounce to 0 and then to 1 so the particles don't bounce and with the collision on we can use Suba meters to make sure that when the particles in the ground they will spawn some sparks so let's create those sparks let's duplicate this particle system and we don't need noise collision Suva meters or trails we can turn this off but we need shape so let's turn on shape and set the shape to cone and the radius has to be set to 0.1 in my case maybe in your case it's smaller and then we need to decreased start speed to around two and eight let's also rotate these two minus ninety degrees in the x and push this down until it's close to the ground and sparks need to be a little bit bigger so let's increase the start size to be around 0.05 and 0.2 we just need to go to the emission and we don't want to use rate over time we want to use one burst which will spawn between five and fifteen sparks alright so we are starting to see something let's go to the renderer and change the render mode to stretch it billboard with a speed scale around 0.05 or even more what this will do it will basically stretch our particles and they will look like sparks and this is pretty much done all we need to do now is go to the gravity modifier and set a random number between 0 and 0.6 and increase the start lifetime now let's select all a lighting particle system and in subby meters we can select collision if you haven't already selected and drag and drop this part to this slot unity asked us if you want to reparent this to the lightning and we can say yes now each time a lightning hits the ground it will spawn a spark which is quite awesome and now let's see how we can do this with Photoshop so in Photoshop or we can create a new file with 500 by 1000 create a new layer with control-shift-n painted background to black now I can't go into too much details but I can help you by saying that the breakdown process of drawing and lightening is composite of three simple phases at least for me the first phase is with a big brush with an opacity of around 20 we start creating the shape of the lightning something like leads as you can see and it doesn't need to be something very accurate or too strict remember this is a lightning it has some very bumpy spikes the second phase now is with a slightly smaller brush we can start creating some details and then the last phase is with a very thin and small brush with an opacity of around 40 great really small details and the last thing you can do which has nothing to do with the drawing phase is accessing the layer style by double-clicking in the layer he's turning on outer glow change it to white and increase the size that's the very basic way of how I created a lightning texture now once we have done we can export that as a PNG to unity annuity let's create a particle system I'm going to rename it to lightening Photoshop and you can create a new material with shader set particles additive drag the text that you have just created and drag material to the particle system now in the particle system the first thing we want to do is set the start speed to zero we don't want this to move and in the emission the rate over time you can sell it to one particle each second just to see how this is looking and now we have to turn on to the size control the size of our texture so basically it's going to be random between 30 and 10 in X and in the Y it's going to be random between 60 and 50 the Y in my case represents Auto the Lightning is going to be sales I have rotated 90 degrees in the X now let's go to the renderer because our anchor as you can see it's in the middle of our texture and in the people we can put it in beginning or the opposite it's up to you now let's make sure that start lifetime is really small like we have done before and in the 3d start rotation we can make it to render between 0 and 360 degrees in the y axis now let's turn on color over lifetime and we can use the similar gradient to the one we have used and this is basically done there are a few ways we can improve this by using these parks we have created before or by using a beam of light that we'll show you in just a few moments and for the last method we can use After Effects to create something similar to DS alright so in the project panel let's create a new composition I'm gonna rename it to electricity zero zero eight in my case and the white can be 500 by 1000 framerate is going to be 25 and the duration it's going to be only one second and now we need to select the pen tool this icon right here and in the top of our composition in the middle we can create one point and then try to create a zigzag like this one and as you can see we have some weird line this is because we are feel and we can remove the field by going down here we can simply select the field and press delete alright so now we have this line and right here to the right we can search in the effects and presets for to blend displace and drag and drop on top of the shape and as you can see it starts already to displace our line and we can control the amount of this place in the amount parameter and the complexity amount is going to create more complexity as you can see and if you press play with spacebar this is not animated and we can easily animate that by holding out and pressing in this clock near the evolution just like this down here we can just type time multiply it by 360 and now it's animated but if you look closely you will notice that it is not looping and this happens because in the evolution options we have to turn on cycle evolution and set the cycle to 1 and now it's looping alright and the next step here is to increase the complexity to around 5 6 it really depends on what you want to achieve here there is also another trick if you go to the stroke in shape you will notice that here you can control how thick or our Finn hours lightning is going to be and now we can animate this by five at the beginning and around the fifth frame we can increase this to ten and did the frame 20 we can say it's going to be 10 and in the last frame we can again set it to 5 and if you want in the middle you can set it to 5 it will make it more fake and morphine along the animation and now I'm going to adjust the complexity and the amount just like this until I think it looks good and then the next thing we want to do is add the glow by searching in the effects and presets search bar and drag on top of the shape let's increase the glow radius and the intensity just like this and if you want you can give the next a glow by duplicating the glow with control D until you end up with some cool glow lightning just like this now the last thing we want to do is to export this and we can go to file and in export select add to render queue now let's click down here in the output model and in format let's like PNG sequence and make sure that in channels we select RGB + alpha and press ok now the output we can select a place where this is going to export and you can see down here that it will create a folder for you once it is exported you can create a sprite sheet with this software with an odd one there are plenty more softwares that will create a sprite sheet or an atlas for you and we want to create an atlas or a sprite sheet with five by five after you have done so if you want you can reduce the size in photoshop it's really up to you but then we want to import this to unity in unity we want to create a particle system I'm gonna rename it to lightening place it in the right position and with the right rotation create a new material and change the shader to particles additive now we can drag and drop the spreadsheet that we have created and now we only need to turn on text to shift animations set the tiles to be 5 by 5 which is the size of our spreadsheet and we don't want any start speed so let's set it to zero and the emission is also going to be zero because we want to burst with only one particle so let's set the start lifetime to be one for now alright so this is really small and let's turn on 3d start size so we can control the size of T's between 15 and 25 for the act and 60 for the Y of course this depends on the size of your scene as you know it this is still a little bit too slow so it's the crease to start lifetime and as you may notice the people of our lighting is in the middle and to fix this we can go to renderer and you ready put the people at the top or at the bottom I'm gonna put it at the bottom since this will allow us to spawn beam of light sparks in the ground and give the illusion that the Lightning is hitting the floor because as apposite to the noise and trail particle system we don't have any particle that is moving throughout space so basically unity doesn't know when this particle hits the ground now if you want you can turn on 3d start rotation and make it run up between 360 and 0 in the y-axis and this is basically done if you want to make this effect an area you can go to shape and sell it to a box just like this and by the way we also want to use the color over lifetime with this grant that we have already use it for and now let's create a new particle system which is going to be our beam of light you can also use it in the other particle system that we have used and start speed is going to be zero we also don't need any shape and we want to burst between 1 and 2 with a rate of a time of zero and start life time is also going to be more or less the same as the lightning because this will flash this is basically a flash you can change the start color something like this similar to this with some low opacity and we also want to use size over lifetime with a curve that goes from big to small now if you go to the Lightning particle system in the tsuba Vitor's model you can turn that on and basically drag and drop our beam of light to this plot unity asks if you want to repair it we can say yes and now each time a lightning hits the ground or at least it seems like it hits the ground we see some beam of light at the bottom let's just improve this by duplicating the beam of light we animate to flashlight I'm going to add already to the tsuba meter of the lighting and in the flashlight we'd want to make some small changes like for instance increase the marks particle size to 3 and set people to be a little bit higher like this so it will basically spawn on top of the lightning and we really need to increase the start size of these some big values like 80 or 100 or even more and you have to adjust the people again and that's it now if you select lightning and press play you can see that we have a beam of light at the top and at the bottom this flashlight you have to squeeze the burst count of our flashlights to 1 make it bigger and the quiz also the start color opacity by the way and now it looks much better and if you want you can add these to the other lightnings that you have created the Lightning with noise trail and the lightning with the Photoshop and it will prove a lot you can also add some sparks to this lightning and you can end up with something like this so this is basically it for this tutorial guys I hope you have enjoyed if you can please support me my patreon page you can find a lot of visual effects for games there are some cool stuff there I want to say thank you to all the patrons who are supporting me you are amazing guys in the next two we are going to talk about performance of particle systems and effects in games I'm gonna give you some cool tips that I have learned along the way and I hope you have enjoyed subscribe for weekly game development tutorials and see you in the next video you
Info
Channel: Gabriel Aguiar Prod.
Views: 105,110
Rating: undefined out of 5
Keywords: unity tutorial, unity special effects, game effects, particle system, unity particle system, effects for games, vfx for games, unity game effect, unity vfx, spell effect, unity projectile, unity effect, unity orb, magic vfx, magic effects, vfx, unity lightning, unity thunder, unity lightning effect, unity thunder effect, unity bolt, unity ray, lightning, thunder, ray, bolt, after effects lightning, after effects thunder, photoshop lightning, photoshop thunder, after effects
Id: ewC_c6aHbf8
Channel Id: undefined
Length: 17min 57sec (1077 seconds)
Published: Sun Jan 14 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.