Make Awesome Effects with Visual Effect Graph in Unity!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to get started using unities visual effects graph this is a new particle system that is super fast which allows you to have an insane amount of particles it's also node base so it's very easy to create some awesome effects what's being [Music] hello and welcome I'm your code monkey and this channel is all about helping you learn how to make your own games with NF tutorials made by a professional indie game developer so if you find the video helpful consider subscribing okay so here on let's look at the visual effects are first of all we're going to see what it is then we're going to play around with it and in the end we're going to check out some really awesome pre-made samples so the visual effects where F is a particle system in unity it allows you to make some really complex visual effects using millions of particles it is built through a node-based interface so it's very easy to use while also being extremely customizable you can set up some really complex logic to make lots of really awesome gorgeous effects right now there's a spring sale happening on the assets or turns of great assets icons sound effects and awesome tools at a great discount use them to make your game really stand out check it out by clicking the link in the description and if you pick up anything through there you'll also be helping out the channel now as you might know unity has already had a built in particle system for a very long time now the main difference between the belton and the visual effects graph is how one runs on the CPU and the other one runs on the GPU so that means that the visual effects were F does not replace the built in system but rather they won't continue to coexist side by side because each has their pros and cons in terms of the renderer the built in runs on the built in renderer where is he visual effects reference on the universal or the high-definition render pipelines for the number of particles the built in supports thousands of particles whereas the visual effects where F supports millions the built in runs on the CPU so it can directly interact with the physics system whereas the visual effects where F cannot interact directly but it can do it with some complex methods you can use C sharp scripts to directly modify anything about the built in particle system like you can access stats for each individual particle and listen to collision events whereas in the visual effects were a few have similar mutations since you are accessing that on the GPU but you can access and modify expose properties and interact with custom events lastly the built in particle system cannot read frame buffers but the visual effects are F camp so you can see how each has its pros and cons if you want knowns of particles use visual-effects graph and if you want easy interaction with the physics world then you should use the built in particle system alright so now that we've seen a bunch of pros and cons let's try playing around it now if you're already familiar with using the shadow graph then you own very easily pick up the additional effects worth and if you've never used either of them then they are very easy to use its own load base so just follow the connections this video is made possible thanks to these awesome supporters go to patreon.com/scishow to code monkey to get some perks and help keep the videos free for everyone ok so here I am in a basic empty scene now the first thing we need is to install the visual effects graph package so we go into window in order to open up the package manager and then in here you scroll down until you find the visual effects package there it is the visual effect package and then here you just install it also you have the visual effects Rev samples so import those also to your project and we'll check them out in the end now the visual effects where f can run on the universal or the high definition render pipelines so make sure you're using one of those as well in this case I have the universal render pipeline installed so here in the project settings you can see that I'm using a universal render pipeline asset and in asset I'm just using a basic forerunner okay so we down the setup done let's start making an effect so over here in our project files let's right-click and we're going to create and over here something like the visual effects and let's create a new visual effect where let's call this our test the effects so here we have our effect in the project files and we can simply drag it straight onto our hierarchy and there it is there's our effect in our scene so just like that we have our effect now in here one thing of note here in the hierarchy we do not have this exact object directly what you do have is a game object with a visual effect component and then this component has a field for the actual visual effect graph so the graph and the game object are two separate things so for example another way of creating it is let's create a new game object what's going to visual effects and create a new visual effect so we're here we have a new visual effect object and as you can see there is nothing on it because it does not have a visual effect asset assigned so we need to assign it so just drag this one and there you go just like this now it does work so just keep in mind that the graph and the game object are two separate things we're going to see how that is important later in the video all right so let's play around with our effect now the first thing we do is simply double click on our test VFX graph there you it opens up the visual effects graph window and now in here let's dock it right on the right side all right so just like this we can see both the we're having the effect side by side now over here in the graph you can see that it is split into various sections or as they're called contacts now the logic essentially runs from top to bottom so first our particles are spawned then they are initialized afterwards we have the update which runs on every frame and lastly we have the output which finds how the particles are rendered so here we can see how the default effect works so first over here on the spawn context we set the spawn rate so in this case it's spawning 16 particles per second then on the initialize first we assign a maximum particle capacity so for example up here if I set the spawn rate super high you can see that it's not really spawning that many particles in order to do that we also need to increase the capacity so if I increase it if there you go now you can see a monumental amount of Pardons then over here we also have the culling bounds so essentially this is a box with a specific size and this box needs to be visible by the camera in order for the particle system to actually be rendered then we also have a random velocity block so you can see how each particle is randomly moving a bit side by side we also have a random lifetime so particles will live between 1 and 3 seconds then over here on the update context right now we're not doing anything and then lastly we have the output which defines how the particle is rendered and in this case we're using the default particle texture it's set to constantly face the camera it increases its size over its lifetime and it's changing the color from transparent to Y to transparent again so here you can see that the particle does exactly that so it spawns it moves up it goes from transparent on to white and back to transparent and size increases over time now as I said all this is totally customizable so on each context you can add or remove various blocks so for example let's select over here the update particle context and then we can either hit the spacebar or we can right click and create block and now in here we have all the actions that we can take inside of this context so for something very simple let's just add gravity so we can use the search bar to search for gravity and there you go and just like that you can already see that the particles are spawned they start falling down so that's how you add a block onto a context and another thing you can do is also add nodes outside of the box so click out here and either right click or press the spacebar so let's try it out to the very basic test now first let's remove the gravity and then let's also remove the random blocks so just like this as you can see we have no particles so for the first thing let's add a set lifetime block so let's set it to 1 which means each particle won't live for exactly one second then let's also add a set velocity block and let's hit the y22 and yep there you go now we can see each particle moving straight up and then let's also add a set position and this will set the starting position of each particle and now in here and let's play around with these values rather than setting something fixed so let's click outside of the context in here we press space and let's add a simple sine wave there we go we have our sine wave with input frequency minimum and maximum so we have all of our various fields and now if you're already familiar with sheet where often this won't be extremely familiar all we need to do is really just connect the dots so in this case let's expand the position so we can individually access the x y&z and over here on the output of our sine wave let's connect that into the input of the X so just like that we have a sine wave being outputted onto the input for the position X so by modifying this input you can see that we change that so now again just like in shader we're off let's spawn a simple time node so we get the total time and now in here we simply connect the total time onto the input and there you go just like that we have a very nice effect so we have our total time being inputted onto the sine wave and then we have that sine wave going onto the set position X so just like that we have some very simple logic working and just like this you can see just how customizable this system is so you have the various contexts running from top to bottom and then you can apply all the logic that you want using nodes going from left to right now something else you can do is expose properties so for here we have a button which opens up the blackboard so you click it and you see this and now in here we can click on the plus icon and we can add some properties so in this case and let's add a new fold property let's rename this to the sine max let's make it a range range between 0 and 10 and let's default it to 1 and lastly and let's tick this box in order to expose it all right so now here we can use it on our graph so just drag it in there and now we can drag it on to the maximum yet there you go so by default it's going between 0 and 1 so just the same however now if we go into our hierarchy and we select our VFX object over here we can see the various properties so we can see our sine Max and now if you remember a while ago I talked about the separation between the effect graph and the actual effect object so here is where that comes in handy you can see that we have this nice little checkbox on the left side this is the override checkbox so if I don't take it then it's using the default family that we defined on our visual effect graph however we can take this and override this with a different property so in this case and let's make it go to 3 there we go now that one is much wider however the interesting thing is that this value is being applied only for this effect object so here in my scene let's duplicate this visual effects object let's put it on the side here so now we have two objects both of them using the same and drawing graph but now using your property we can make them behave differently so that one is going for a white and now in this one let's override and put this one on one so just like that without modifying the underlying graph we have two different effects so using this you can use the same graph and customize it in various ways by simply exposing some properties then over here on the black board you can see all the various types of properties that you can add so for example let's make a new gradient let's make this our color gradient we're also going to expose it and then down here let's drag it onto our graph and we're going to connect our color gradient to the output color so now again we can select the right one and leave it like that one and on the left one let's change the gradient color so there you go just like that now we have this nice gradient with a bunch of colors and there you go both effects are using the same underlying graph but they both look visually very different so that's how the separation between the actual effect graph and the effect object is extremely useful you make an underlying object you expose some properties and then you can use it in various different ways all right so here we saw the basics for how the visual effects work works we have our various contexts the logic goes from top to bottom and then we can add blocks on each specific context and then outside of it we can add some nodes going on left to right to further customize the inputs for each block so now that we know all of that let's check out the more complex samples now there are actually two samples packs the first one is the one that you download it straight from the package manager and the second one you can get from github so the first one contains some similar effects and second one contains a bunch of really awesome but more complex effects so the first one is over here on my project files so just expand all these so here we have a bunch of different ones so over here we have some nice basic sports then we have some smoke we have a nice lightening effect and then finally we have a bonfire and again you can inspect all of the visual effects where after make up these effects so for example over here we can go into the VFX and inspect the smoke graph and here is the entire effect as you can see it's relatively straightforward we have a simple constant spawn rate then we start off with a certain velocity going upwards with a bit of randomization then it uses a flip book texture for the visual and it also picks a random starting index then on update you can see it apply some force you push it upwards and have some drag then also use a flip up player in order to animate the flip book and then lastly down here on the output it renders the particle makes it face towards the camera increase the size over the lifetime increase and decrease the Alpha and makes it fade based on proximity to the camera so you can look around these samples and inspect off the graphs to see how they were made to get an idea of how you can make some really awesome effects and speaking of Awesome effects there's another simple project with a bunch of really cool effects made using the visual effects where you can grab them from the official github page there's a link in the description download that project and when you open it you don't see this so this one contains a whole bunch of sample so here all of them are there are some really gorgeous effects so it contains a demo scene where we can cycle through all of them so we're here we have the unity on Logan looks really cool then we have this mask with some really awesome mesh deformation then over here some butterflies just flying around there's one with some grass being affected by wind and movement this one is showing off some really cool volumetric light so it turns out particles then over here some really cool important and as you can see it's interacting with the floor then this nice animation showing up some nice planets this one which is super cool showing some Vox and wise terrain so here a bunch of options bunch of things that you can play around with and looks really awesome just like that then the genome which is the first one that they made there you go the genie comes out of the bottom while the particle is moving in there you go tons of particles the spaceship tunnel this is also one of the coolest ones the really cool Hong gram effect with the animated meshes and the effect on the side we're only come upon fire with some fire smoke lights and so on some really nice ribbon animations and finally the magic book with the pages being torn going upwards and so on and so forth so this one is actually combining the visual effects raft with the work so as you can see over here we have tons of different samples all of them looking awesome and again you can inspect the graphs to see how they were made so for example here is the scene with the unity and logo and you can inspect the entire graph so here it is the entire effect as you can see it's a lot more complex but it also has a whole bunch of sticky notes so you can easily understand how actually works so you have tons of samples which showcase the power of this awesome tool if you like to see me go more in depth into how each of these samples work let me know in the comments all right so that's the visual effects graph it allows you to create awesome effects that render mils of particles to really make your game stand out this video is made possible thanks to these awesome supporters go to patreon.com/scishow new code monkey to get some perks and help keep the videos free for everyone as always you can download the project files in a tony's from unity code monkey calm subscribe to the channel for more unity tutorials post any question have in the comments and I'll see you next time [Music]
Info
Channel: Code Monkey
Views: 164,039
Rating: undefined out of 5
Keywords: unity vfx graph tutorial, unity vfx tutorial, unity visual effect graph, unity vfx graph, unity visual effects, unity vfx shader graph, unity shader graph, unity vfx, visual effects, code monkey, brackeys, unity tutorial, unity game tutorial, unity tutorial for beginners, unity 2d tutorial, unity 3d, unity, game design, game development, game dev, game development unity, unity 3d tutorial, programming, coding, c#, software development, learn to code, learn programming
Id: LhvnIOlmXMM
Channel Id: undefined
Length: 16min 31sec (991 seconds)
Published: Thu Apr 16 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.