Unity Shader Graph: Crystals!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello and welcome back politics we're gonna be doing crystals today because at least one person has asked for it but he's asked twice so I think I think that counts for more although this isn't the first time that I've been asked to do some sort of shade of magic to make nice-looking crystals and the first thing that kind of crosses my mind is is you don't need a fancy shader to make nice-looking crystals in fact often times you need just the most primitive shader that you can imagine so we're gonna run through some examples some as one that isn't here which which I'll just create as I kind of go along but to kind of kick it off obviously kind of depending on the style that you're going for the the first example I have here is just a self lit so this isn't a shader that I've had to make it's just a standard material I am using the HDR P but regardless of whatever you're using even like the like the non preview stuff this is just a self lit material in fact it wouldn't even need the emission I just have that in there because because I had already painted it so that is that is there at least so all that's doing is just this little kind of glow in here the actual material itself won't be affected by lighting it's just you know is what it is pretty standard stuff so then moving on this is also not a shader this is just a standard material and all I've done is I've just used metallic and smoothness and I've just ramped those up to one and oftentimes for a lot of stuff this is kind of old you need to do you don't even need an albedo or a normal map and I can prove that now if I just duplicate this crystal by the way I will be providing this crystal and all all of the textures I don't know why you probably don't need it but you maybe it's a thank you for the 1000 subscribers so yeah you can have that do what you want sell it somewhere I don't mind yes so Christoph I said it I'm just going to basically because this was a sculpted model that I've normal mapped I bring this in yes because it's a sculpt and a baked and it relies on normal maps for all of the the sort of normal information the smoothing groups of this are all set to one so we're going to just undo that from angle okay so probably normal calculate okay so there we go so this is what the model would look like if it was completely sort of unsmooth and from here you can actually just imagine most people watching this is skipping past this point because this is pretty basic so let's just stick this guy on there I think this is actually made up of a few parts which is annoying so we'll just make him red and just crank up that metallic and that smoothness maybe brings smoothness a little bit down but there you go I mean there you are that's a convincing crystal in any game yes oh that's just there as an example and I'm just showing you that mine is actually normal mapped with the texture which you know it it's nicer but it's not it's not required so you're moving on a bit we're now actually going to start to get into the the actual things you might want to do with a shader and the first one many of you may recognize the effect it's a simple fernell I just edit shader take a look at this so just to kind of make things completely sort of transparent there's my albedo my normals and then this is basically everything that I'm doing with my emission this is my actual emissive texture which I don't know if it's confusing or not I'll actually just show you it so it's just that's without context so this is the albedo of the crystal which has been lovingly hand-painted so then that's the emission so it's basically I've just created some light areas sort of down in the crevices sort of crevices I don't know how you would say that I don't think anybody would actually say crevasse oh well so yeah that's that's all that emission is doing and then I am just adding on while multiplying on a true nail effect at the end and I have a property here just to control its size and then after I add that through my texture which again is optional I have another multiply just to control its strength here with this vector one property and then lastly I multiply again just with a color property just so I can actually change the color of the four nail itself so if I just grab this you know I can change I can change this to whatever I want it's actually really nice well okay so let's suppose that down don't need that next up we have pretty much the same thing just the inverse and I've also got a little animation going on because oftentimes in games you know you'll have some sort of power crystal thing and it will glow because that's what magical crystals do you know so let's just have a look at this and let's just zoom in on this guy here see what's going on so pretty much the same as before with the albedo and there's my normal oh I probably should have mentioned this before I don't I do have a metallic texture but it's just it's kind of redundant there's actually no need for it to exists because you can just control whatever you want with a slider unless you have a particularly mucky or a dirty crystal or something where you actually need to mask out some of the roughness and whatnot with the texture but anyway anyway so yeah all this is is it's the exact same as the previous one the only difference is I've introduced a one - so it's just flipped the fernell effect around so it now it shines from the center outwards rather than the edges inward and for the actual sort of glow here it's just assigned time which I immediately clamp and then that's just multiplied by everything else so it's actually it's just kind of this basically which I just add on to everything else you could as opposed if I were to do something like this get rid of that you can create this effect so it's a lot more obvious I'll actually add this on to the whole thing because before this glow animation it was only applying to my emissive texture but if you wanted it to kind of apply to the whole thing then you can just introduce this this time at the end and so yeah now it will actually do everything and the reason I have the clamp is because I don't want the the sign to go below zero because it will go up to 1 and then 2 minus 1 and then up to 1 again and I want to stop it from doing that so that's why I have to climb if you don't have the clamp I'll show you kind of what happens here so I'll just save that and then edit the video because this takes 5 minutes actually wait wait scratch that I think actually all that will do is basically the same as what we're seeing now if I take this back to where it was all this is just to show you what happens if you don't use the clamp it's just I don't think it would work if I put it at the end so I'm gonna add it to just my emissive texture so let's actually save that and remember this is not with the clamp okay so there you see it's basically creating like the inverse of the emission because it's going you know from from from 1 to minus 1 although it actually kind of looks okay but you know whatever you want to do so let's just I'm gonna just put this back where it was at the end you okay there we go so if you wanted to you know this isn't really related to crystals at all at this point but if you've ever used like a sign time to try and pulse some sort of emission that's usually where you you would find something like this I mean not to say that there aren't any other uses for it but it's a common one you might have run into the issue where you can't increase the speed because it doesn't act like a normal sort of timeline where you just multiply it by a vector because that just increases the speed at which it kind of fades in and out but it doesn't actually change anything to the entirety of it in fact if I were to just prove that to you come on now so if we multiply this get that on a vector one and I'll just give this like quite a high value ten or something and so we'll feed that through and then we'll save this okay so now you can see that the actual like the overall duration hasn't changed it's just as it fades in and out is a lot more snappier so if you wanted to actually create some sort of property that controlled the the pulse speed of something like this then actually what we'll do is we'll keep the time node but we will actually get a sine node and what you want to do is let's just reuse this multiply and the vector so we'll have time multiplied by a vector so this is your standard kind of speed setup so you know didn't want to convert a subgraph convert the property and we'll just call this pulse speed and that's what you kind of hook through the sign so if I default that to one yeah still go through the clamp that should be fine so we'll save this so now if we actually grab our material we can get the full speed crank it up to ten or something so now it will actually pulse and if you wanted to get like a little crazy what you can actually do is you can get a random range and we can introduce the I think it's the time and then zero is say zero to three and then stick that into your sign let's save that okay so there you go and this is essentially how you do flickering lights and not a crystal so I don't know why I am showing you that but I just I think it's cool I'm sorry let's get rid of this let's get rid of that and let's actually move on to the other one and let's take that down before it gives me epilepsy okay so this last one this is probably the more complicated one there the idea behind this one is to actually try and create a bit of a parallax and I mean a bit like I use like one step of a parallax because for crystals it's quite nice because it just makes it look like there is sort of something inside but there's no need to kind of do a whole lot more you can if you want have multiple iterations of the other parallax it's entirely up to you but I think after a certain point it probably just ends up looking a bit like ice and I guess between crystals and ices you know there's not that much of a difference but if it's not too obvious is the what's sort of happening here would like that cloudy thing in there I have a different one here yeah the idea is it just sort of looks a bit like there is something inside and I can control it sort of strength as well and if I didn't want it to be so in-your-face the yeah the the actual map that I've ended up using is just like a standard clouds render from Photoshop it's kind of it's kind of a nice effect and it gives like an overall like a more kind of realistic tone I find to the crystal like out of all of these even though you know these ones do have the metalness and these smoothness they still you know they they don't look I think as convincing is this crystal over here yes so now let's take a look at the shader on that one edit shader yeah so again there's my albedo my normals and my emission and for this one the actual dislike one layer of parallax I am just adding that onto my albedo you can add it onto the emission instead you know it's entirely up to you you can you can do whatever you want yeah it's pretty pretty simple start with the the actual texture like property that I want to use for my parallax effect and then it's basically just a few direction which you set the tangent multiply that by a property which is actually the offset amount which I don't know if I showed you or not but so if I set this back to say zero then it will actually it won't look like there's anything inside anymore it will almost be like it's like it's it's it's actually on the surface because it has no offset and if you start to actually offset it a bit it starts to actually look like it's kind of going inside the mesh that you have which is pretty cool so yeah that's that's what you would multiply that with that property then you just plug those three into a tiling an offset node obviously we're going to offset because that's what we're controlling and offset and that goes into the UVs of the texture that you want and then all I do is I could have just straight added it to the albedo but I did just run it through a multiply at the end just to control its strength so I can you know make it stand out more or not and you might have noticed that I am just using the red channel only because my intention was to only use a grayscale image but I suppose in theory there's no reason that you couldn't actually use full RGB color so yeah that's I think I mean that's pretty much it if you do want to learn how to do multiple sort of iterations or levels of parallax I recommend checking out a youtube channel by the name of binary impact because he has a great cracked ice tutorial that kind of goes through I think it's about sort of like ten iterations of a parallax effect and he also will show you how to to convert things into sub graphs which is which is that thing that I almost accidentally did but I don't want to do it's essentially you know condensing things down so that you don't have to have loads of these nodes all over the place so you can just have them all it's kind of one in fact I could probably just do I don't want to graph that one you don't want to include your properties at all but so if I were to grab this for example and convert that to a sub graph and that will just basically turn that into a single node so pretty cool pretty cool stuff yeah so check out binary impact and for me I think that about wraps it up say yeah so to the one guy that asked me twice to make a crystal shader tutorial I hope this kind of fits the bill so yeah there are crystals thank you very much for watching I will see you in the next one [Music] you
Info
Channel: PolyToots
Views: 75,409
Rating: undefined out of 5
Keywords: unity, game dev, game art, shaders, tutorial, shadergraph, shader, graph, crystals, low poly, free model, download, PBR
Id: WdxBJVCBr_A
Channel Id: undefined
Length: 16min 47sec (1007 seconds)
Published: Wed Mar 27 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.