The METAL Tutorial (procedural, but not as cool as it sounds)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
have you ever wanted to make a metal material but just had no idea where to begin well you know i was in the same spot a couple minutes ago i tinkered around created a material now i'm going to take the knowledge that i learned and pass it on to you which some people define as the very word teaching so yeah today i'm going to show you how to make a completely procedural metal material renders very quickly of course i do have a fast computer but compared to some other materials that use quite a few notes this one doesn't use that many and even these node groups they don't use that much it's just a bit of vector math and a bit of float math and stuff like that and if this is one of your first uh you know node based tutorials and you haven't touched procedural that much um this would be an okay place to start wouldn't be the best but uh it would be okay so um let's make this i think it's called diamond plate metal is it because these things look like little diamond designs or is it because it's as hard as diamond no idea uh let me show you how to make this thing so i already have a base project set up uh just so i don't waste your time uh here's basically what's up we got a sphere no lighting the lighting is all hdri based so i have some hdri set up from hdri haven um super simple setup right sphere hdri cycles here cycles gpu and stuff like that and i think that means we're now ready to create this material so whenever creating a material and you saw before is wrapped along the sphere and the plane in other words it's all uv coordinate based it's better to start off working off a plane and not a sphere because the sphere has you know spherical geometry there's distortion that we don't want to think about until the very end so what i'm going to do is i'm going to create a plane this is where we're going to prototype our material uh we can put this material right here called metal or even metal patreon because by the way this material when we're done is going to be available on the patreon just the blend whatever that exists and make sure that both of these have that same material so that when we change the color it's affecting both of these so again we're looking here but whatever we do here will also affect the sphere okay no bsdf that's a bit too complicated for now we're gonna start off with texture coordinates and manipulating them uh until we get the pattern design of the diamonds which one do you think about it it's just a bunch of ovals uh in kind of a checkerboard texture right uh to do this texture coordinate node we care about uv coordinates of course you could use object coordinates generated coordinates but uh uv coordinates make sense because they wrap around any object that you give it given uh that there are uv coordinates so maybe just maybe i would recommend using uv coordinates uh what we're going to do is we are going to start off by making a single diamond and then making a checkerboard version of that so to make the diamond here is a simple trick i'm going to start off by adding in a vector math notes again uv coordinates are vector quantities they have x y and z although z is suppressed to zero since u v has only you know two axis whatever um we take this and we filter it through length again we take coordinate values and just output the magnitude of those vectors their length their distance whatever you want to call them i mean you can see right now we kind of have a radial not a spherical but a radial gradient starting at the corner because again uv coordinates start right here in the corner at zero zero so the length is zero and then as we go radially outwards it's gonna get brighter and brighter and brighter um okay why is this useful well it's useful because if we manipulate this just a bit so i'm gonna add in an addition and then shift it down until it's like right in the middle so if we want it to be in the middle that's going to be 0.5.5 on the negative direction because you know plane is one by one and you know you might think you want to add 0.5.5 but you need to think about the inverse operation right we take 0.5.5 which is what this was originally subtract this and then it's going to become the new origin 0 0. point is this is a great way to make a circle which means it's a good way to make the ellipse the diamond whatever okay so what we want to do is now we've filtered all this vector stuff into float stuff so now it's just a single gradient kind of situation let's save what we want to do with this is just do a bit of simple math so i'm just going to subtract kind of the other way around and what this is going to do is it's just gonna make it so that you know we get more of a easy to see circular gradient so again uh before we add this and we're just taking take that 0.5 subtract that away okay and the nice thing about this is we can always change this procedurally uh one thing to note is you might think this is a circle and the black is just the abyss you know there's nothing there that's not true in fact the black values have some negative stuff going on that is mapped to the color black even though there is information down here so if i set this to greater than and then we viewed it okay so you can see the circle but then even as we go negative you can see this is still expanding right there's a negative information so if we clamp this you can see that's no longer the case so once we go below zero it just gives us the entire plane uh but we're not going to clamp yet so we have this basic situation and we should also normalize it because it seems like you know the bigger or the smaller the circle is kind of the more uh the gradients affected normalization is easy you divide and make sure that it's the same number so if we subtract by this we divide by that okay and now we have a single controller that gives us a nice circular gradient cool don't worry about too much too much about what this means mathematically just kind of know these tricks because these are the tools that are going to be in your arsenal in the future okay so now we have a single slider for this which we don't want to bring below zero or weird stuff happens okay cool to make this more of an ellipse or a diamond all we need to do is kind of stretch this out vertically right if we stretch it out vertically we've taken our circle and kind of made it i mean technically it's not an ellipse i don't think i think it's literally just a stretched out circle mathematically they're not the same bunt visually they are so what we're going to do is we're going to add in right here simple trick we're going to set this to multiply by 1 1 1 which means do nothing right because we're multiplying x y and z by 1 which is the identity but if before we do this length calculation which again gives us this radial gradient if before we do that uh we do some stretching on let's say the y-axis like this and again it's the opposite of what you think if you want stretching um that goes bigger than one you have to go below one even though you think you'd want like two to make it twice as big makes it half as big right it's always an inverse relationship the same way there's negatives here i'm just going to stretch this and you can also stretch on the x-axis for thinness but that should be our general diamond shape and you could uh dive in here with rgb curves and make it not an ellipse but this like pointy thing that looks more accurate but we don't have time for that we just got to keep moving on but there technically you could do that and it would be valid okay cool so i'm just going to clamp it at the end here for the getting rid of the negative reason so now that we have our basic diamond name of the game is taking this node group and basically uh using it again and again and again to make the checkerboard procedurally like we can choose how many of these ellipses we want to do this what i'm going to do and this is kind of a very very important trick it's classic uh what you want to do is you want to hit scale so right now we're sending this through scale before it reaches any of this so i want you to think of this as its own like thing right so this is already a calculation we did uh what we're going to do is we are going to scale which is going to make it look like it's just getting smaller into the corner because we're scaling towards the origin which is in the bottom left corner since we haven't shifted it yet shifted it yet um you know that's a thing however what's actually going on here is again we have uv coordinates that go from zero to one on x and y but now we've gone from zero to five on x and y because we've scaled we've multiplied in some sense by five okay if we take this that is going from zero to five if we take this and then do a bit of a rounding so instead of going from zero to five we say go from zero to one and then when it goes from one to two say again zero to one zero to one zero to one just keep repeating it five times um on both x and y that's going to be exactly a tiling so what i'm saying is take this we're gonna instead of a scale this time we're gonna throw in a fraction and you can see this gives us five uh tiles and we can control this procedurally four by four three by three whatever it may be again the reason this works uh zero to in this case four and we're fractioning we're taking off the integer so everything after the decimal place is preserved it goes zero to one zero to one zero to one zero to one okay we take this we plug it in here into our like calculation we already did again only on the top socket uh what it's going to output is again the same design but now a arbitrary because we can you know pick this number arbitrarily a number of times okay cool now we just need to do a tiny bit of a manipulation and then we're actually going to be very close to done first thing i want to do is a bit of a rotation so vector rotate does that by i think it should be 45 degrees but you're seeing that again it's rotating from the wrong area because even though we've scaled it by five now each of them in some sense has an origin in the bottom left we still need to correct for that we can either do that with some vector math or the rotation center should be in the middle of the tile which again 0.5.5 and z doesn't matter and i think it should be positive 0.5 like that um so now when we rotate it you can see it's actually going around the center of the ellipse 45 degrees is halfway between vertical and horizontal so that's what we want okay important thing to emphasize we can again change the number of tiles you already know this but at any point we can change the shape of these and it's going to affect all of them at the same time which might be something you want to make a parameter later down the road but for now let's not worry about that what we do want to worry about is this isn't really the correct pattern because let me just go back to the original just for a moment what it's supposed to look like in my research is you have kind of like a cross hatching some of them are going uh vertical or i guess some of them are rotated 45 degrees some of them negative 45 degrees in this kind of lattice checkerboard kind of situation that's what we want to do and i guess what you could do there's kind of whoops i opened up the wrong one file and look at that we're done with the tutorial let's go back to the original um what you could do is a and this is kind of like probably the cleaner but more complicated version you could either multiply or i guess use an angle of 45 or negative 45 depending on the tile and there might be a bit of complicated math that's involved there like you need to see which tiles is it's is it going to be kind of like an even odd kind of situation this would be the clean way to do it so that's what i would recommend but in the interest of making it understandable we're going to use kind of the more brute force doesn't make much sense but whatever it works kind of version where we duplicate this we're then going to use this node group again so i'm just going to use uv coordinates again nothing has changed between this top version and this bottom version they're literally identical but with this bottom version we go minus 45. so these are faced the other way and these are faced this way again this is more computationally expensive not by a lot it doesn't matter but ideally you kind of throw it all in here okay so what do we have so far if we take this and let's do a math addition so we are adding uh the contribution from each uh we get an x pattern why because we have these ellipses that are rotated around the same origin um by 45 and negative 45 so they're going to be at 90 degree angles to each other making x's which is you know in its own right um you know it's a it's a cool pattern but it's not what we want right uh what we want to do with this is for the bottom group or you could do this on the top it doesn't matter so something controlling only the negative 45 degree version what we're going to do is before we even rotate is we can do a bit of a shifting so i guess we want to do that before so again i'm just going to manipulate these texture coordinates so i'm going to set this to addition let's set this to 0 for now even though that was already the correct value so right now we're adding by zero so nothing's happening but only for the bottom version you can actually shift them individually and this number is of course going to be dependent on this so if we change this scale you can see they're not necessarily in the correct position one way to account for this by the way so once you've picked your value and it's set good if you don't want to do some complicated math thing where they're like dependent on each other is we can throw in a scale before either of these chains happen and now they're like scaled together so that that's just a way we don't need to think about it and since that's actually pretty important parameter let's throw a value node in there so we can control it later down the line okay uh so now we have our base pattern it's kind of that simple not much to think about and now the question is uh how do we make this look like metal because this is kind of like the main component but it's not reflective metallic whatever it's supposed to be right um one thing to notice before we get into that is again everything we did before is actually happening on the sphere as well but this time it's using the uv coordinates of the sphere right if i was to uh open the uv editor this is the uv coordinates of the sphere you can see it's actually dependent on them um and you can wrap this on any object that has a uv map right because this is uv dependent it works however if you're looking at it from the camera view might be a good idea to just rotate the poles away otherwise you're going to see this like stretching on the top okay what was the point the point is we need to make this look like metal okay so basically everything here and we can can you put frames inside of frames oh i guess you can frame seption cool so that's something i even learned on this tutorial um so everything we've done here consider it baked in now the question is now that we have this pattern uh what do we do between here and the material output to make this look good right um remember we already have an hdri in our scene setup so what i'm going to do is i'm going to set up a principled bsdf like we had before okay so now we have a nicely shaded sphere that's using the hdri to make this look good first of all we make it metallic because it's a metal second of all we make it darker because it's like a dark metal and third of all we want our pattern to be kind of the height or the displacement or offset of the sphere now you could do this with actual displacement mapping i wouldn't recommend it because it's computationally expensive and we can actually get away with just normal mapping so i'm going to use a bump node to feed a normal socket so again we're taking our bsdf feeding and normal information from the bump node which what it does is it converts basically like a factor type of map just like float input black and white it turns this into so let's put this in height into information that's actually useful for us right so plug this into height and then we get our normal map which you can see actually looks like this so now you can see it's actually looking like um it's three-dimensional even though when we look really close at the silhouette it's not actually 3d it just looks like it is you could do this with displacement um okay so this is a good start but another thing we can do just to add a bit more control oh did i create a sub frame inside a frame uh whatever don't worry about it uh what we can do to make this look a bit better is you can see it's kind of like pinching at the top whereas it's supposed to have kind of like a flat uh top or base whatever you want to call it as we can add in a addition so um i guess you could keep it on clamp and you can see what this is doing is it's taking the map from before and it's kind of like flattening out the top if we think about why this is the case and it might be a bit uh confusing to think about that but if we think about why this is the case is we have this nice gradient where it's one only exactly at the very top or the very top line uh what we're doing is we're saying a lot more values can be mapped to one right because we're adding and then we're clamping right if we didn't clamp we wouldn't necessarily let's actually see the bsdf uh we wouldn't necessarily have that flat top because anything that's above one rounded down to one which makes it flat and we can actually increase or decrease this so we can take this and duplicate it so that both of them have that okay now that's the flat top thing uh by the way if you're trying to do this like perfectly mathematically correct uh correctly i guess you wouldn't add because then you have like grayness everywhere else um but we don't actually need to worry about that too much like technically not correct but whatever just like with other things we're just looking for fast results that technically nothing wrong with them okay so so far what do we have we have a value that lets us control the scale of this uh pattern uh you could also make it really small uh we have our uv coordinates and um in theory we could control each of these individually if you wanted to and uh the uh base or top finding uh just to make it look a bit more metallic and by the way if you want this to be less intense literally just the strength of the normal mapping is gonna make it like more or less intense so you can decide what you want there for now we'll keep it at one um one other thing that is kind of pivotal it's kind of the thing that makes it look photorealistic is adding a bit of grunge dirt like roughness things where some areas are shiny and some are intended those could be you know the dirty areas to do that we don't need to do anything complicated right we just use a noise texture which already kind of has this muddy look to it uh just to increase the contrast between like dirt and not dirt uh color ramp can do that pretty easily so just bring these handles closer to each other and this again this is what we're going to be using is the tongue it's just moving where it wants to and it needs to stay in place do as it's told um what was i talking about i was talking about making dirt um because we have this color ramp and the noise texture um basically our entire dirt pass is going to be controlled by this so we can control like the density of it so now we have a very small i guess a large numerically but small visually scale we can make it detailed dirt we can make it very rough and i would recommend bringing this near or to one what we want to do with this is to actually incorporate it i guess there's a couple things we could do first of all take this connect it to roughness which immediately is not going to give us the right thing um it's going to give us some areas that are indeed rough and some that are like in fact too shiny like a mirrorball uh to do that again black where roughness is zero in other words it's perfectly um shiny right so zero means shiny one means um what's the word diffuse uh not shiny at all uh what we could do to fix this take the black value so what is the most shiny and then just bring it up so it's like not nothing crazy like .4.5 something like that so we still do have a distinction between dirt and not dirt however now it's not like super shiny in some areas so that's the first thing we can do we can also use this as a base color so wherever we have the shininess thing going on we're also going to have some discoloration which is a good thing we can also use this to kind of drive the overall color with a addition or subtraction i guess subtraction is probably a better way to think about it we could subtract to make it darker but still keeping those color variations where it's supposed to be shiny so there we go okay so that's a good start um one of the things by the way that's making this look super super not real um you never see the diamonds this big so let me actually just make this a bit smaller so six by six now it's looking a lot more real and uh i think that that's kind of the essence of it like we could also add in scratches and stuff like that however uh kind of the point of this diamond plating is i don't think um any surfaces could really touch anything that's like part of the actual sphere because it would just hit this thing that's kind of like offset from it one thing i like to do before wrapping up the project even though i guess we've made the material and you could add in a bit more you know stuff here to make it a bit more complex um i always like again since this is using uv mapping so we could use whatever object i like to throw in a plane you probably saw this with the original render if i decided to do this i just bring this down i rotate it a bit but i guess using a global coordinates and what i like to do is we're going to give this the same material so again you can have multiple objects with the same material and now the the nice thing about this is since they are driven by you know basically one number is uh this is going to control the sizing let's do this in eevee just so it's a bit faster won't look good but whatever we're controlling the sizing for both of these at the same time uh so this is just to emphasize you could have multiple objects so with this material in fact if you wanted like one of these to have like smaller because it kind of looks like these diamonds are smaller than the planes if you wanted to you know separate these what you could do is make a um not so that every material no not so that every object is using the same material but actually separate materials that started off the same you just hit this button right here and now we have metal patreon zero zero one so this is another version uh this one's only going to control the plane and now you can see we can change the sizing of this without actually affecting the sphere but in general the rest of what made this look like super good i guess in my opinion you know i made it so i'm not going to be like crazy about this i keep opening the wrong one now what made this look super good is i guess the lighting stuff like that in fact if i could go back and make these tiles a bit smaller um it's lighting it's a depth of field it's stuff like that but in general that is how you make a metallic diamond plate material how to know what it's called anyways hope you enjoyed the tutorial and since we're at the end of it i like to do this pitch i'll keep it quick patreon exists um this one file and anything i've ever uploaded before is available to patrons additionally exclusive tutorials that i do not post here are on the cg matter channel those tend to be a tutorial series for different effects that would take too long to make a single tutorial for those exist there discord access for private channels behind the scenes early access i think this tutorial specifically um not at the point you're watching it but back when it was recorded um i posted it a day early on patreon um just a thing so to all 550 some 60 i don't know to all many many many patrons that are currently doing that thank you for supporting both these tutorials i like to put your name names into credits uh because you are in some sense in every sense the producers for this uh so yeah for any people who aren't patrons and are considering well thanks thanks for considering and for everybody else who has like no idea what i'm talking about and just wants to move on uh thank you for watching this tutorial i hope you learned something i hope this was a understandable uh procedural tutorial it shouldn't have been too bad um the only difference here is i kind of took those frames and made them node groups and stuff but generally same idea and uh yeah that's the show see
Info
Channel: Default Cube
Views: 36,019
Rating: undefined out of 5
Keywords: blender, tutorial, metal, material, metallic, procedural, nodes, beginner, advanced
Id: PtF2BXI_2QM
Channel Id: undefined
Length: 22min 31sec (1351 seconds)
Published: Sat Dec 05 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.