Unity Shader Graph - Clouds Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so what is going on guys welcome back to gabriella gabra today we are going to see a very simple cloud shader that you can do in 10-15 minutes in unity with a pretty good result and since many people have asked here we go we are going to see a cloud shader today just when i say that these videos are possible thanks to my patrons by supporting me you get a lot of assets for your games visual effects shaders that you can use in all of your projects so without further ado let's jump right into it and let's see how to make these clouds so we are going to need two very simple things a plane with a lot of divisions which we are going to a little bit later and then the cloud shader and by the way i'm using the udt version 2020.3.14 with the universal render pipeline and in the package manager i have shadowgraph installed we are going to need it so in my scene i have some simple mountains and a plane for the ground and we are basically going to create something similar to this which are transparent they have holes and as you can see if you get closer they have kind of a thickness basically they aren't flat and we are also going to see how we can do it and this is a plane that i've made in blender i'm also going to show you how you can do it but for now we can start with a plane so with right click in your scene you can go to 3d object and create a plane we want to reset this transform so it goes to the origin of the world and we basically want to push this up until it's above well in this case the mountains and then i'm gonna scale this up really a lot something like 17 x 1 and y and 17 z until it covers a nice area of your sky basically if we go below it we don't see it but we are going to fix it in a moment that's shader related i just want to mention that in lighting i'm also using fog you can find lighting options in window and rendering as well as a global volume basically some post processing effects which you can create with right click by the way okay so let's go ahead and start with the shader with right click in the folder we can go to create and then in shader we can select blank shader graph i'm going to name it cloud shader tooth and double click to open it up i'm gonna drag this into two more or less around here and then we can already create a material out of this shader with right click select material we can assign this material by the way to the plane we just created simply drag and drop it okay looking good so it's purple that's normal because we don't have any active targets in this case in the graph inspector inside the shader we want to add universal as the active targets and if you save this asset as you can see now it goes back to its original color but we cannot see whenever we go below it and that's because two-sided is turned off if we turn it on and save it now we can see from both sides basically this shader now renders the two sides of a face of any object okay so how do we start this well we start by pressing space bar and if you go to procedural we got three noise options the simple noise is the one that looks better basically because we basically need a texture for this and these are procedural textures procedural noises this simple noise it has a scale option which is useful to control the scale of the clouds so we can create a float so you can control it in the inspector and call it cloud scale if we select this property we can set the default value to 120 for example and connect it to scale right here and connect the simple noise to the base color if you save it you will see the noise applied to the plane as you can see it's a start as you can see it kind of looks like clouds but it's very static we need to animate it we need to add motion the way we do it is with a tiling and offset node if you connect it to the uv of the simple noise and play with this offset option as you can see it scrolls basically the simple noise so we need to animate this offset we do it with a time node which is always counting and if we multiply it for example with a vector 2 call it cloud speed let's drag it here let's create the time node if we multiply these two together and connect to the offset it will animate the noise texture we just need to select the plane and in the inspector now increase the y of the cloud speed for example to a small value like 0.005 and as you can see now it's moving you can obviously try different values lower values works best because it's clouds and they don't move that much now we also need a way to control the density of the clouds and there's a very simple node that can do it which is a power node you connect it like this as you can see if we increase the b option we are starting to see less noise so let's create a float for that and call it cloud's power default value of one connect it to the power and now what we can also do before testing this out is add a color properties so we can control the color and the intensity it's very important that you set the mode to hdr to control the intensity you can then select a white color and increase the alpha to 100 this color property we only need to multiply it with the last node the power node and replace the connection to the base color and that's it if we save it nothing changes because we need to play with these values a little bit so if we go to the color of the clouds select a blueish color something like this and then play a little bit with the intensity we get a different feeling then with the clouds power it may not seem like it but we are decreasing the density of the clouds and it may not seem like it because we don't have transparency so let's go back to our shader and let's drag a line from the power create a multiply node and create a float for cloud's alpha in other words the cloud's transparency one for the default value but this shader is set to opaque we don't have an alpha input so in the graph settings the surface instead of a pack we can set it to transparent down here now we have a alpha input and we can connect this multiply if we save the shader now most of the clouds disappear any value that is darker there is black it's transparent so that's when cloud's power become useful we can decrease it as you can see we get a nice white cloud that's very interesting already it's something you can then make it less transparent or even more dense even more opaque by increasing or decreasing alpha as you can see you have to find a nice balance between these two values i'm going to leave it at 1.4 for the power and 1.5 1.6 for the alpha more or less another thing we can do for this simple cloud shader if you look closely we have always the same pattern we can follow the pattern we need to add a little bit of distortion to this clouds form and dissolve themselves they don't stay always the same the way we can simulate that is you can push these nodes back here press ctrl c and then ctrl v because we are going to need the same setup we need basically another simple noise scrolling in a different direction so let's remove this cloud scale and call it distort scale in a new float default value of 60. and a new vector 2 for the distort speed and replace the connection here now all we need is to multiply these two together and replace the connection to the power node if we save it nothing seems to change because the start speed is at zero but if we start increasing it especially if it's faster a little bit faster not that much let me just decrease a little bit the cloud's power increase the alpha okay if you look closely you'll notice that they are kind of forming and dissolving it adds a nice touch small speed values will work a little bit better in this case okay so that's looking very interesting as you can see and shadow is pretty much done at least in the aspect terms now if we want to add a little bit of thickness we are going to need a new plane with a lot of subdivisions basically with a lot of faces and triangles you just need to use blender and in the default scene you can press a to select everything and delete it and with shift a we can add a plane this plane if we go to the modifiers this button we can add a subdivision surface modifier we want it to be in simple mode if we press z to see true so we can see the faces nothing much is happening because we need to turn off optimal display now as you can see we already have a cross in the middle which means it's divided in four parts we want much more faces so let's increase the levels view part to the maximum which is six obviously this will affect the performance in case it's for mobiles you can apply the changes now and then divide once again only one time just like this is more than enough we can add a little bit of curvature to this we can for example enter an edit mode with tab and select everything with a select only this vertex in the middle and then press o or go up here and turn it on which is proportional editing this will influence the vertex around you can scroll up and down to increase the influence and then press g and z to lock it into z and push it a little bit up something like this as you can see we have a nice curvature okay so we have this concave plane and now we can simply save this blender file direct to unity in my case i saved it to the modules folder which is a folder i have created and now we can drag and drop it to our scene it's very small i'm going to press f to focus on the plane and increase the x and y to 250 and the z in this case to 250 as well let me just remove the other plane and then assign the material with the clouds the one we created as you can see it looks very nice the cool thing now is that with the z we can control the wobble basically the curvature of this plane i'm gonna leave it at 350 in my case because i want this to be a little bit round so that was the first step now the second step is we need to go back to the shader as you can and you should obviously adjust the values a little bit once you go back to the shader we want to play with this vertex position inputs that we have here and it's very simple we want to pick the normal vector of each vertex we can search for normal vector the node and set it to object object means that it's the vertices of this mesh you can multiply this with the output of the power node and then multiply this with a float colored vertex of set for example we are going to add this information of the normal vector that we modify it to the position of each vertice we can do it by searching for a position node and set the space to object which is each vertex and then we can connect this to the position input of the vertex function of our shader if we save these assets and go to the inspector now something awesome will happen whenever we increase a little bit let me just make this less brighter and now whenever we increase the vertex of set small values like 0.05 0.1 for example click closer now to the clouds as you can see they are kind of volumetric and that adds a really nice touch especially if in your game the player gets closer to the clouds just look at this it's awesome i'm going to decrease a little bit the fog to 0.01 and that's looking very interesting the only thing missing is that if you want to add holes to this basically if you want to see some shadows on the ground we need to go to the graph inspector in our shader and turn on alpha clip and we simply need to create a float call it alpha clip for example and connect to this input right here the alpha clip threshold save the asset and now if you increase that property the alpha clip you will start to see some holes in your clouds as you can see and this can be quite awesome depending on your art style obviously but it's an extra step it's something extra that you can add to your clouds and make them look a little bit better you then obviously need to play with all of these values adjust them until you find a nice bullet something you like but that's pretty much it guys this project is available my patreon page and many many other projects in case you want to support me that will be awesome and very much appreciated i have links below and it's so well appreciated that i want to say a big thank to each patron all of you matter a lot to me and as usual a special shout out to the top tier patrons which are al ella frost alex burke jones irie koftiken bradford aaron david crew david maid lars diana simonian donald thompson electric brain game go go joe goblin plaque hostile mars game john denis paul jeremy martin josh mccormick jules klein lyannos maxim madaf gupta matthew chatter mikhail tello mograph tech nazims its ovi sans radioactive wolf rock revenant games ricardo cruz tyler fritz unknown enigma very soother and in good does thank you so much for your support you keep the channel alive so i can keep on making these videos to everyone watching this video i hope you have enjoyed this simple cloud shader so thanks for watching and i hope to see you in the next video thanks bye
Info
Channel: Gabriel Aguiar Prod.
Views: 46,969
Rating: undefined out of 5
Keywords: Unity tutorial, unity effects, game effect tutorial, unity magic effects, unity particle effects, unity particle tutorial, unity game effect, unity vfx, vfx, tutorial, unity particles, unity, unity graph, shader graph, unity shader, shader, unity shader graph, shader graph tutorial, unity cloud shader, unity clouds, shader graph clouds, clouds shader, clouds, shader graph cloud, shader graph sky, unity cloud, unity shader graph tutorial, shader graph clouds tutorial, cloud, fx
Id: xxhvUyvIH6s
Channel Id: undefined
Length: 16min 59sec (1019 seconds)
Published: Tue Jul 27 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.