Unity: Bulge, Grow and Deform with Shader Graph!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome back to polytubes in today's lesson we are just going to be doing a conversion of a previous tutorial that i had done so this might look a bit familiar to uh to those of you who are subscribed so previously we had made all of this in the amplify shader editor but a lot of people who want to do this in shadowgraph are just having some issues and the key ingredient here was really just one node called the vertex normal and in amplify this is just one node but shadow graph has its own difference for this maybe in the future it will just be one node but for now this is how you would set that up oh and just before i forget i am using the universal render pipeline here but this will probably work in hdrp too as you can see it is still pretty straightforward we're just adding a position node in object space with a normal vector also in object space but we are multiplying the normal vector before it goes into the add and in this blank space of the multiply node that is where you will put in whatever functions or you know nodes so if i just have a quick demonstration you know if i just plug in just a straight vector one here change the values and it will change the scale of that previous sphere because i'm making it smaller or bigger so this is where you put in all of your stuff where a minus value will make the verts go in and a positive value will make the words come out that's it so if that's all you came for then that is it done you don't need to watch the rest of the tutorial but for everybody else feel free to stick around it's still going to be quite rushed but hopefully still informative so we'll start off with the pipe bulge example and you can see here the four nodes in the top right this is just the vertex normal setup that i was talking about and then all of those other notes plug into it and i'm not going to cover this in any great detail because that's already been done by the previous tutorial but to just give you an idea here the idea was to have a white bar that we could just manually pan up and down and this corresponded with the uvs of our object which would essentially straight so this white bar would go up and down it completely so even if the geometry was bent it would allow this white bar to still follow it because the uvs was straight and we had a couple of controls here for the uh the actual panning so up and down the the width of the bar and then ultimately the power of it i did want to show you what this looked like you know just as a visual demonstration but for some bizarro reason i can't plug this into the emission slot you know whatever shader graph i suppose anyway enough moaning that is it for the pipe bulge now moving on to the flower example this one's pretty much the same logic but there's a couple of additional things going on here we are using an alpha cutoff and we are making it uh actually grow you know so it's coming out from nothing rather than on the pipe example there was the bulge that came out from the mesh at a scale of one whereas we actually want to start with a scale of zero so as you can see here it's just incredibly simple again we're just taking the v channel of our uv coordinates and subtracting it by an amount which gives us this nice vertical gradient and then we're throwing in a saturate node just to clamp it and then multiplying that by a vector one and this is the thing that controls the actual scale of the object so if you have this in a minus value it will pull the mesh in and if you have it in a positive value it will push the mesh out but the alpha is just a one minus of that you know that simple vertical gradient setup and then because we are wanting to use the the alpha clip or cutoff functionality it's my understanding that you have to have a vector one plugged in in order for that to work a little weird but you know shadow graph and then lastly on to the rub example and now the shader for this is actually incredibly simple so we'll cover the non shader stuff first and the general gist of how this is working is it's basically just a camera that is looking down or it's an orthographic camera that is looking down on this mesh and it's only looking at a certain layer and within that layer is a particle system and that particle system is embedded within a sphere and we're using that particle system to push the normals of the rug out so as you can see we have our camera it's looking down we have a render texture and if you don't know how to make one of those if you right click and go to create and have this ridiculously massive menu here but it's there and uh render texture and then you put that into your camera and what that does is it says that whatever the camera is looking at turn it into a texture so pretty cool now i did mention about the camera only looking at a certain layer and that is a layer that i've called deformer and so my particle system is the only thing in that layer so that's the only thing that my camera can see so my camera is only creating a texture basically of this particle system and on the camera itself you want to make sure that it can only see this and nothing else and that it's not looking at the skybox even so it's just a solid color black because if you don't use black as a solid color then you can see what happens here and then if you have you know a value that isn't black it's going to push the boots up because we are using this texture to transform these vertices and as one little last note on your main camera the actual camera you use in game you probably don't want to be looking at the particle system that's doing all of this magic so just make sure in the culling mask you actually set your deformer layer to not be seen by your main camera now if we have a look at the shader itself incredibly simple probably the most simple of the three and yet it you know looks like the most complicated but it's just this texture being multiplied by that vertex normal arrangement and then we do throw in a multiply in between just to control the power anyway that will wrap it up for this i know it was pretty quick probably a little bit haywire misinformation everywhere nothing's greatly explained but but this has all previously been explained in the amplified tutorials where i have them individually at about 10 minutes each so if there's something that you're not quite understanding you know feel free to go and check them out or if you just want the source files for this again it's using the universal render pipeline uh you can hop along to my patreon it's all free you don't have to pay me or anything it's just it's fine it's all there so that is it thank you very much for watching and i will see you in the next one [Music] you
Info
Channel: PolyToots
Views: 41,340
Rating: undefined out of 5
Keywords: unity, game dev, texturing, uv, game art, shaders, amplify shader editor, tutorial, blender, shadergraph
Id: 3T8cKTQrMxk
Channel Id: undefined
Length: 6min 20sec (380 seconds)
Published: Fri Jul 17 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.