Unity | How to make Shock / Lightning Particles (VFX Breakdown)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video  I'll give you a breakdown on   these lightning particles I  made for my game Astro Kat as always you can find all the source  files you need in the description   so for this effect we need to look at four  parts a lightning texture a dissolving Shader   a custom particle mesh and finally it will  all come together in the particle system let's start with the lightning texture   I'm doing this in Photoshop but you can  do everything I'm doing here in photo P   it even has all of the same names and I think  even all of the menus are in the same place create a new image 512 by 256 make the background   black turn on pattern preview so we  can see the tiling of the texture on a new layer draw a zigzag line erase parts of it now with layer Styles we will create a  distance Field Effect which is a gradient   around and within the texture that our  Shader will use turn on stroke set it to   gradient make sure the blend mode is set to  normal set the gradient from black to Gray the style to shape burst duplicate the stroke Style  by clicking the little Plus   reverse the gradient set the position to inside  this time setting the gradient from white to Gray and adjust the size so it covers  the inside of the lightning zigzag the texture might look a little bit weird  but it'll make more sense in the next part   which is the Shader instead of going line  by line I'm just giving a rough overview   here but the Shader code Linked In the  description has comments and the Shader   graph will have groups describing what parts  of them do if you want more information so the   Shader will sample the lighting texture  like normal then to create a cutoff we   step the lightning texture with a slider this  slider is just here for demonstration purposes   in the actual Shader it is driven by custom  particle data but we will get to that later   so the gradient stroke layer style in the texture  is now giving us sort of a dissolving effect next step we add In Color by sampling a vertical  gradient texture on the lightning texture then subtract the slider so the lightning will  start bright and while it's fading go further   into the gradient now to make it feel a bit  more Dynamic just scroll the lighting texture   a little on the X of the UV to make the effect  look more 3D let's make a custom particle mesh   I created a sphere selected the  two Center loops and deleted   the rest deleted some of the bottom  faces and move them around a little   then I repeat this process for a secondary mesh  do you feel will be important so make sure that   the UVS are laid out to the whole Square so before  we set up the particle system make sure that you   go to the linked post go all the way to the bottom  and here you will find the Shader code the Shader   graph is attached there are two lightning meshes  attached and there's the lighting texture and a   gradient texture when importing the lightning  texture make sure that it is set to import as   single Channel red and for the gradient texture  make sure that the wrap mode is set to clamp I've already set up a material from  the Shader using these settings in the scene I just have a test mesh and a  post-processing volume with some Bloom on it   let's create the particle system first up in the  renderer add the material we just set up then in   the base particle settings set the lifetime  to something short like between one and two   set the starting speed to zero turn on 3D start  size and set the x and z to between 0.5 and 1.   and the Y between one and two in emission set the particles over time to between   1 and 3 and add a burst between 5 and  15 every second with infinite Cycles then in shape set the type to mesh render and  select your testing mesh turn off the mesh colors   just in case and turn on align with Direction so  the particle is oriented to the normals of the   mesh turn on size over Lifetime and set the curve  to start around 0.7 going up to 1. then we get to   the important one custom data turn it on and set  custom 1 to vector we only need one component and   turn this x component into a curve set it to  go up to almost one very quickly at the start in the renderer set the particle mode to mesh  and select the first of the custom particle   meshes then click the plus and add the other one  it will choose randomly between the two you can   turn off apply active color space it might give  a better color result depending on your setup   uh now turn on custom vertex stream so we can use  the curve we made in custom data click the plus to   add another stream choose custom custom1.x and  you should see the particles fade over time now   at this point the effect is done and  you can tweak it however you want   I increase the intensity of the  tint in the Shader so it glows more I tweak the custom data curve for a secondary  Flash and added another curve to choose between And that'll do looks pretty good right   so now you can set up your own lightning effect  if you want more info check the post linked below   and if you want more tutorials like this check  out my GitHub page that has links to all of my   tutorials about all sorts of Game Dev topics  finally a huge thank you to my supporters on   patreon who make these tutorials possible thanks  for watching have fun and see you in the next one
Info
Channel: MinionsArt
Views: 36,441
Rating: undefined out of 5
Keywords: unity, shader, lightning, particles, shock, electric, vfx, minionsart
Id: NMTXHnsxgss
Channel Id: undefined
Length: 7min 20sec (440 seconds)
Published: Thu Sep 29 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.