How to make a Cloak/Cape in Godot 3.3

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi in this video i want to show how i created this clock by using the shader material and the soft body node from godot so firstly we create a new planing blender and i will rotate it 90 degrees in the edit mode and i move to the right so we can take a better look at it i make sure that the origin aligns with the upper edge and then i move the whole plane up and i scale it down a little bit i try to consider the proportions of the player so i take the lower edge and move it a little bit down and i make sure to reapply the scale to 1 again so i hit ctrl a and reapply the scale back to 1 as you can see here then in edit mode i subdivide the plane a bit for the vertex displacement later and then i take some edges and move them in a way to receive a more cloak-like looking structure and then we create a new material and we will load our image in there which you can find in the video description and then i try to take the outer edges or vertices and i try to encircle the cloak-like texture to get a more convincing looking cloak after and in the end and then i add the uh the separate rpg node and i take the red channel and i move it or i can connect it to the alpha output and to see the result i enable backface culling and i will recalculate the normals by pressing shift n in the edit mode and i also set the blend mode to alpha clip so we can see only the texture we want and then you can just export your cloak as for instance dot obj file to your guru folder in guru in the player character scene we will look for a skeleton and we will add a cool bone attachment there and in my case i will rename it to chest bone and we will add another child node there this will be the soft body node which will be important for the cloth simulation later and there under mesh we will load our created cloak in there and the clock will appear on the bottom that is because we need to assign our bone attachment to a certain bone in my case it's the bone right there in the middle it depends on your armature system and i will select the right bone there in the properties then i will position the cloak in the right place and on the right side in the properties i will make sure to assign the kinematic body of the player at the top to the collision ignore and i set the total mass to 10 this difference to 1 and the damping coefficient to 0.07 then i select my vertices which i want the clock to stick on the player and there under attachments i open them up and i will assign the created chest bone note for every one of them and that will look like this in runtime then we will create our new shader material so we create a new shader it's from shader type spatial of course and we will disable culling and enable the def draw alpha pre-path and then we create our first variable it's the variable pi and then we will create a variable from type vector4 which will contain our color information in the shadow parameters which you can see on the right and i go for instance before we have red right there and then we create three new variables from type sampler2d which will contain our texture information for the cape the normal map and the noise as you can see right there now we will create a void vertex function for the vertex displacement and in there i will create new variables the first one is the scale qv variable and we take our uv there and we will multiply it by 0.5 and for the noise variable we will load our noise texture in there and we use the scale uv and add it with a vector tool that's pointing in the x direction and as we can see here the speed variable doesn't exist yet so we will create the variable speed and in my case i will set the speed to 0.25 the next variable will be our displacement variable and it will be from type float and what we what will we do here is we will take our noise texture and we will multiply it by two and subtract it by one and what this does is it transforms the values from 0 to 1 to -1 to 1 and we will multiply by the strength i made a spelling mistake there but that is not important and i will set the strength variable to 0.1 and i want the whole displacement be dependent on the position on the uv dot y so i take the displacement and i will multiply it by the uv in the y direction and that is basically everything for the vertex shape function so we take our vertex and we will assign it to a vector 3 and for the y component we don't want to have any movement at all so i will only assign the displacement to the x and z component and i set the c component negative as you can see in the code and the last thing we need to do is to load our noise texture so we go to the parameters and we create a new noise texture i enable seamless and i set the resolution to 128 and i create a new open simplex noise and set the preview to 32 and the persistence to zero and that is how our noise looks and we currently see nothing that is because i forgot to add the plus in line 25 and now we can see a subtle vertex displacement and in real time it looks like this if we take a look at the game and it's very subtle but if we add the texture later you can you will see the displacement a bit more so to load our textures in there we will create a fragment function and in the fragment function we will firstly create a variable from type vector4 and i will name it cape and we will assign our texture our cap texture there and uv and now if we and now we want to see the texture on the screen so we take over a better output and we will assign the cape with the red green and blue channels and then you will see the type texture appear if we load our texture in there of course and of course we want to colorize our texture so i will multiply it with our colors and now we have a red color but i will change the color to a more brownish one and we do the same thing to our alpha output but instead of the color channels we will use our alpha channel for this one and then the cap will look like this and in the last step we will take our normal map output and we will load our normal map texture in there and you and for the vector 2 we take the uv and of course we will need to load our normal texture in the shader parameters of course and in real time the clock will look like this and you are basically finished there but i want to add two more things for publishing purposes so firstly a toon shader which was made by captain proton 42 and from the 2 shadow we will take the staircase to split diffuse and this split specular functions and the most important function the void light function and i will put everything in the description that was made by him and also his twitter account if you are interested in learning more about stuff that he does and i will also load the corresponding pro and variables for the light function in there as well and under the shader parameters i will set the cuts to four head to knee as then turn the attenuation and the rim off and set the specular strength to 0.01 and i will lighten the color a little bit and then you have effect like this and if i for instance move in this direction you can see the reflective surface of the cloak which gives it a look in my opinion so the last thing i want to add is a static body to prevent clipping with the cloak and the body from the player so i will create a new bone attachment and i name it hip bone and i will create a static body as a child and a collision shape as another child and we will create a sphere shape and set the pip bone to the hip bone in the armature system and then i select the collision shape and i will scale it down a little bit i go with value about 0.2 or 0.3 it depends on your player character and i will position the static body in the right place and if we play the scene now you will see that the player does weird things that is because we need to set our collision layers right so we will set the collision layer of the static body to the second layer and we will enable the second collision layer also to the soft body node and then everything works fine in the scene and that is basically everything for this um tutorial i also wanted to emphasize my gratitude to firstly captain proton42 who created a light shader and i will put the link in the description for his flexible tomb shader where i got this knowledge from and i will also put her social media links in the description as well and sadly a big thanks to voitech who let me use the testing area which you have seen in the background and where the player was walking in and thanks for that as well and i will link his youtube channel in the description as well and i hope this tutorial is okay if you're interested in other tutorials or have any requests for tutorials feel free to ask and i will try to upload the shader on godotshellers.com as well in a couple of days nonetheless um have a good day and take care goodbye
Info
Channel: Kmitt
Views: 15,252
Rating: undefined out of 5
Keywords: Godot, Godot 3.3, Blender, Shader, Cloth Simulation, Tutorial, GameDev, Toon Shader, Cloak, Cape
Id: H3fQbefqsu8
Channel Id: undefined
Length: 12min 41sec (761 seconds)
Published: Sun May 09 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.