Unity VFX Graph - Stylized Smoke Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so what is going on guys welcome back to gabriela gabriel and today this video is all about smoke more precisely stylized smoke or tunish smoke we are going to use vfx graph and shadow graph but the shader itself is very basic it can even be used as a fire or a strange chemical burning quite a versatile technique and even to create a dust impact among other things i'm sure so yeah it's a pretty cool effect and all of this is possible thanks my patrons and by sparking me you get access to many more projects and assets that you can use in your games so with that being said let's jump right into it and i am using ut 2020.3.19 with the universal render pipeline and in the package manager i have installed vfx graph and just make sure you go to edit and in preference in visual effects you turn on experimental operators blocks so you can have all of the features of vfx graph so what do we want to start with well in this case let's start with the shader with right click i'm going to create a blank shader graph you can create a vfx shadow graph as well and rename it to smoke shader tooth double click to open this up and in here the important thing is to say that the target is going to be visual effect depending on the version you can use universal i'm going to leave this as unlit and turn on alpha clipping now in the blackboard we can add two properties one for the color and the other a float for the fresnel power and the color we can multiply it with the fresnel node you don't necessarily need this you can also use the text instead of the fresnel but this will look interesting let's connect the fresnel power and connect this to the base color and make sure you press save asset to save this shader because now we are going to test this out in vfx graph so in a folder let's create with the right click a visual effect graph we can rename it to vfx graph underscore stylized smoke and then double click it to open it up we are doing this because in here to see the shader in action we want to change this output to the output particle mesh you can delete this output particle quad oh and by the way let's drag and drop this vfx graph to our scene so we can see what we are doing okay let me just focus the vfx graph in the scene okay so it's spawning capsules as you can see with the default part context but we want to change the shadow graph to the shader we just created and it should be something like this nothing special this is useful to see what we are doing and by the way as you can see our properties have a very strange name color underscore and vector 1 the scar something so if we go back to our shader we can select the color property and in the graph inspector what i like to do is rename the reference to the same name of the property but add an underscore in front and in this case we can change the color to a default white with alpha at 100 and select hdr for the color in case you want to make your smoke glow it may be useful i don't know now for the fresno power let's also rename the reference and add another score i'm going to set default value to 0.2 for now and this is probably one of the simplest shaders i'm going to use a procedural noise you can use a texture as well but for the simplicity of this tutorial i'm going to use a voronoi we have this cell density which is basically the scale and we can create a photo to control it and rename it to voronoi scale this is going to dissolve our smoke away let's rename the reference by the way of the smoke scale with a default value of 3. and we can connect this to the alpha input of the fragment function and last thing we need to dissolve our smoke away in this case the capsules is to create a float and rename it to alpha clip rename the reference by the way and this one is going to be a slider between 0 and 1. this is going to be connected to the alpha clip threshold and as you can see we get the beginning of the dissolve effect of the erosion effect you can play with alpha clip and you will notice this is indeed eroding the capsules and it's going to be useful to create our stylized smoke but we are not going to use the capsule we need something similar to this which i created in blender and i'm going to show you how you can do it so i'm going to open up blender the first thing we can do is remove everything select everything with a and press delete and then we can press shift a to add an ico sphere and without unselecting the ecosphere in this left bottom panel we can decrease the subdivision to 1. but we are going to go to the modifiers and add a subdivision surface because it's going to look a little bit different than two divisions in the ico sphere now it's really up to you to shape your smoke with shift d i'm going to duplicate three times you can duplicate more if you want i think three times is enough and create something similar to these now we need to join this we can select everything and press ctrl j but as you can see if you press z to see true we have a lot of faces inside that we don't want and there's a little trick we can do to make this a little bit more uniform in the modifiers we can use a re-mesh modifier and now everything is together indeed and if you want some cubist smoke you can do it right here which is pretty cool we are going to go with the voxel and we are going to turn on smooth shading we can leave the adaptivity at zero and the voxel size i'm going to use 0.15 0.1 0.15 0.2 something along those values should be fine you can choose whatever you think looks best now you have the smoke model smoke mesh we only need now to apply these modifiers first the subdivision and then the remesh now we need to press tab select everything with a and we need to create the uv maps so let's drag a new window from down here and up here we can select uv editor just so you know what the uvs look like press u and now we can use the sphere projection and it actually looks not that bad we just need to make sure that everything is inside our uv boundaries so with this i'm going to scale this down a little bit and adjust this so it fits and that's it now we can simply get out of the it mode with tab rename this mesh in this panel to smoke's roman for example and then you can press ctrl s and save this directly to your unity project now back in unity we can select in the mesh property of the output particle mesh the smoke model we created all right looking interesting nothing special for now before we proceed with the effects graph let's go back to our shader and add the last properties which basically are envoronized speed so we can move this voronoi basically animate the voronoi it's very simple we only need a time node multiplied with the float and this float is going to be called voronoi speed rename the reference by the way default file can be 1 for example and then connect this to the multiply and multiply to the angle offset of the varnoi and that's it the shader is done now we can play with vfx graph oh and as you can see if i pause this it is indeed animated cool now let's play with this so we want to animate the alpha clip so it dissolves away throughout the lifetime of each smoke particle first let's set this a pack it will look a little bit better in my opinion but that's up to you as well so to animate the alpha clip we simply need to sample a curve you can press space bar and search for one we can select this one that goes from 0 to 1 and push this key to the right and make it look like this so it doesn't dissolve immediately away but instead takes a little bit more now for the time option of the sample curve we can use the age of this particle the h over lifetime which is a property that each particle has and it goes from zero to one then connect it to the alpha clip and that's it the smoke is dissolving away it is eroding let's take care of the size with a set size we can make it random in the inspector uniform between 0.2 and 0.4 and then we can also animate the size of this with the set size of our life just make sure that in the inspector you set the composition to multiply so it doesn't overwrite the previous values of the set size now for this curve we want to select this one that goes from 0 to 1 and push the first skill a bit up so it starts with some size and play a little bit with the handles as well ok it's interesting that's something now what else we can do well we can play with the color or we can use a gradient which is super simple we can sample a gradient connect the edge of our lifetime and now we can create whatever gradient we want i'm gonna go with the basic one we don't need these keys up here which control the alpha transparency but since this is opaque it doesn't have transparency so in this case down here i'm going to create the simple gradient goes from white to almost black and connect it to the collar okay very interesting now let's take care of the motion but first let's make the angle of this rotation of this super random with a set angle random in the a option we can say is 316 x y and z and in the b option we can say it's minus 360 in the x y and z spawning the particles with a completely random rotation great the lifetime can be small 0.8 1.2 it depends on how much time you want the smoke to leave so for the motion we can use this set velocity and say 2 for the y 2 for z and in the b 3 for the z that's not bad by the way if you see these bright flashes it's because of the fresno power if you insert negative values this becomes brighter and brighter and positive values will have a black dot in the middle so i'm going to leave this at 0.1 0.05 and now it's all a matter of adjusting values for example let's increase the capacity of this particle system so we can increase the rate as well i'm gonna set it to 32 and this will give the smoke a more consistent look will look a little bit thicker now down here this curve will control the erosion for example if we add the key in the beginning and push it way up here to the value of 1 you will get a very different smoke you will get a more eroded smoke basically so yeah like i said it really depends on your personal taste i'm going to leave it a little bit above 0.2 and to add a little bit more randomness to this what we can do is if we press spacebar we can search for a random number we are going to need two one for the voronoi scale and the other for the varun high speed for example the varnish scale could be something between 2.5 and 3.5 and for the vara noise speed 0.5 and 1 should be enough you may not see the changes at first but they are there and it adds a little bit more randomness to the smoke and lastly if you want you can create several parameters in the backboard so you can control the lifetime the rate for example the direction as well or the velocity of the smoke a gradient the size and so on this will allow you to create several smoke prefabs with the same vfx graph which is basically what i did and made all of these variations as you can see which they are all available my patreon page if you want to support the channel you will get access to many projects and assets that you can use in your games so that's basically it i just want to thank evie patron for supporting me and as usual a special shout out to the top tier patrons which are elac frost bradford errant david crew david mylars direct benson donald thompson edward chai goblin plague josh mccormick jules clane la kim fung maxim mograph tech nat sims itzke ovi sans player mon space official radioactive bullfrog revenant games roger powers stefan stefan zarkov unknown enigma verizuta zarat redding and in good depths your sport is very much appreciated guys you keep this channel going i hope you have enjoyed this video and to everyone watch it please like and subscribe and i hope to see you in the next video thanks bye
Info
Channel: Gabriel Aguiar Prod.
Views: 59,927
Rating: undefined out of 5
Keywords: Unity tutorial, vfx, vfx graph, vfx graph tutorial, unity, visual effect graph, unity visual effect graph, unity vfx graph, unity vfx graph tutorial, visual effect graph tutorial, vfx tutorial, unity visual effect, tutorial, smoke vfx, smoke, cartoon smoke, unity smoke, unity smoke tutorial, stylized smoke, smoke tutorial, unity smoke effect, vfx graph smoke, visual effect graph smoke, shader graph smoke, smoke shader, unity smoke shader, toon smoke, smoke particle system
Id: dPJQuD93-Ks
Channel Id: undefined
Length: 13min 37sec (817 seconds)
Published: Tue Oct 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.