Unity Bulge Deformation Shader with Amplify.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and what about politics in today's lesson we are gonna be taking a look at some vertex deformation examples and in this video we're only going to be focusing on the one on the left the pipes one and we'll cover the other ones in some other videos because I don't want this being too long but hopefully they should just be three short videos so for the example of the pipe one the goal is basically just to have something deform along it regardless of the direction of the mesh and it's all based on UVs so just a quick look in blender at the UVs of this object starting with this straight pipe because it's the most simple you can imagine a white line moving you know up and down this UV sheet it would correspond to the mesh you know in the same way because the UV the straight the object is straight everything's fine and so it's even the same on this other mesh it's basically just the straight pipe but I've just put a bend modifier on it and you know the mesh itself is bent but the UVs are still straight and you can take this even further with many different examples of course you can have this whole squiggly thing the UVs for this aren't strictly straight per se but they're straight enough okay so back into unity I've wiped everything we only have the mesh and we just create a new amplified shader and just you know call this whatever you want and we'll start off by placing down a UV coordinate just by hitting the U key and clicking or you can search for these things and if you see it has a letter next to it that means it's a like a hot key so you press a letter and click like subtract it's just s and click so we'll connect these together so I'm going to subtract the V from the B slot and the subtract and we'll create a float here and this will basically be the start of our gradient that's why we're only going with the V part of our UV coordinates because we only want the the vertical so we'll call this whatever I'll turn it into a slider zero to one range should be fine and then we'll put down another multiply which again is just the M key and click and then another float which is just a one key and click this one will be the width which won't make any sense right now but if we multiply this by itself so just put in another multiply and put them in both of those slots the width will make a bit more sense now because if we take a look at the example of the multiply on the right we have our white levels on the top and the bottom now rather than just on the bottom and you can see that the width actually adjusts the width the problem is this is inverted so we need a 1 minus because we need to have a white bar because white will basically dictate you know what where we want something to happen you know white is often like true black is false white will push out a displacement black will pull it in you know that kind of logic and then lastly we'll just multiply all of that again with another float this time order to be the the strength or the power so once you have that bar you can just determine you know how how strong it is you can see we have the scroller like the actual panel moving up and down we have width control and then we have power so well pretty good now we can actually just throw this in the emission slot just to see what it looks like on the mesh before we proceed oh and also make sure that these are all properties looks like I was missing two this essentially just ensures that it's visible in the material rather than hidden away within the shader so after you put this material and the shader on your object you can see how it works and so far pretty good because we have the area that we want to affect the mesh but if you notice our zero to one range on the panel even at 0 and at 1 we can still see a bit of the white coming out so this will you know this will affect the mesh later on as well so ideally you know we should change this so that we can have like a full black mesh at the 0 and the 1 so you can see here just as an example of that you know it's not ever going above the top and it's not ever going below the bottom so that's what we need to fix the simplest way to do this is to actually just change the range of our slider so we can go in at - 0.5 and a maximum of 1.5 and so now you can see that it actually goes outside and this is all well and good but if you did want to have a 0 to 1 range still you can use something called a remap and this will basically allow you to have your original slider as a zero to one but you just put in some numbers to say what the old one and the new one will be so the old one is going to be a zero to one range because that's what we want our slider to be and the new range will be the actual values that we want which is the minus 0.5 and a 1.5 just make sure you remember to go back to your original slider and change that back to a zero to one because you know that's what you want to appear on the material and so just to needlessly drive this point home again you can see here our panel range goes from a zero to one but the actual white area that we have is going outside the bounds because it is going to minus 0.5 or 1.5 so that's done we are finished with that bit back into the shader I'm just gonna throw down a quick color here just so you know I have something a bit more interesting to look at obviously on your side I'm sure you'd be doing whatever textures and things that you want doesn't matter but the actual vertex deformation we just get down a vertex normal node and then we'll multiply that by the result that we already have and we also want to put in a saturate node and I'm using the Alt key here to click and drag over the line so it automatically creates the connection pretty handy we want this to go into the local vertex offset make sure it's not the normal let's go have a look at what this does as you can see the Bulge you know the vertex normal offset it's it's working fine we do have an issue with the emission and then it's being burnt out I'll probably just throw the saturate into that as well that will fix it but for you the emission is you know it's completely optional you can if you want use that whole system as a way to mask so a new texture or a new color where something is bulging out of these pipes or whatever mesh you want to put this on it's completely up to you you can completely forego it entirely like you don't need that in the emission slot or multiplied with albedo or whatever you want the important thing in the tutorial at least is the vertex deformation part which is you know just the vertex normal multiplied by that whole thing that's it I leave the rest entirely up to you you know it's out of my hands so that will pretty much wraps it up for this shader obviously you can do a lot more with it maybe we'll cover some extra stuff in the future but for now this is just like the the basics of you know pushing out along vertex normals I will just throw in some quick metallic and smoothness just because it looks nice and you know it's supposed to be kind of like a pipe and pipes are kind of metal although nowadays I guess most plastic so I guess it depends where you're using the pipes for right let's not get all pedantic about that but that will do it for this video I thank you very much for watching I hope you learnt something we will cover more stuff in the next video I think the next one will probably be the flower one and then we'll move on to the rug example from the beginning of the video or I'll have something on screen that you can look at now and just to let you know I do have a patron that's now open mostly because a lot of people keep asking me for you know screenshots of the node set up so they don't have to keep watching the video again to you know the cross reference their own notes and so that's all freely available on my patreon you don't have to pay I would appreciate it you know if there's anyone out there that is willing to support me but it's completely optional I'm not asking for your money at all I'm just letting you know that patreon is where I'm just hosting all this stuff because it's a lot easier than YouTube descriptions so yeah that's that that's my cheap filthy plug and I will leave it there so again thank you very much for watching I hope this has been of use I will see you in the next one [Music]
Info
Channel: PolyToots
Views: 12,132
Rating: undefined out of 5
Keywords: 3d coat, unity, sculpting, game dev, texturing, baking, unwrap, uv, game art, shaders, amplify shader editor, tutorial, blender
Id: Ol456nXt8Lo
Channel Id: undefined
Length: 8min 31sec (511 seconds)
Published: Mon Jun 29 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.