MILLIONS OF PARTICLES! - Unity VFX Graph

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so I really liked articles and I used to think that a thousand particles were fun but then I tried 1 million and it's about a thousand times more fun and with unities visual effect graph having this many particles on screen at once is no longer a problem the reason for this is that VFX graph creates particles that are simulated on the GPU this is unlike the standard shuriken particle system where particles are simulated on the CPU and because doing calculations on the GPU is so much faster we can create much more complex systems with a huge amount of particles on screen the drawbacks of this is that because it's simulated on the GPU it doesn't work with the underlying physics system there are of course ways to cheat this but in general if you want your particles to interact with your game world consider using these shuriken particle system another thing that makes the effects graph extremely powerful is that it's built as a fully node-based toll this means that similar to shader graph we can quickly add and chained together nodes to change the behavior and appearance of our particles so in this video we'll get started using the visual effect graph to create cool-looking particle systems also this video is sponsored by unity and with that let's create some particles so the first thing we want to do is make sure that we're running unity 2000 18.3 or later also our project needs to be using the High Definition render pipeline and before we can actually start using the visual effect graph we need to install it through the package manager so let's go to your window and open up the package manager make sure to go under all packages and let's find the visual effect graph here we can hit install and unity is now going to import the effects graph into our project and once that's done we also want to make sure that we are using the newest version of the HD render pipeline so I'm going to go ahead and update that as well and we are now ready to start using visual effect graph in our project so let's close down the package manager and let's try creating a new graph to do this we'll go to the project panel hit create we'll go under visual effects and select visual effect graph and let's just call it call effect and to actually add this effect to our scene we can simply drag it from the project into the hierarchy and it is going to create an empty object with the name of our effect and on this object is going to be a visual effect component that has a reference to this cool effect as right away we can see particles in our scene now to start editing this effect all we need to do is double click it and it's going to open up in its own separate window and as with any other window in unity we can of course dark this anywhere in the UI so I'm gonna dock it to the side here and make a bit of room for it now if you've ever used shader graph you'll immediately notice quite a few similar looking things we have the blackboard here for parameters and we have this huge open space where we can add notes and navigating around works in just the same way as shader graph we can use middle mouse button to drag and do the same thing with alt and then left-click we can scroll to zoom and if there's ever something that we want to focus on we can always select it and hit F or hit a to show all now what we see here is the structure of a basic particle system it contains a chain of contexts where each context is responsible for one aspect of the system let's just quickly go through these to make sure we understand how each context effects our particles so at the top of the list here we have spawn this context is fairly simple it's where we define when to create particles and how many next one is initialized here we set up the particles starting values we can choose stuff like where will the particle start how long is it going to live and what color does it spawn with the next one is update here we ask what happens to the particle over time this is where we would apply incremental forces or noise to the particle and finally we have the output in other words what will each particle look like how will it be rendered here we can control things like the size and color of each particle and we Neve inhabit its lifetime now the boxes inside of these contexts are called blocks they are small chunks of features that can be added to a context to do a specific task take for example the set velocity random block inside of our initialize context this gives each particle a random velocity between a minimum and maximum value we can tweak this to change the behavior or simply remove it and it will no longer affect our system let's for example change this to spread out evenly in all directions so let go - 1 - 1 on the X - 1 - 1 on the Y a - 1 - 1 on the and we see that our particles are now travelling evenly in all directions if we simply remove it and also disable our gizmos here we can see that our particles are now all just staying at the same point let's undo that by hitting ctrl Z we can always rearrange bugs to control which are applied first and some blocks like this one will even work in multiple contexts if for example we move it to the update context the particles are going to change direction every frame which gives this jittery look I'm just gonna go ahead and drag it back let's also set the minimum Y velocity to point two again now creating a new block is actually super simple we simply hover over the context where we want to create it and hit space and here we have some different categories for the types of blocks that we can create and the cool thing here is that this menu is context aware so it's only going to present you with the options that actually make sense for the given context in my case here I'd like to add gravity to our particles so I'm just going to go ahead and search for it and indeed we have one called gravity force and as you can see as soon as we add this block our particles start falling because of gravity you'll also notice that in the top right corner we're currently set to auto compile this means that our effect is set to automatically update when we make changes so let's try turning this off and one thing you'll notice is that this doesn't actually apply to the values that we input in our blocks if we change the force to minus two it's going to update right away even though auto compile is turned off however if we go ahead and actually remove a block this isn't going to update because it needs to recompile to reflect this change to do this manually we can always hit compile or simply turn auto compile back on now what we're using here is an extremely simple particle system with a very low amount of particles and as we talked about one of the awesome things about running these systems on the GPU is that we can handle a lot of particles at once in fact let's just try going to the top here and increasing our spawn rate to say 10,000 you'll notice that nothing changes and that's because we also have to increase our capacity which is the maximum amount of particles allowed at any given time let's set this to 20,000 and there we go we're now creating a huge amount of particles at once now with this many particles it might be hard to see each individual one so let's go to the bottom here and let's go into the set size of a lifetime block here we have a graph where we can set the size of our particle during its lifetime let's still have it start at a fairly low value but let's decrease the maximum value and now we really start to see just how many particles are actually in here so you've probably already start to see just how efficiently the effects graph can handle large particle systems now unity has also included a few templates to help you get started with the system you would like to create that's it a to show current system let's select all of it and hit delete let's then hit space and let's go under the system category here we have four different options the empty particle system which is going to create a particle system without any blocks in it however it has all the same contexts the spawn initialized update and output you can also create a simple particle system this was the one that we started with the last two ones are the simple static mesh which is going to create just that it's going to display a 3d mesh as a particle and finally this simple swarm particle system I think this template is the perfect example to show that by just adding a few blocks to these context we can create really interesting effects I mean this system is much larger than this symbol particle system however the real power of the effects graph is that we can create and chain together nodes that edit properties on these blocks if we go to the top of our system under the spawn context we could for example change the spawn rate of our system over time using a sine wave and doing this is super simple we simply go to the left here hit space and we can create a sine wave node this is going to plug right into our spawn rate it's going to have a frequency of 1 and it's going to go between 0 and 25,000 now using the input variable we can actually shift through this sine wave and we can of course have the input variable change over time now let's drag out from our input and release and let's search for time and let's use the one called total time and there we go we are now using time to shift the input of our sine wave and based on the output of the sine wave we're changing a spawn rate to be between 0 and 25,000 so we can see it pulsating in the scene view which is just super cool and this is just by adding two symbol notes and just to really signify this effect that's go down under initialize and set the lifetime random to go between 0.5 and two really cool now if you're using a lot of different notes it might be a good idea to add notes to allow yourself to quickly figure out what's happening at a specific place to do this we can always right-click and create a sticky note we change the size of it and give it a title say sine wave as well as a description finally something that is really handy is the ability to expose parameters to be edited from the inspector this is especially great if you're working with really complicated effects or would like to easily be able to add variations to the same effect without having to create a new graph each time now creating a new parameter is super easy simply hit the plus sign on the blackboard and we can choose from a bunch of different types I'm gonna create a simple float value and let's use this parameter to control the frequency of our sine wave let's first of all rename it by right clicking and hitting rename and let's call it frequency let's then set the default value to one and drag it in we then link up this parameter to the frequency on a sine wave and we can now control this frequency from our blackboard so we could set it to four to make it pulsate really quickly or 20.1 to make that go real slow I'm just going to default it back to 1 and right now we can only access and change this parameter from within the graph so if we want to be able to change it in the inspector we need to expose it so let's hit the exposed check box and that's all we need to do let's go to a graph and save it and close down this window and over here we can now see that we have a parameter called frequency and if we click this check box here we can override it with our own value so let's set this one to two and let's also duplicate the effect and move it over and let's set this one to 0.5 and we see that using this same graph we have now created two different effects and you can even override parameters through script to really help integrate your effects with your game so for now switch to the game view we can see our V effects in all their glory yay that's pretty much it for this video if you enjoyed it make sure to subscribe so you don't miss a future one nowadays of course so much more that you can do with the effects graph this video is barely scratching the surface of the tip of the iceberg so if you'd like to see more and how you can use the effects graph to create cool-looking effects definitely let us know in the comments also as you might know we recently launched line of code which is a clothing store for game developers go check it out at line of code IO if you haven't already on that thanks for watching and I will see you in the next video thanks of the awesome patreon supporters who donated in member and special thanks to make a gain and Yochanan Enco heart Arman to VR systems extend the player infinity PBR Sybok mummy didn't Sullivan chef Abdullah Chris mr. Murphy thanks along Luna set fits and fensky wa shrah st ronan bruins cat no Kiyosaki Gregory Pierce Mary tweet kill Swedish key tips rogers repair car Jackson / companion Robert bond Erasmus Anthony patent of breezy James P Chima pulled over John Shannon Alex Jerrod Sookie Travis Dylan Rudy in Toronto and Caston Sue Ellen you guys Rock
Info
Channel: Brackeys
Views: 333,729
Rating: undefined out of 5
Keywords: brackeys, unity, unity3d, asset, assets, model, texture, models, textures, material, materials, beginner, easy, how, to, howto, learn, tutorial, tutorials, game, development, develop, games, programming, coding, basic, basics, C#, VFX, Graph, particles, effect, effects, node, nodes, visuals, visual, compute, shader, millions, particle, system
Id: FvZNVQuLDjI
Channel Id: undefined
Length: 12min 16sec (736 seconds)
Published: Sun Dec 16 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.