PRO-CEDURAL | FULL COURSE | Blender Nodes

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys this is default cube cg matter and what you're about to watch is the video course I made free on YouTube that's about two hours long talking about procedural nodes and how to make you know geometry from displacement and all this and I just want to say that I literally just took the parts and like put them one after another after another and it's nice to watch convenient video which means that the intros are still going to be there and the outros are still going to be there so you're gonna get like me plugging my patreon like four times but actually a fifth time because I'm about to do it now if you enjoyed this video of course you're about to watch and enjoy this free stuff that I put out on YouTube do check out my patreon for some exclusive stuff or if you want to support me whatever I think that's all I have to say anyways enjoy the course it's a good one you're gonna learn a lot hey guys welcome back to another default cube cg matter tutorial and the first thing you're probably thinking before we even get into this is why are you in a dark room and to be honest with you I have no idea it's just very late at night and I thought you know what let my voice carry you through this tutorial don't need to focus on my beautiful face what we want to kind of focus on rather is just everything I'm showing you here and blender so what is it that I'm gonna show you how to make well looks like I'm showing you how to make a cone which is kind of like a stupid tutorial it's very simple to model fairly simple to shade but there is a twist there is a reason I'm making this not only a tutorial but a tutorial series and that is that this cone is actually just a plane I know I know crazy stuff and some of you might have no idea what I'm talking about how is the cone actually plane what what's actually going on here is we have a single plane and all this geometry all this shading everything you're looking at is actually derived from this node network which I can make fullscreen that's derived from this node Network and if you haven't seen this before it can look like black magic it's like oh how do you first of all even deform the geometry and second of all how do you make something complicated with it well that's what we're gonna be talking about today I guess and it's kind of like a useless art in some sense it's a why when you just want to model the cone in this case it is kind of useless there are advantages like for example I could like change certain aspects of this like the cone radius so here I make a very thin cone and kind of breaks the geometry a bit that you just need more divisions so I can change something like that I can distort the stripes on it I could change a lot of aspects of this and that's one benefit of this what is called a procedural workflow where we can control everything at anytime nothing's baked in that's one advantage but the other advantage is that just knowing how to do this will help you out with a bunch of different projects right so this thing is rather useless right making a cone out of nodes but what you're gonna learn here will apply to things that are actually useful so generally the cone is actually a fairly simple example once you know what you're doing you're like oh cones actually not that bad and that's why I picked it but if you haven't touched nodes before I can imagine this will not feel very simple at all it kind of feels like an advanced topic so I'm gonna try to break this down in a beginner fashion and I think I've gone over enough intro so basic idea is we're gonna make a cone procedurally out of shader nodes and I'm gonna try to explain it as slowly as possible so this is the blender scene I'm gonna start off with probably you're gonna start off with the same one I'm using blender version 2.9 I believe yes the 2.9 alpha now might be in beta I don't know older versions of blender work newer versions if you're watching this in the future of blender will also work um do not worry about this the only thing that matters is we need to be in cycles and this is actually super important because the main idea one of the main ideas of making this cone is gonna be displacement taking a plane and deforming it and this only works in shading if you're in cycles does not work an Eevee so cycles and then just pick whatever settings you want beyond that so I'm gonna use my GPU to start off I'm just gonna take this cube and replace it with a plane since this is what we want to convert into a cone technically you could do it with the cube but I think this is actually much simpler I'm also gonna turn on experimental mode and add a subdivision surface which kind of smooths this out right if we enable more divisions and all this which I'm not going to do right now although we could we could like increase the levels it'll make it a smoother we do want extra divisions however we do not want this smooth so just click simple and this will kind of divide it without changing the overall form of it so again add a modifier of subdivision surface set it to simple and if you have experimental mode enabled like I do you're gonna have this feature for adaptive which you want enable this basically says don't subdivide by certain amount just subdivide depending on how close it is to the camera so here it's gonna be very subdivided whereas if I go further away not so much because you need less geometry because it's taking up less of the screen this is just basic setup now in the shading workspace which is where we're gonna be spending our time one more thing we need to do before we can actually get started so I'm just gonna make a new material called cone and we should probably save this all this is just some basic setup hopefully it's understandable we'll call this video cone the last thing as I was saying that you need to take care of is for this material whatever material you're using to make our cone make sure you go to the material settings and under settings go to displacement and make sure you either have displacement only or even better displacement and bump so before it was bump only means that whenever we plug something into thee into the displacement socket it wouldn't have done anything so that's why we care ok so how do we start off what is this first part of making the cone about well I thought an interesting way to divide these videos is by going over different features of the cone so the first feature of a cone is kind of like the base of it which is a rounded square it's basically what is sitting on the cement or on the street or just on the floor in general so we want to make the base of it and then we'll work up to the circle and whatever else so our first goal is making a rounded circle sorry I hope I didn't say that twice but a rounded square is what I meant hopefully I didn't say circle either way our first goal is making a rounded square which is kind of easy but we want to make sure it's fully procedural meaning we can change it on the fly even after the fact so I guess the first part of making a rounded square is probably just making a square so I'm going to start off with texture coordinates and we can either use generated you V your object it's kind of up to you I prefer something with the origin at the center so right now object coordinates has that alternatively you could use something like scrolling to UV coordinates alternatively you could use something like UV coordinates and then just displace them by minus 0.5 and then it will give us something fairly similar to object coordinates we just need to scale it a bit but anything with an origin in the center is good in my book so I recommend object coordinates just use those okay so now we have our object coordinates and I'm going to separate them by XY and Z so as we look at X you can see we have negative x values as we get to 0 and then as we progress up the x axis it goes to positive values with Y it's vertical and with Z we kind of just don't care we don't care about this third dimension okay and again I'm trying to keep this as simple as possible for those of you don't understand what's going on the way I want you to think about this is we're gonna look at where our X values greater than this number and you can see it's just sweeping from left to right so really this is just the x-coordinate of our object where the origin is in the middle okay so now we kind of have x axis and y axis which is a 2-dimensional kind of graphing situation how do we make a square out of this well there's a couple ways the way I like which is now the fastest one of the fastest you staff to do a bit more because the math node didn't have so many options but nowadays we have something called compare so I'm going to choose compare and let's compare X let's compare X to 0 with some threshold so I'll explain this in a second you can see what this node basically does is it creates a stripe vertically that we can control the thickness of okay why is this well it's taking our x value and comparing it to 0 so X compare to 0 and we're and this is our threshold so we're saying how close is X to 0 with in distress hold if it's very small then there will be only a very thin slice of values that actually satisfy this condition if it's very large then you know once we get to 1 it actually fills up the whole thing so you can kind of think of this as a radius in a kind of very cubic square sense so again is X within this threshold of the value we're just comparing them we can then duplicate this and do the same thing for our Y which think think for yourself float what this will look well with this look like when we view it well it's gonna look horizontal because now we're comparing Y values which makes it look like a horizontal stripe and we can control it again so if we want it to be a square we kind of want to combine these meaning that first of all we should use a value note or something like it to give the side length the same value because the square has the same horizontal and vertical length otherwise we'd have a rectangle and then to combine this region in this region all we have to do is just add in another math node and set this to multiply the way you want to think about this is that multiplication means and so where do we have this and this at the same time so what's the intersection well it's only at the square whereas something like addition add is saying or which kind of looks like this yes there's a stronger overlap in the middle but it kind of gives us a cross so it's the or for and vs. and for multiplying okay so now we have a square that we can control the radius of alternatively if we had these be independent we'd have a rectangle so we could control these axes individually but we do like the fact that we can control these side lengths with a single value because it is a square okay so let's say that for now we're gonna choose point 5 as our you know side length or is it its I guess it's kind of like half the side length because of the radius thing either way or maybe it is the full thing it doesn't matter either way think about this as a radius and I'm just gonna give it that name okay so now that we've made our square the question is how do we round the corners I mean the expression that we're using mathematically doesn't really have information about where the corners are nor would we know how to round them so let's try to take a different approach so here's like one algorithm or one idea for how to do it so imagine we took the square and added a circle at each corner so one here one here here and one here well wouldn't really give us a rounded square because the circles are actually contained inside of here it's getting us close like it's putting the corners where we want them with this nice circle but we still have this kind of sharp corner left over so we want to do that with the circles but we also want to cut into the shape first so imagine that with this corner we kind of cut away a square and then we add in a circle that would give us the nice rounded corner so that's the idea we're gonna go with so first of all how do we get rid of squares how do we delete the corners and then how do we add in circles so for deleting the corners we need to know the coordinates of each of these well let's think about what the coordinates are we know that the origin is right here it's in the middle it has coordinates 0 0 and we know that this corner is this radius in this case it's 0.5 along the X and 0.5 along the Y so in this case it's 0.5 0.5 now it is 0.67 point 6 7 and in general its value value over here it's negative value negative value because we're going to the left which is negative x and then down which is negative Y and then you know you could keep going like this top left is negative value for negative x and then value etc okay so we kind of do know the coordinates they're dependent on this so let's try to make a square on each of these corners and we can kind of repeat this node set up but we just want to shift it up here so how do we do this well first of all let's view our object coordinates if we can take this origin and move it to the corner and again we'd have to do this for all four but if we could take this origin and move it to the corner that would be super useful right that's exactly what we want then we'd have the origin centered at where we want all the action to happen well we can do that very simply by adding a vector math node which is you know this is addition of a vector just translates everything essentially so here I'm shifting the coordinate system on the X and the y and we know that we want to translate everything by at least the x and y by this value right here so we did either this is kind of a tricky situation you can either plug this in and it will like kind of do it I guess you want to multiply by negative 1 so now we have the bottom left corner but it's also manipulating the z-coordinate because we've said use this value for x y&z we kind of want to ignore that part so what I'm gonna do is I'm gonna make a combined XYZ node so instead of putting in our vector manually here we could connect this and control it outside of the addition and then we're just going to control X let me try that again x and y and again this is the bottom left corner because it's kind of counterintuitive you'd think that adding point five point five which shifted upwards but rather it's saying this point was already negative 0.5 negative 0.5 and what happens when he at point five point five well it bounces out to zero that's the origin so it's kind of the opposite of what you'd think let me just make the opposite of the scenario so before these values reach here what we can do is put a math node in between set it to multiply by negative one and now it will be up there okay and then we could kind of repeat this node Network from before so let's literally do that let's just copy it shift D to do that and now we're gonna plug this and instead so instead of whoops I've lost my nose I think button yeah that there's a couple hotkeys for covering that but um what I was saying is instead of just bringing these object nodes directly into our square set up we're bringing in the translated version that's the idea let's get rid of that okay so currently what is this gonna look like well it's gonna look like a square that is centered right here with a radius of 0.49 point four nine and if we add in a value node just like before now it's a radius of square centered there we can now control this okay so if we want to have this cut away from our original square it's kind of obvious what we need to do we take this square and subtract this square right we want to get rid of it so how do we do that we just take another math notes that it's just to subtract and we want to subtract we start off with this and we want to subtract this away so we'll just do that right here and now you can see we've made a square with the corner kind of cut off and we can control kind of the radius of that cutoff okay cool one more technical thing to think about before we kind of do this for all four are the three remaining corners is technically technically actually yeah technically some of the square especially the area up here is kind of hanging off an area where there is no square here basically what I'm trying to say is when we subtract we kind of get rid of the intersection but some of this extra stuff over here is not just zero but it's negative because we took zero and subtracted some of the remainder of the square a nice way to visualize this a nice way to visualize this is with a greater than note so you can see this looks exactly the same but if we go into the negative territory we kind of have this hidden thing right here which you know we don't see because anything below zero is just kind of set to black but could mess up our displacement in the future so to fix that just an able clamp and that'll make sure that anything below zero just gets sent to 0 right it clamps it between 0 and 1 and now if we do a greater than and go under zero it will just give us you know everything will give us white cuz everything is bigger than a negative value currently because of clamping okay so now the question is do we need to kind of just do we need to kind of duplicate this and then each time use a different vector over here to get all the corners that would be one way to do it but not only would it be pretty computationally expensive because you've been adding you'd be adding a lot of nodes but it'd be messy and it would take a lot of time so let me go over a trick that will help you quite a bit so here are here's the coordinate system that we're using to you know do the thing really what we want to do is do the same trick for this corner and for this corner and for this corner and a nice way to do that is notice that anything that isn't this top right area anything that isn't this top right area has the issue of being a negative in some sense so this black area is negative than X and negative and Y this area is negative in X this area is negative and Y basically what I'm saying is if we can somehow convert these areas to being entirely positive then we'd have the exact same thing going on as this quadrant over here and there's a name for this this idea and the name is absolute value so vector math node we set a to absolute value if I can find it absolute and I will be honest with you I mean we could logic it out but I do always forget where it should be placed so let's try to put it ahead so that doesn't seem to really do what we want right we want this black dot not only here but in the other three corners so it's definitely not that and I'm thinking I'm thinking that what we need to do is put this probably before so let's try that there you go you know if you think this out it probably made sense you know before trying it back and forth and all this but the reason that this works is originally we have our object coordinates where again we have this quadrant idea where this is a positive quadrant and the other three have negative you know components to them if we take an absolute value then they're all positive and then when we shift them it's kind of doing the thing everywhere okay if you don't understand that don't worry basically the trick is absolute value gives us a nice four-way mirroring kind of like a symmetry and then if we view our squares now we have them in all four quadrants and really in all four corners that's the thing and we can control the radius which means we're subtracting away this entire thing which gives us this so we've got we've kind of made a procedural cross generation and you can see that now if we can somehow add in circles like here and here then it will look like we have rounded corners not really we're just kind of taking a square subtracting away squares and then adding circles but visually it does do exactly that okay so how do we do that well we already know that we want to use this trick this absolute value trick to put a circle not only in this top right quadrant but in the other four so if we can focus on making a circle on the top right quadrant we all the rest of the work is already gonna be done for us so I say that we take our coordinate system here this absolute value and shifted coordinate system which looks like this and let's use it to make a circle there's a bunch of ways to do this the easiest way in my opinion is using the length function which when you input in vectors because that's what this is outputs the size or magnitude or length of those vectors and here's what it looks like you can kinda see how this might already give us four circles basically think about it as let's only focus on the top right quadrant for now so right here is where one of the origins were that we've kind of manipulated to be there that's going to have a length of 0 because the vector is 0 0 0 length of that is 0 and then as we go radially outward from that origin it's gonna give us a nice radial gradient meaning we were kind of just mapping the radius in each of these quadrants right because we did the MER trick if we muted this then it would just look like that and if we muted this it would be in the center is the idea so that's unmute so now to make this look like you know circles we could either okay there's two methods you could either use a color ramp node and I feel like this is a kind of short-sighted way of doing it so you make this kind of crisp fall off it works however not only is it very imprecise because you're just kind of dragging handles but we don't just want to any circles we want circles with the exact correct radius otherwise when we put the circles on top of this there will be some I mean we'll get the nice overlap but we're gonna get some areas of the circle that are outside of where we want right so our radius is already chosen for us so how do we do this well we can use a math node math node since we've converted these vectors into values because the length is just a number it's not three dimensional and we're gonna use something like either greater than or less than so greater than is gonna say where is the radius bigger than in this case point five and then we can manipulate that and notice that the circles are black because anywhere in the interior has a radius smaller than this and the radius as you go inwards gets smaller and smaller and smaller so obviously it's going to be smaller than point two nine in this case that's one way to do it I'm gonna use the less than which is just the inverse it doesn't matter you could have just done this and then use the invert node or something like that whatever you want we're gonna use the less than so less than and again we don't just want any value and let me illustrate why I've already explained it let me illustrate so we want to take this and add add our circles back in which are already centered on the corners because of our nice set up from before so let's just add because we want this or this and you can see and again make sure you have clamping otherwise you're gonna have some areas that have a value of two because we're taking a region with one in a region with one and adding them which gives us two so just clamp that to make it a uniform you can see that these circles are way too big and you could just kind of guess what the radius should be oh by the way we do need to shift them down I did forget that maybe we should take care of that first but either way you do see the argument the radius in this case is too big and we'd kind of have to manipulate it to be just right so let's take care of that shifting that I forgot to consider so right now these circles are centered where they're centered at the corners of our original square that's close to what we want but instead we want them centered at kind of where kind of the corner of where we cut it off which is determined which is determined to remember by this a radius of of these squares right this determines where the corners are so we want this corner this corner etc well I feel like this is it should be pretty obvious that all we need to do is manipulate our input coordinates so I'm just gonna duplicate these and feed this into what we had before like this and let's do that so now we have two different variations one very let me get rid of that I'm having trouble selecting this we have one variation of our coordinate system the absolute value in addition going to our squares and we have another variation of absolute value in addition going to our circles so let's do what we had before we're using the same vector that uses these you know x and y values that we already explained why we're using so currently this should give us the exact same thing as before which almost gives us what we want but again the circles are in the wrong place which is visible when we us so all we need to do is we need to manipulate what vector we're putting in here so it shifts correctly so I'm gonna do it by putting in another vector add node I know it's getting messy right here and you can see that we can kind of just manipulate these values until it's right and here you can see why this actually looks like a rounded square once we get the positions right but how do we get this exactly without guessing well all we have to do is use another combined XYZ and this time instead of using x and y from our square radius we'll use it from our corner squares I'll clean this up in a bit because it is getting crazy so same as before X Y okay which gives us what we want however again these circles aren't big enough and they should imagine that they're centered here they're centered it's getting confusing they're centered at the corner of this of this cutout this is where they're centered well how big should they be they should have a radius of this length right and that would give us a nice perfect circle well we actually already know this value and that is this one so point oh eight point it wait so we take this we plug it in here we view it and it's beautiful it's beautiful and you might be thinking okay that was a lot of work I could have just moved stuff manually and I balled it until it made sense we'll look at it this way look at it this way we have two parameters we have two parameters one of them is the radius and I guess I should specify we'll call this main radius or maybe we should just call it side length really because it's referring to the original square and we'll call this one rounding because it's referring to the radius of our circles and it also positions them in the correct spot which looks like rounding so here's what I want you to consider we have one slider that changes the side length and the circle's notice are staying in the correct space spot and the rounding works as well if we make are rounding big enough it would look like a circle and if we make it small enough it will look like a square and all of this works together you could have made these independent from each other this one this one so you can get a rounded rectangle instead of a square but in this case we have a much simpler situation and remember we kind of got lost in the weeds here remember the idea here is we wanted to make a nice procedural base for our cone so a cone kind of looks something like it doesn't have this much rounding more like something like this and with our you know our generator we it's basically a generator for with our generator for rounded squares we can now create any base for a cone that we want and let me just give you a sneak peak about what we can do with this first of all let's do a bit of cleanup don't worry about the fact that this is a mess because honestly we never need to touch any of this the only things we care about are these red things these inputs because that's what we'd be manipulating so just drag everything that isn't red into a clump and then you could either you know select all and then control G which puts them in a nice node group and that's probably the better way to do it or you could just hit shift P to put them in a frame I'm gonna go with control G to put them in a node group which we can move closer so now it's you know it's still the same thing going on but it's a lot simpler and we can always control using these or alternatively you could just use you know this stuff built right into the node but I think for simplicity sake we'll just keep these same set up from before okay so I want to show you one more thing before we wrap up part one which I feel like was pretty intense but again it's hard to explain this stuff out of beginner level because it's very mathematical but remember we set up all our displacement stuff let's actually see what this looks like with displacement so what I'm gonna do is I'm going to view this with a diffuse BST F and for our displacement we're just gonna use a displacement node hook that up and then and then by the way set node level to zero so it's not like offset at all what should what should our height be for our displacement I'll give you a hint this is our height I'm meaning black is zero meaning a height of zero don't change it and 1 or white is a height of so we can just put that here and let's view it with our diffuse be SDF okay so couple things first of all it looks a bit glitchy especially in the corners and this is just because it's procedural meaning that the amount of detail that we're gonna see how smooth this corner is gonna be is directly dependent on how much geometry we have so if we take our like dicing scale and make it smaller you can see this gets nice and rounder you could go down to 0.2 this is going to become more and more computationally expensive as you continue but you kind of just want to set this to a very small number on render for now we're just viewing it and the second thing is that the effect of this is very large right a cone isn't this tall the base of it we can either control this with the scale to make it smaller but that's not really what we want because we'd rather keep this at one since we're gonna be feeding more than this than just this into our height so we want to keep this normalized so what I recommend is just using something like am math node and then just multiplying it before it even reaches height so that's one way to do it and let's actually change our lighting to an HD ride just so we can see what's going on a bit better so I'm just gonna use a free HDRI that I have from like HDI Haven or something something with a bit of contrast like that and let's hide that with film with film transparent okay so again we can return to our nodes which I always lose we want to make this even you know not as tall and and if anything you could just make a value node so right now it's like point 1 3 and then connect this and now we actually have another parameter for the height of our cone so you can see how all of this is building very procedurally so let me call this um let me call this base height just like that okay and again to make the smoother we just bring this down and I think this level also helps but again it will make everything a bit slower so I just recommend making it very smooth on render time and by the way for you experts out there who want a good way to solve this without just increasing the resolution or you know decreasing dicing scale which increases the resolution a good solution is instead of having a very harsh map that goes from let me views it view this from the top and remove displacement that goes from black Toit immediately if you could have a bit of a gradient a bit of a fall-off there will be a nice transition for the geometry to catch up with the boundary so hopefully professionals experts know what I'm talking about right there that's just an advanced solution but for now this is actually fine and if you look at a cone the base of a cone it is pretty straight there's a bit of curvature but this is at least a reasonable approximation so I think this is a good place to leave off this part of making the cone thank you for watching part 1 of this advanced procedural stuff I just wanted to end off with this before I actually end the video if you want to support this channel and everything I do and you like these tutorials and you want to get benefits the best way to do that is via my patreon you're gonna get exclusive video tutorials if you get a certain tier you can get project files you can get a whole bunch of other stuff but in general it's just a very very nice way to support me and these tutorials if that's something you want to do and um yeah the patreon promotion at the very end I'm serious about it it is the only reason I can do YouTube full-time so thank you everybody who wants to do that enjoy part 2 when it comes out there might be a day or two doing part two of procedural does that mean it's twice as hard as part one or only plus one harder than part one does it mean that this intro is gonna be twice as long yeah either way welcome back everybody back to the darkness where we are gonna continue working on our completely procedural cones so where did we leave off on part one well we kind of made this let me get rid of the displacement we made this kind of rounded I mean not kind of we we did make this rounded rectangle which we can control many aspects of procedurally like the rounding how round this is so we could have like sharp corners or something else we have the side length which is just one parameter instead of 2 because it's a square not a rectangle so one side length describes both of them because they're the same and then I guess if we put our displacement back and view this be SDF which actually gives us nice displacement we also made a parameter for the height of this which is really just what we're multiplying and I know it's a playing very slowly or it's actually rendering very slowly and you know that that's par for the course with um with a displacement but um what was I saying I was saying that this base height is basically what we're multiplying by before it reaches displacement so it's just kind of like a scaling before it reaches here okay so what do I want to talk about today we've already covered quite a bit well I think that the next step should be we've made the base of the cone let's make the actual part of the cone which is actually just the rest of the geometry right once you have the base and the cone everything else is just coloring like the stripes and two orange and a dirt so yeah that's the game plan I guess let's just do it and you might think oh do we need to make another giant node group like this and then just package it up not really I mean if you think about it what do we need to do we need to make a cone which is kind of like a circular thing that goes upwards and as we've already made circles before for these corners we kind of already know how to approach this so I guess let's just do that so I'm gonna start off with these same object coordinates as before and by the way while we're making this it might be helpful to disable displacement just for now just so we can see what we're doing very nicely okay so what do we have we have our object coordinates and we want to make a circle I already showed you the trick for this and that is using a vector math node and setting it to length which again works because on the V this it works because what it does is it takes the input vector and outputs the length the magnitude the size of that vector where the origin being the center this black area right here that is the vector zero zero zero which means it has a magnitude of length the size of zero and as you go radially outward from the origin again it gives us this um this spherical technically spherical not a circular or radial because it does work in three dimensions but whatever it gives us a nice spherical gradient which is exactly what we need to make a circle so right now let's say that we took this and incorporated it incorporated it into our displacement what would happen well let me just set this up and view this well how would we incorporate it in the first place well we know that we need to do this incorporation keep sin that over and over and over again we need to do that before it reaches this height because once we get to this displacement note everything's final so what we can do is we can add in a math node set to add since we want to take this and this and not in the sense of intersection but or again add Azure multiplies and so we're just gonna add this and this and you can see that it kind of incorporates both of them we still have our base kind of but it's using this radial kind of gradient to make something super strange so it is incorporating both of them just not necessarily in the way we want and that's because this isn't really like a circle in the area that we want we want to first of all invert it because you saw that the displacement was highest at the boundaries let me just show you again highest at the boundaries and lowest in the center okay so there's a couple ways to fix this you could either try like an inversion which is just kind of like the naive approach I like to call it so we connect that to color so this is what inverted looks like so I keep having to get rid of a displacement but you can see this is inverted and this is not inverted so it does give us the highest value the biggest height in the center which is what we want but I'm actually going to use something a bit more sophisticated get ready for a new note everybody RGB curves oh yes when we just add this normally it's not really going to do anything so this is without and this is wit it doesn't do anything however however let's just connect this here and view what this gives us with rBST F so you can see this gives us the same thing but however let me finish that sentence now we can do the inversion using this RGB curves instead of the invert node which you might be thinking that kind of seems harder and it is but there is a reason for it so to invert we say when X are really not X when this input is equal to 0 it has a height of 0 so we can actually just map it to 1 which is the inverse and then when it's 1 we map it to 0 so we kind of just flipped it so you can see how we've kind of now we kind of now have the opposite kind of thing going on and something that you might notice is some of the displacement is actually negative like it goes below the floor plane and that indicates and that's fine right but that indicates that this output what's being outputted from here is not clamped right there are values smaller than 0 which in this case is now what we want cuz we don't want anything going under our base that was a gnarly voicecrack so how do we get clamping going on the trick I like to use is I like to use a math node set to add was 0 so that we just take this and then basically what's happening here is RGB curves is being added 0 in other words nothing's happening but if we enable clamp then this just kind of works like a clamp node so without and with just make sure that there's no negative displacement okay you know that's useful however you can still see that you know this circle is kind of going wider wider than our base and that's why we're getting this weird shape so if we could somehow scale what's going on then that would work of course there's a couple ways to do this we could either manipulate what's being sent into here so we could like you know let's get rid of the clamping we could just multiply and then this basically manipulates like the radius of our circle so you can see now barely but at least kind of looks like a cone I wouldn't recommend this because the reason why I added this RGB is because we can do everything we need and more and more inside the snowed so to fix this what we're gonna do is I think it's this one if we think about it we want the area where the radius is zero to happen way before it goes out here right so we kind of want to scrunch it in so therefore we just if I can click it we just drag this inwards so you can see what this is doing it's just making our cone a bit smaller in the same sense that our math trick before was so now you can just slide this to where you want now I think a cone is something like this will see something like that and of course the next issue is that a cone doesn't have a pointy tip but what if I told you that we could literally just draw what this looks like so here's like a you know a fat boy egg cone you can also cut inwards and make a bunch of weird designs this is the idea and basically what we're doing here as I've already made a video about this we're kind of graphing using our radius as an input our length as an input so as it goes outwards we're going along this RGB curve so when radius is zero meaning it's at the center of the base it starts up here with the highest height so that's why it has that tip and as we go radially outward it's gonna go DAG and we down to zero so that's why it cuts off and you can see how it's kind of obvious if you kind of look at the profile so you see this curve is the same as this curve okay so all that being said how do we flatten the top I'm just gonna add a node right here and then also set this to vector handle which is going to give us a nice sharp no smoothing kind of thing and we're gonna set this all the way to one so basically any values between here and here are just gonna be maximum and then we just need to drag the sense so it doesn't happen that late but just pretty early and you can see how this kind of gives us something somewhat cone like right it has a flat top so why does this look horrible still I think it's because it's not tall enough and we could either you know fix this by manipulating the base with our parameters but assuming we want to keep this the same let's instead manipulate the cone so remember everything we did over here we multiplied we scaled before it even reached our displacement you can do the same thing over here so let's just multiply no need to clamp since we've already clamped before so we're going to multiply and then if this is set to one we're getting the same thing as before because we just pipe everything in and multiply it by one and then everything happens the same but if we pick values bigger than one like I don't know this it gets taller and taller and taller so the idea is we need to find the correct height and you might think oh this is would be a pretty useful slider that was a horrible sentence this would be a pretty useful slider and you'd be right so we're gonna make that of another value to add to our collection of parameters right here so we can call this one cone height instead of eye base height I'm slurring my words today cone height and then we can just control it from here and note that this only affects the general magnitude of the displacement of this part it doesn't really do anything about this flattening and unfortunately we can't like do something with a value node and connect it into this thing that's not a thing we could have done this more mathematically without RGB curves about whatever at least for now you can still control this procedural using this node it's just not as nice as having a value node but that's fine so just find the correct height whatever you think is correct that looks pretty good I'd say that it'd be better if this was a bit wider so how do we control via width well again we can do it from here so let's just have it go a bit more outward so it's getting closer to the edge and that kind of looks like a cone kind of so I guess there's still two things to do of course by the way just a little tip if you want to get some nice I don't know what to call it curvature so it's not just base and then cone you don't want this sharpness what you can do is kind of draw a nice Bend so it kind of bends into it I'm not gonna do it because it's hard to get the shape right so here you can see we have a more bendy cone than what we had before you know maybe we should just add a tiny tiny bit of Bend there you go I think that's nice and tasteful but you can you can do that what was I saying I was saying that there's two things we need to do to complete the geometry of this cones again I don't care about what it looks like in terms of color reflectivity specular blah-blah-blah-blah-blah not right now what we care about is the general form well there's two issues first of all we don't necessarily want this plane here so everything that's not the cone we could either turn this into a street which is something I hadn't considered but that is something we could do but I don't want to go over like procedural like cement or whatever in this tutorial so there are other option which is what I'm gonna go for is we're gonna make it invisible so again if you're thinking how do I get rid of everything except the cone you might have thought oh I need to shrink this inwards towards the center doesn't need to be that complicated we can just literally make it transparent and that's the trick a lot of people use so let's go with that first so basically the surface properties are defined by this V SDF well let's also add in a transparent v SDF so if we use the transparent B SDF it's gonna be transparent every we're still gonna have the geometry we just can't see it if we do this it's gonna give us this so we somehow need to mix these together right so we mix them together but we don't want it you know 50% some 50% this everywhere we're where we can control the influence of each using the factor we don't want that in fact what we want is a hundred percent influence of our transparency here and then zero in our cone well how do we you know create this factor mask well what if I told you that we already made it well think about it so imagine we look at this from the top we want transparency everywhere outside outside of this rounded rectangle yes we do want no transparency into circle but that's enclosed by this rounded rectangle in other words I'm saying this masks that we mask that we made which kind of looks weird right now but that's just because of the displacements imagine it looked better everything outside of this we want it to be transparent so why don't we just use this as the factor and not really the multiplied version but in fact this version that we have them scaled so let's use this right here as our factor and you're gonna notice it almost gets us there but it's inverted right it is definitely inverted so what we can do is we can either you know drop in and invert before it even reaches the factor but what I prefer is just switching these two inputs okay so now we have something close you know it's the right idea but you can see some of our bases being cut into and you're thinking oh you know the logic of what you said made sense I don't know why this would happen this is just an issue of geometry and in fact the more geometry you have the more accurate now you can see we have some of these chunks that weren't here before the more accurate you can get this but really what's happening is that this mask that we made from the top view just imagine a look normal or you know what let me just show you this mask that we made is kind of like infinitely sharp meaning that the boundaries just goes from 0 to 1 immediately there's no fall-off and that means that when we you know displace some vertices are gonna fall here some of them here but no matter what it's gonna either be displaced or not there's no gradual fall off for stuff to happen meaning meaning that once I view this meaning that it's gonna look very choppy so some of these vertices make the cuts some of them don't and fall into transparency the only way we can fix this with what we have currently is adding more divisions but I don't want to do this so is there a smarter solution there is what if instead of using this mask from before we use the same thing but just a bit bigger just give it a bit of buffer room we don't have a gradient but we can do something almost as good which is giving a bit of a margin or a buffer well yeah we can do that so let me just duplicate this and put in the same input so for our texture coordinates use this for our rounding use this and for our side length use this so this node and this node are currently identical but the only difference I want between let me just get rid of this the only difference I want between this one and this one is that this one should just be a tiny bit bigger well how do we do that well we do have this nice side length that will make it a bit bigger of course we can manipulate it here because that will affect both of these it's connected to both we can make that a bit clearer so these are all connected to both but if we have the side lengths to be manipulated by a math node before it even reaches then we've now kind of made this path and this path independent so if we add zero nothing happens but if we add something like point oh one and let me just zoom in here so you can see if we add something like point O one it will become just a bit thicker or a bit you know bigger but still have the same general shape and now we want to use this the modified version so here's the small one here's the big one whoops here's the small one here's the big one we want to use the big one as our factor so let's see what that looks like okay we need to include our at displacement okay so now you can see that we're almost there in fact we got a lot more of our geometry and if you're thinking to yourself the bigger the margin the more room we have to play with and therefore the more correct this is gonna look that's what you're thinking then you're correct so instead of 0.01 we can make like point o2 and now you see we're getting just a bit more geometry let's try point point O three and again you could just add more divisions to also help this but this is a nice solution okay so I'm gonna go with 0.05 and that seems to do it of course the sacrifices we do have some of this over here some of this boundary is um you know the floor and we don't want that because again we just want the cone but you know this is the best you can do and in fact when we're viewing this in the viewport our subdivisions aren't actually as dense or as high as they'd be during render so even if it doesn't look that good on point o2 right here it might look you know perfect on render so for at least reviewing we can keep it at 0.05 but when it's time for render we can make this margin a bit smaller lose a bit of the floor and still get good results okay so that was a long tangent about how to get rid of the floor we did it with transparency kind of a clever solution but now the other thing that's missing is the cone is kind of supposed to go inward so that it's not like the solid thing at the top it punches inward in other words we need to make a circle that we subtract in terms of displacement we subtract so goes inwards well how do we make a circle we already know this we actually just did it and some of the work is already done for us with lengthen owed which we should view from the top now in fact it's gonna look a bit strange because of the displacement so let's get rid of it so same old lengths setup as before well how do we you know how do we make a circle well we don't want to do this kind of like fall-off type stuff with the RGB curves we would rather just make it a nice sharp circle and as we've talked about before with the rounding rectangles in other words part one we can use a math node set it to I think less than is what we decided and then we can control the radius in fact this just means what area is going to be punched into and you better believe this deserves its own value so let's call this punchin I'm punching him fallen to the floor he can't stand me anymore my rap battle more like rap galore okay where where are we punching is gonna control the radius well what do we want to do with this well we want to use it to subtract to subtract before the displacement happens right because that's saying instead of displacing upwards displace downwards so let's see what this looks like okay so here's our cone what we're gonna do is but we did our whole calculation one of these is the base and one of these is the cone part both of them are scaled and then we are going to subtract our circle that we just made and put that in there okay what does this look like you can see that it kind of if it gives us the right idea in fact it gives us a fairly interesting shape but if there's one problem with this it's that the radius is too big so if we make it like point one now we're getting closer but in fact it needs to be smaller than you know the flat area up top so we just keep bringing it down something like that so you can see what this is doing maybe a bit bigger 0.06 whatever we have a parameter for this is the point so now we have something that punches in but notice that this less than is kind of like a very discreet either true or false kind of thing meaning it's either completely black we're completely white which for the thousandth time we can't see when we have displacement it's a very harsh which means that it's gonna be in this area where it's subtracting and we're punching inwards it's gonna go all the way down so we can actually see it over here this is like at floor level at least it should be we don't want it to go that low we want to be able to kinda see it so maybe it's only going in a couple inches instead of a foot how do we do that well we're subtracting it but by how much well by something that we scale by so multiply same trick over and over so one gives us the same thing as before zero gives us no subtraction right so we get the flat top let's experiment so point one punch is just a bit inwards maybe not far enough let's do point two I think I'm happy with that and for those of you saying that I don't know the anatomy of a cone I I really don't know what it's supposed to look like but at least the idea is nice so let's say that that's fine now for this one yes we could we could add a value I think we will I don't really intend to use this cuz I think point two is a good amount but if we were to make our cone let me bring this over if we were to make our cone super tall so what is that that's some cone height if we were supposed to make if we were gonna make this super tall I would like the punchin to go a lot further than just point two is the idea so now let's see what controls we have and again I just want to emphasize that this floor thing is not that big of a deal and in fact I don't know why I didn't think about it we should add a bit of a margin slider so 0.05 connect this call it margin okay and now we have a control over this so this should be smaller than it is on render because we have a bit more buffer room because the divisions are actually happening what I meant before what the divisions are like denser on render so you can see right now we want 1/5 of a pixel dicing scale so point two and that's what's gonna happen when do we hit render but right now it's previewing at one point six so it's like you know what is that that's seven times no eight times I can't do math this eight times less divided than it's gonna be on render so yeah you know it's gonna be fine what was I saying I was saying that we can control the cone height so how tall this thing is and we can make some interesting cones using this we have the rounding which you don't want to make too big but we can have a nice square cone and notice that since this affects both of these you know both the normal one and the one we're using for transparency it's just gonna work the way you'd expect so we have rounding we have mystery value had that I didn't give a name what is this this is the punch in punch in strength in other words how deep down will that hole at the top we made a go so when it's set to zero it's gonna be a flat top and we already talked about it we have side length which is just the size of the thing so again if you don't want to make it smaller than it's supposed to be so smaller than the cone radius yes we could have made this mathematically handle itself so even if we do a value too small we'll still give a good result but for now we're not gonna do that so that's side length base height is just how tall this cone is which again you need more geometry for it's gonna break but going downwards shouldn't be a big deal yeah yeah we have our punch in and our margin and I think unless I'm forgetting something I think we've done our geometry very nicely I think this is a good place to end there there's one more thing I want to do but I think it might be stretching it for this tutorial I think we've already learned enough so let's just do a bit of cleanup I guess so since we have everything we kind of need exposed here we can turn this whole mess into just kind of like a group node now of course there's the issue of that RGB curves which you want to control but if it's in a group node you can't really I'm just gonna say that for now we're happy with it we can always play with it later but for now I'm just gonna keep this because I think this is gonna be useful in the future but all of this I think yes I think all of this we can group together so that's ctrl G and now we've cleaned it up just a bit now of course sendin group it in a way that makes complete sense but that's for you to take care of I'm not gonna take care of it for you okay cool I think that's the end of part two so there you go thank you guys for watching part two of procedural you've made it to the end and there's still more to go probably episode three and four I don't think we're gonna make it past four but we'll see again this is that end of episode patreon plug please listen I do I do have something to say if you want to support this channel and you like the tutorials I make and you want benefits the best way to support me default cube cg matter is via the patreon there are different tiers some of them give you video courses which are exclusive tutorials that you'd otherwise need to pay for on Gumroad some of the tiers give you discord access behind-the-scenes tutorial files which is very relevant for this one but regardless of all that this is the best way to keep me floating and making tutorials consistently because I feel like I fill in a nice gap oh we're not many people talk about this aspect of nodes in this case but um yeah that that's my end of show plug check out my patreon if this is something you're interested in I would greatly appreciate it but you're also getting something for your money besides just feeling good there you go that's my pitch see you guys welcome back everybody to part three of procedural is it 50% harder than Part two or three times harder than part one I don't know either way we're back one tiny note before we continue on to the nodes and I guess I should just mention this clearly I'm in a new place I mean it's no longer dark or anything but I moved meaning that there's gonna be some echo for now because I don't have a rug I don't have curtains there's nothing to absorb sound so this mic might get some reverb but maybe that makes my voice sound better I don't know this doesn't really matter okay so we're back in procedural the scene that we left off with what did we do well we made all our geometry again using displacement maps so we created our cone mask we created our rounded square and then the rounded square with margin just to solve that issue of clipping which again we can make the margin smaller if we were to render because that we actually get more subdivisions because here we're only previewing one point six pixels here point two we already talked about all this so let's apply our displacement this is where we left off we have our geometry and now the question is it has the shape of the cone but how do we make it look like a cone and the answer is it's pretty much the color of the surface how reflective it is controlling stuff like this is what makes it look like a cone so for example if we were to take our diffuse BS D F which is what you're seeing notice that again this is a plane meaning that there should be geometry here and there is but we just made a transparent so again this is what it's supposed to look like but we just did a bit of a trick to get rid of it but yes we're viewing to diffuse BS D F so if you if it if we were to change the color we can make it look more cone like but before we get into stuff like that you might notice or you might know that most cones have stripes and that's the thing I want to talk about now so we could make the whole thing orange but at least cones in the in the US they have a stripe here usually they even have two stripes so we need to make a mask for where we want stripes and where we want not stripes so where do we want white and where do we want orange basically so I guess we're doing one more tutorial about mask creation which is pretty much it's pretty much the whole idea behind procedural nodes is just making masks but um let's make our stripes so first approach you might think about is okay I want to make a stripe here and here along the cone well we can actually define those regions by how tall they are so if we were to take our geometry node look at the position this just outputs a vector for each point at each point it looks at what its position is and then it colors it accordingly if we were to separate by XYZ and look at the Z component which are the z axis which goes you know up as it goes up on the z axis it gets brighter you might think that this is an approach to do it because that defines different heights on the cone in fact if we were to do something like a I guess we could just go directly to a color ramp node we set this to constant you can see we're already defining what this is gonna look like right we can just slide across the cone this is one approach but there is a major issue with this and that is remember we made all these parameters that we want to be able to control our cone with one of them is cone Heights one of them is cone height and if we were to change how tall this thing is the strike doesn't really move with it it's not it is procedural what we did but it's not really a smart approach it's kind of like dependent on a certain size where we want everything to be independent of each other and just worked you know just work in unison so maybe dependent is the word I'm looking for so we're not going to be using this approach instead we're gonna be doing a similar thing to what we did you know the other time with the cone which was on the disabled displacement it was creating a like radial gradient which uses this like length operation using our texture coordinates we already talked about this and the nice thing about this is it kind of in some sense deforms with our geometry a bit more and even if not it's just it's just a nicer way to work so we're gonna be doing something like this so you might think oh we can use this length thing and in fact we can't why why well it's because of the same issue as before where we now have this height component that's kind of controlled by these parameters so we need to make it independent of that so how do we want to do this well a nice way to do this is we're gonna separate X Y Z and combine X Y Z so we have a node to break our vector and a node to create our vector so let's take our texture coordinates put it in here let's have a length in here and then I'm gonna connect let's say X to X Y to Y & Z to Z okay so what have we done here well basically there is no difference between this chain right just going along here and going along here because separating and combining and doing nothing in between means nothing happens so here's what it looks like before after it's essentially the same thing but if we want to make it independent of displacement in other words independent of the z axis all we have to do is cut sever this connection so now it's still calculating the length but it's calculating two-dimensional length as if we never actually displace this upwards so this is the useful thing so you can see that when we may our plane have no displacement these are equivalent but the moment the moment that we add in displacement in other words we add in some variation on Z you can see that now there is actually a pretty big difference and since this is independent of displacement we can now make our stripes in a way that kind of works better with the procedural approach so I'm thinking we do the same approach as before we're just gonna use a color ramp we're gonna set it to constant so we have these nice sharp fall offs and then all we really need to do is kind of define the area of our stripes okay so I'm thinking we start off with like a stripe here which means that we should bring down the Y I always get these mixed up I guess you could do it either way you could bring this I guess you can't do it either way you do need to bring this down so I'm gonna keep bringing it down until we're at the top area of our stripe so I'm just gonna pick something like that maybe but of course we don't want imagine the white area is our stripe we don't want this entire thing to be the stripe so we just click Add which will add another black handle and then we just bring it to the other side which will give us the thickness or the width or the size of our stripe so we're just gonna be able to control that and then let's click plus again which will give us a white handle we bring it to the other side and this is how we make our second stripe you can just continue and you can make as many stripes as you want using this method but you can see how this idea of using a color ramp is actually fairly similar to the idea of using a RGB curves where it is procedural we do have complete control but it's not in the sense of like value nodes like we need to manipulate the Sun note itself and pull the handles there's a way to do it like nice and mathematically with the value nodes and the math nodes we're not going to do that this is like the fastest approach to do it so I'm just going to be pulling around these until I'm happy with the positioning of our stripes something like this maybe and again like we talked about and this is the key idea of part three of procedural it's independent of displacement so let's make this a mask let's just for now use it as our diffuse diffuse psdf color meaning it's going to have inherit this as the color so it's gonna be black wherever there isn't stripes white where there are stripes if we were to now disable displacement you can see this is what it looks like because it's independent of Z it's just kind of like projected down to the XY plane with displacement with displacement and the key idea is as we bring down our scale meaning the strength of our displacement you can see that these stripes kind of move with the cone right that's that's the key idea here and if we were to manipulate our cone height you can see that these stripes stretch with it of course they become longer because that's the only way to do it where they maintain the same like ratio of height up the cone hopefully all this makes sense again key idea these stripes move with the cone whereas the approach with the just this length without the getting rid of the z-component doesn't do that okay so now we've isolated our stripes and I'm thinking for now just to make it look a bit nicer we can take this color ramp which basically outputs either black or white exactly because we set it to constant there is no fall-off like there is with ease right it's just like that what we can do is we can use this with a mix RGB node so it's gonna process through this before it gets to color we're gonna use this as the factor and we can say that the color one should be white I believe no color one should be orange so this is the color of our cone and color two should be you know white and basically you can pick whatever you want for this so I'm just gonna use some colors for now we can change these later just so we can see what we're working with and now what I want to do is make these stripes a bit more interesting yes they follow our you know geometry yes they're in the correct position but in some sense they're like too perfect and if you look at real cones there's a bit of distortion it's not like a perfect line so I'm gonna tell you how to do that because it's a nice trick so if you're thinking about how do I kind of distort these stripes well we can either like mess around with color ramps and do some complicated math that seems like a lot of work what if instead we do it before we reach this step we actually manipulate the texture coordinates to begin with we manipulate these and then as it goes through it just propagates that change to make the distorted stripes that would make a lot more sense and in general messing with texture coordinates is a much smarter approach than messing with you know whatever happens afterwards so we're gonna stick with the purple socket area so here's the trick what we're gonna do is we're gonna add in a noise texture again this is procedural and what we're gonna do is we are going to not enable caps lock we're gonna do a vector math node and add these together you can use factory color there's a bit of a difference but I don't think we're gonna go into it in this tutorial what this is gonna do you can see what this is doing is it's you know distorting distorting our texture coordinates meaning it's making our stripes like heavily heavily you know in the wrong place but they are wavy and the idea is we took our texture coordinates and added we added just a bit of randomness or noise texture whatever you want to call this and we can actually control this to get different like weird stuff happening to our stripes okay so it's kind of the right idea but our stripes have now moved far away from where they're supposed to be why here's the here's the key idea of this part noise texture what it does if we view it is it gives every point on our cone a value between zero and one there's an algorithm to choose what that is but that's what a noise texture does every point gets some value between zero and one that's effectively kind of random to us that means on average if you do this over infinitely many points on average we're adding 0.5 because if it's between 0 and 1 some valleys are gonna be small some of them are gonna be big and overall if it's a uniform distribution on average you're adding 0.5 so halfway in between on x y&z so in every axis you're on average adding 0.5 that means that when we look at this addition and let's actually view the whole thing that means that on average the whole thing is shifted by the vector point 5 point 5 point 5 and you already know about like translation and all this because we've been using a not in this group node but in this one we've been using like the add vector math all the time just to shift our coordinates right so that this is what's happening it's shifting our coordinate system by 0.5 point five point five on so to correct for this what do you do well if you want to get rid of that point five point five point five you add or subtract but we're gonna go with add negative 0.5 on XYZ boom now you can see our stripes are somewhat in the right place and in fact they are but even if we distort this they kinda stay centered on that area so we're closer to what we want we're not really there but we're closer and this little node group right here this kind of texture coordinates add noise you add noise and then you add this correction term which shifts everything back this is a famous trick in blender for blurring it's fake but fake blurring textures so if we were to make the scale something like a thousand effectively what this does is it takes our two stripes and just blurs them that's the idea and it only works when you pick a very large number for the scale this is close to what we want but really what we need is to have more fine control and just distort the border not this entire thing to blur we don't want this so in other words we kind of want to control the strength of this effect so if you're following so far good because this is a complicated idea if we want to control the strength of this effect let me try duplicating that again what I'm gonna do is before this reaches the addition so before we include this to our texture coordinates let's affect two strengths of it so I'm gonna put it through a vector math node set to scale in other words this number this scale value is gonna be the strength of our um noise and let's plug that in here so this time it's being processed through a scale and right now it's set to one which means that nothing has changed we're multiplying by one nothing's different but if we were to change this value you can see that different stuff happens and we're getting the same issue with shifting right now it's going up the cone and the reason is again we do have our correction term but that is dependent on what we do to our noise before it was going from zero to one so on average we have to shift back by negative 0.5 on XYZ if we were to make this a different value than our correction term also changes so that means we need another scale node we're gonna plug that in here we're going to use minus 0.5 that's our correction vector and scale it by the same amount so let's add a value note plug it in here so this is the strength of our noise and this is the strength of our correction term if our noise is half a strong point five our correction term only needs to be half as strong doesn't need to overshoot and now you can see that we can drag this slider everything stays centered and if we get pretty close to zero you can see that we keep our distortion but everything stays centered because our correction term is correct and we actually have even more control over this because we can still affect the size of our noise so if we were to make this like 50 everything stays in the right place it's just you know more distorted we could add detail to add like a bunch of sharp edges and all this and that's the main idea so what I'm gonna do is since we have another value note I'm gonna add it to our collection of parameters this one we can call I mean what is it it's essentially a stripe Distortion maybe we can just call it stripe since I not using any other parameters for our stripes I don't think again you can mess with this color ramp so that you know maybe we should add one more parameter like for example what we can do is we could do a math add and you can think of this as just shifting so if we were to make this a bit bigger than zero we're shifting it up and down the cone and and it actually will stick regardless of displacement for the same reason as before so let's actually add that in so this one this one I'm gonna set to zero by default we can call this one stripe and by default that's using zero zero one because you already named something stripe and for this one we can call this one we can call stripe Distortion so we have like pretty much a parameter for everything we could ever want right here so stripe how how translated do you want it stripe Distortion how distorted do you want it and again there is a purpose for this it's kind of like when you look at cones they are a tiny bit distorted I swear the lines aren't straight but even if they are this is a valuable lesson to learn so I'm going to keep this very subtle something like point O to see what that looks like that looks interesting it's much better than a straight line maybe 0.01 just so there's a tiny tiny bit of variation okay so now essentially what we've done is we've created our masks that we can distort we can shift and just to keep it interesting again this is what it looks like without the displacement because again we're just kind of projecting to the XY plane since we made it independent there is no Z we made it independent of Z but we can actually visualize what all the nodes we've added do so stripe is gonna shift it up and down which means it's gonna make it bigger and smaller bigger and smaller so let's see that whoops made it too big let's try that again so you can see now these are just kind of shrinking but the ratio of like widths stays the same so that's the idea there and then stripe distortion will just kind of distort it on this plane and then bring it up with displacement is the idea okay so now let's visualize this whole thing and and I like how it actually keeps that transparent boundary that we made let's look at this again there we go and something that might be interesting just before we wrap up part three as I'm gonna add one more parameter for the strength of our displacement so I'm just gonna call this one displacement and this is something we generally want to keep between zero and one because we've already done all our like scaling and everything before we reach the height of the displacement node so no need to do it within there so what this does is it lets us actually flatten our displacement and visualize what happens as we create our cone and I do like the idea of also having this effect the color so let's also do another mix RGB before it reaches our diffuse be SDF this will be the first color white will be our second color and our factor R factor whoops will be our displacement if I can even see that such a small thing and I guess we should have these flipped it looks like I think let's see I think I flipped the wrong ones this should be here okay so what does this mean this means that when it's one we have pretty much of what we made but as we go to zero it will flatten and turn white I guess it's not really doing that because we have the wrong color so let's make that saturation zero okay so again this is just a cool way to visualize it's in the tutorial intros well in the beginning you saw this animation okay and then we also want this to affect the transparency so we want there to be no transparency when when it's at no displacement and I didn't really think ahead so let's just try things and see what works so let's try something like that maybe a subtract and clamp nope that is absolutely not doing it you know what I can think about this later it's not that important it's obvious but when you're on the spot making a tutorial let me tell you it gets complicated so now we have a nice maybe displacement isn't a good way to describe it maybe transition is a better way because we're also affecting color so now we can also you know do that thing so there you go that that's the that's how you add stripes I guess it's a good idea to somewhat clean up this mess you know what I say when I whenever there's too much going on just throw it in a node group so that's what we're gonna do we we just want to make sure all our parameters are exposed so we can control them outside of the group again it is a shame that the color ramp node has to go inside the group but oh well so let's just get all of that control G to put it in a group right there and let's clean it up just a bit cool so now we have all our parameters going into the striped mask let me get rid of that the actually I guess this isn't the it is the strike mask we have that we have the this thing the cone mask rounded square margin square you can clean it up on your own time this is just a demo but um yeah okay so we've made this much more procedural we've added in the last mask we need and then the rest of this tutorial which is not this one but the next one part four we're going to be talking about how to make this just to look a bit better so yes we could like reshape our cone using some of these parameters like for example I feel like our cone isn't quite tall enough so we can make our base height like 0.15 just to make it a bit taller we could do stuff like that but I want to talk about how to make it reflective in the right areas how to add dirt using ambient occlusion stuff like this but yeah there you go part three of procedural thank you for watching okay so we're at the end of the tutorial which means it's time for the patreon pitch don't don't leave yeah I do have something to say if you like these tutorials and want to support me making tutorials and more importantly maybe get certain benefits like exclusive tutorials discord access behind the scenes access tutorial files stuff like this do check out the patreon this is the best way to keep this channel going it's actually the most reliable revenue stream and all this patreon is where you want to go if you like everything I do and you want to get some behind the scenes in all this and feel like I forgot the rest of my pitch that's generally the idea but either way I hope you enjoyed this free tutorial and let's move on to part 4 when I release it okay so I'm in this weird position where I just woke up saw of this voice that's like 10 times deeper than it usually as I imagined that as we progress through part 4 and this is the finale of video cone my voice is gonna go back to its normal thing but for now just enjoy so where did we leave off by the way if I keep looking to the side dual monitor setup now we're rising up okay so where did we leave off well we had this node network that I cleaned up just a bit because this was looking like a a warzone or something even I mean these node groups are a bit cleaner I guess inside oh never mind never mind this is a disaster all the way through but um we left off with I think we have all the geometry of the cone and all the masks that we need namely we have our stripe mask we have our what's this it's probably our cone mask which you can see without a displacement so we have our you know our cone mask and that punch and mask which some people said you could do with the RGB curves and you'd be right but this gives us more control outside of that RGB curves note so that's why I did it and also because I just didn't think of it here's our rounded square and the one with the margin okay we've gone over this a thousand times and then we just I do like seeing it flattened and then we just kind of colored it a bit and called it done so you might be thinking what is part four four I mean we have the whole shape of it and you know what what's left to do what's left to do is just to make this look just a bit more realistic I'm not gonna really take it all the way there but if this is our starting point and this is a zero I can take us up to like a six out of ten on realism so step one is this defuse be SDF more like diffuse BST garbage we don't want it instead we're gonna be using a principle B SDF node which is kind of like diffuse B SDF on like millions of steroids right this is better in every way and so I mean it takes longer to calculate I imagine but we're just gonna connect this to the base color and this to our mix shader' so effectively we've just replaced our diffuse with the principle B SDF which gives us a lot more control which is a good thing but it also means we need to do a lot more work so first of all you see this thing is super super shiny and that might be good depending on what you want your cone to look like but that is determined by the roughness how rough is your surface so at zero it's kind of reflective almost like a mirror you can see our HDRI if you look kind of closely and then at one very diffuse and that's what the diffuse psdf generally looks like so instead of just picking a number for this I want to have different roughnesses for different areas namely I want a roughness of let's say I don't know point seven point eight wherever we have our main cone and then a roughness that's a bit higher wherever wherever we have our stripes because I want those to be worn out of it or maybe I want the opposite I don't know so to control this what I'm gonna do is I'm gonna add in a color ramp nut dude my voice is booming today it's booming and this is gonna let us control both the black areas and the white areas so with the black areas of the cone we just select a color and you see will only affect that area I'm gonna go with something like we could just put it in here let's do 0.75 and then for the white areas I think I want the worn out look meaning a very large roughness close sort of one so I think I'm just gonna keep it out one you could also do the reverse where you want those stripes nice and reflective so I take this plug it into roughness and view okay so now we have this it's still a bit shiny but we can't like really see reflections or anything and notice that those stripes aren't like shiny at all okay so that is a good start I'm thinking also the colour is a bit off but it really depends on the kind of cone you're going for like in one of my animations I did go from like a reddish cone to an orange cone it's hard to tell what's right maybe it's a bit too punchy with the saturation so like something like 0.9 would be good but now it's looking a bit too it's really personal preference okay we can always change that later so now we have our base color determined we have our roughness determined and there's a bunch of more you know parameters that we can mess with most of them aren't actually relevant like subsurface you know whites not really leaking through our cone I guess it does have a bit of a subsurface property in fact we're not gonna mess with it it's not metallic its specular you can mess with to get interesting results and then most of these are just not relevant in any capacity unless you want the your cone to have a clear coat like it's freshly shined which will give it that super shiny effect so since there's not much we can mess with here what I do want to add is maybe some dirt wear and tear and we can do that all we can do that for the color so some of its going to be brown and gross and grungy and we can do a bit of that on the normal map so it actually has some changes in like a lighting interaction so I'm thinking let's do the dirt so I'm gonna mix this again so it's going through three mix nodes the first ones to determine you know the color of the cone and the stripes this one's gonna be our dirt and this one was just for the transition slider we made before that again flattens everything shows us where it actually came from school so we're not gonna mess with that one but we are gonna mess with this one and we want there to be some some like dark brown or something like this and we'll take that factor all the way up so right now it's not really mixing in a nice way because it's averaging them everywhere right we're not saying put dirt here in not here it's just everywhere and that's what it would look like so let's view the entire thing so that actually looks pretty cool kind of like a metal I don't know hard surface cone either way yeah that does that that looks that looks super cool either way what we're gonna do is we're gonna add a noise texture to define where we want dirt and not dirt so we can plug that into the factor and alrighty you see that it doesn't look as bad but the dirt is super super subtle and one thing to kind of wrap your head around is in this mix node the dirt being this like brownish black stuff is in the second socket meaning it's in the foreground meaning it's gonna show up wherever the factor is closer to one where it wherever it's closer to white okay so keep that in mind what we're gonna do is we're gonna add in a color ramp node we're just gonna add a bit of contrast here a bit of contrast and maybe I'm gonna bring this up bring this down just so there isn't such a large gradient from one to the other by the way this isn't even connected there we go now you can see now we can actually see splotches of dirt and if you wanted it to be more you know bit more of a fall-off you could just bring these handles further apart but now we can actually see our dirt and the our dirt looks like trash so let's make it look better first of all I like dirt with a good amount of detail you might want to mud look in which case you keep something like this but if you want dirt that has like you know you can see the individual grains detail maximum value which is 16 and roughness will also change the way it looks so this will be very muddy and this will be very fine and detailed when you bring it close to one so you just want to decide what the quality of your dirt is gonna look like for me that's this and then finally you can decide on the scale of your dirt so make sure if your scales too small you're not gonna see any features but in some sense it does look a bit more realistic because as you go upwards you're gonna see like too many too many splotches going on like here there's quite a bit going on so maybe like six I don't know we do we can always play with this later completely procedural and we can make a nice parameter for this okay so now we have our dirt and it's showing up in some air and not in others and it already looks a bit better but you know what I was gonna say let's make a better mask for this and we will but first I guess let's play a bit more with the lighting interactions with this dirt so one thing I'm thinking is wherever there's dirt this should have a roughness of very close to one right it's wherever there's dirt it should not be shiny because you know you you put this layer of dirt over it you understand so remember we made this whole set up that goes into our roughness where something closer to one is more rough less shiny so what we can do is remember our dirt is wherever it's closer to one if we set this up correctly which means what we can do roughly get it as we can add we can add this color ramp which will add nothing wherever there is in dirt meaning it won't change the roughness and wherever there is dirt it will add some making it a bit rougher at least that's what it should look like yes and already you can see that some of this like reflection is broken up by the dirt giving it some surface imperfections giving it some nice detail and all of this works whenever we change our noise it all just works together okay so I'm thinking how do we improve this mask well where does dirt accumulate naturally well think about it where do you need to when you're showering where do you need to clean your armpits your you know also in between your fingers all this I don't know if you're in the shower going like this but it basically what I'm saying is dirt accumulates increases which makes sense I guess in some sense if you have a big flat table it accumulates on the surface because you know that's where it would fall but generally it accumulates and creases because otherwise it'd fall off your body so we can do the same thing with the cone we want a lot of dirt along this crease definitely a lot here imagine how much dirt would be captured maybe some near the floor and there's a way to do this you could either go with the naive approach which actually is you know it's not that naive ease the geometry note look for pointyness which will and it's hard to tell because pointyness it's um it doesn't give you a nice of black and white 0 to 0 or 1 mask it you have to use a color ramp to actually see the variation but pointyness shows where our model is pointy which is kind of like a crease but it also includes like corners and stuff like this that are pointing outwards so this is one approach what I like and since we're using cycles what we're gonna be using is ambient occlusion ambient occlusion what does that mean well remember ambient occlusion is basically where an object is like self shadowing where does an object cast shadows on itself well definitely wherever there's creases like my fingers are making so many shadows here you wouldn't believe my armpit would have a shadow because you know my shoulders obstructing light and all this ambient occlusion it looks like this and you can kind of tell it's generally white but a bit darker along the creases and again notice that it looks super broken on our like base and again this is this kind of thing is solved with more subdivisions or you again you could do a nice fall-off for the base somebody sent me a bone file where they did this I'm like sure but it was a good tip we're not doing that for this one but it's accumulating wherever we have these creases and as we make our subdivisions you know more dense it will be less of an issue it's good but we could use a bit more oomph it's not it's not dark enough where it should be so I'm gonna add in a math node and you might think oh he's gonna set it to multiply pick a big number it kind of works but really this is kind of like upping the contrast it's not what we want so instead I can't remember if I showed you this trick but using power is a much much better kind of way to go because ambient occlusion will output a black and white mask zero to one you know one where there isn't ambient occlusion zero where there is power what it does is if you go to small numbers like you know 0.5 for square root and all this will give us a certain kind of distribution which isn't what we want but the other kind x squared X cubed x to the power of 4 will give us a nice sharpness so let me show you what I mean so this is one nothing has changed x squared power of 2 you can see it starting to work cubed quartic quintic now you're really seeing what it's doing it's really like preserving you know the differences but it's it's giving us a nice I don't want to say contrast cuz that's what we did said before it's kind of more like gamma and some sense but you can see it's really darkening those areas with a nice fall off so this area which we said would have a ton of dirt does and same with the you know base over here has a ton while the main part of the cone not so much so this is what we want and we can always change this value later so again remember we want dirt wherever it's white and if we were to multiply this these two together so include RM be an inclusion that's almost what we want but not really because we're saying keep our masks keep our dirt wherever there's a crease but right now it's black so we want to invert this so it's white meaning preserve this dirt at the creases so you could either try and I've had issues with this in the past an invert node which will invert right but I'm gonna go with the mathematically stable version and let me show you how to do that so let's clamp that here's what I'm gonna do so right now we have an interval of 0 to 1 and we want to reverse it 1 to 0 this will flip it the way you do this is if you have 0 to 1 what you can do is multiply multiply by negative 1 so 0 to 1 becomes negative 1 to 0 so think about it largest values 1 that'll get sent to negative 1 smallest values 0 that stays the same so the interval flips negative 1 to 0 and now we just need to shift that up to 0 to 1 which you can do by adding by adding 1 now ideally this does the same thing as the invar node but let me tell you I've had issues with it so here's what we're you know keep and now that we can actually see what's going on so white is where we want you know our dirt we can change this exponent to really you know pick what we want to happen here and you can still do the multiply approach but okay so we have this white is where we want dirt white is where we want dirt and then we just multiply these together so needs to intersect and at the same time boom so now we have our dirt but only in you know those areas so what do we do we plug this in to our factor for where we want the dirt color and and we also need to do the same thing for the roughness because it's not truly this where we have dirt but where we have our final multiplication so like this what does that look like okay it's a bit subtle but you can see that now there's no dirt on this surface and it's still behaving the same it's still working correctly okay now you might be thinking okay we've done it but the dirts not very visible and you'd be right and this is an easy fix so what are we gonna do well before we send our mm our dirt mask out you know work on our color work on our roughness and all this what we can do is multiply and I only want to multiply on the color because I'm happy with you know how it's interacting with roughness so I'm just gonna multiply on this chain and use something like five that's a bit much three and you know what you know what I'm thinking let the user decide make that another parameter let's call this dirt even though we have many more ways to control the dirt like the power from before for now we'll call this one dirt and we'll put that there so zero means no dirt you know four means a lot of dirt 40 means Mucho dirt okay I'm thinking something like four I don't know and then another thing we can do is if you're thinking oh yeah we I like the ambient occlusion I like the idea but it's kind of exposing or this area is kind of exposed to no dirt you want there to be at least a bit of dirt in that area but still maintain most of it at the base and at the tip what you can do what you can do is right now this ambient occlusion set up is really just saying keep it here but not here so what you can do is do another addition and this will add everywhere this will add everywhere you could add some value so point five will make it you know have a bit of dirt everywhere Oh point one just a tiny bit of dirt I'm thinking this should also be an exposed parameter and we'll call this this is the type of thing people usually call mid-level for a you know complicated not that complicated reason just think about it as this isn't really giving us that much info about the dirt but it's saying what should be the base level so maybe dirt base would be a better name for this but that's fine okay so what's a view so when our dirt base is a large value you can see kind of kind of goes a bit too hard zero same thing as before let's try like a point - yeah so now we have the subtle dirt creeping up it's not too much and we can make our dirt less intense with color hmm I'm thinking that right now we have too much going on let's bring down our exponent because again this is what controls that quality and you're gonna notice that there's some weird stretching going on at the base this is unavoidable unless again you make some fall-off with a rounded square but for now we will live with it you can always play with this later and also change the color of the dirt but we can now have dirt and be happy about it okay so now how do we take it to the next level we have our color interaction we have our roughness interaction do we have normal interaction no so let's add a bump note this will convert height maps into normal Maps essentially and we want bump wherever there's dirt right we want there to be a bit of elevation wherever there's dirt fine and maybe we also want a bit of elevation on the stripes so they're not really they're not really like part of the cone but they're painted on and there's this thin layer paint that's a bit higher than the cone okay let's do that so first of all how do we make a dirt you know how do we do this with dirt well first of all let's see I already forgot which of these we want so this one is the one that doesn't have ambient occlusion factor or no it does because of our addition it's kind of subtle and then this one's the one we manipulated okay so what I'm gonna do is I'm gonna plug in this one can't even see what I'm doing we're gonna plug it in here and then just convert it to height since it we put it in the wrong socket let's see what that looks like you're gonna notice there's definitely some normals going on here I'm just gonna let it render a bit but it's a bit too intense it kind of looks like the cone is made out of like tree bark or something because there's a very thin layer of dirt a very thin layer of dirt like almost everywhere so there's gonna be that like normal stuff everywhere so what I'm gonna do is I'm also gonna use this for the strength which would make it a bit better yes you can already see now our reflections are popping so before no reflections at all because we've and this isn't roughness this is literally making our surface rough for deforming it kind of in the normal sense right but when you include in strength that kind of takes care of most of this so we do still have a good amount of bump wherever there's dirt but not so much where it's very you know subtle okay awesome now let's also include our let's include our stripe mask which is already conveniently white where there is stripes so that's saying there's height where there are stripes and there isn't hide other wise so all we need to do is a bit of math addition for I'm gonna do only the height I'm not gonna have this one manipulate strength or anything and we just plug this in here so now it's adding these two so now you can see this is included so there's definitely gonna be quite a bit of height there and let's clean this up and visualize boom this is a very dirty cone let me get me on the main screen a very dirty cone I love this dual monitor setup okay cool so let's do some final touches I'm thinking colors still a bit off I don't know why just feels wrong I feel like this traditional orange e cone color maybe fits a bit better somewhere in between like that cool and you might be thinking okay this is a pretty realistic cone it could be better well let me remind you in case you have forgotten that this is a plane so we're doing pretty prude we're doing pretty well considering that this isn't an actual cone I'm thinking these stripes are bit off we could change the stripe color again we determined our stripe versus cone color in dis node so we can make those darker or brighter maybe even make them a tiny bit yellow tiny bit yellow I like the look of that and now something I want to do this is just because I like doing it this isn't actually necessary for the cone so remember our transition slider controlled this node right here this is the final color change that will make everything white if our transition is set to 0 1 something like that and it's also affecting our displacement as you can see it's feeding into the strength I want it I want it to be able to do that thing where you know we're transitioning between a plane and a cone but you can see it's not really doing it very well because it doesn't really handle this transparency and you can see all this dirt and stuff we've just added is still incorporated on this plane and I think this is because of roughness right I worked with the diffuse but that but because we're using a principle VSD effort doesn't do it anymore so let's actually take care of that so we don't need this we'll just have this feed directly in so this is what it looks like let's make our value 1 again so it should look the same our cone right now should look the same but we want it to have a final choice of slamming it so what we're gonna do is at the very end we've done all of this we've done our parameters feed into masks feed into you know color related stuff feed into BST offs after all this we're gonna add in a mix shader' we're gonna mix this with a diffuse B SDF so notice now once we do this no transparency or anything once we set factor to 1 because that's after the fact so our transparency is like back here in this mix trader after that mix right so before after gets rid of the transparency so we want this and we'll plug this in as the factor we might need to invert it need to think about that and it's already connected to displacement so we're there and instead of inverting I believe if we just flip these that should do it so let's see let's see what we got let's see what we get I'm doing a save here we go boys so when transition is 1 meaning a hundred percent have the cone when it's 0 have the plane why is this working well because it's controlling both the displacement and the final B SDF results so here's what it looks like so now you can see this I'm sorry that it's super laggy it's because I'm recording and have cycles at the same time so we'll do it in steps we'll do it in steps so 0 point two you can see the cones starting to rise there's a bit of roughness interaction point for the planes becoming a bit transparent 0.6 now we're really starting to get a bit of color point eight and I guess the color does show up pretty late into the process and I guess that's just how stuff is mixed together so if you want more control over this you could have lost my notes if you want more control over this you can do it back in the color level before before the B SDF level but I do like the way this looks I love adding a transition slider just being like oh you thought it was like an average-looking cone it's alright no it's a plane so there you go I think we've taken care of everything we would want so again we replaced our diffuse for a principle we're controlling the color or the roughness the normal I feel like that's that really well what you could do is you could I mean actually you can't what I was gonna say is you could use this dirt to add a bit of displacement right displacement instead of bump but what you have to realize is our displacement is calculated first to deform the geometry and then and then we did the dirt stuff right because this noise would not wrap around this mesh like this until displacement was enabled so there's kind of like an order of operations my voice I feel like an maintained it's boom eNOS throughout the whole thing so there you go I've now showed you how to make a cone a cone out of a plane I don't know why it's useful but it you did learn quite a bit remember we have these parameters for pretty much everything a bit of a highlight reel we we have our general dirt basically saying you know well what about the general area that isn't a super high on ambient occlusion we have our dirt which is kind of just controlling the color we have our stripe which is the distortion I believe unless it's something else oh no this is the stripe offset so where do you want it on the cone we have our stripe distortion which is Distortion we have our cone height which again plays nicely with everything this is the awesome thing about it we can now make any kind of cone that can be made out of these parameters we have our roundness which will break the cone if you set it to valleys that don't work so you can make it a sharp rancor cone side lengths thick cone base height tall cone now you can really see stuff starting to break punch in is the hole depth and margin is just for like rendering stuff so we have all these parameters and and the nice thing about this is since it's all working with these texture coordinates I believe unless I've forgotten something I believe what we should be able to do is literally just move our cone along the plane so you can see what's happening here we're just shifting our cone along the plane we could also rotate the cone so this is kind of like whoops I wanted a vector rotate node this is kind of just like moving your object once you've modeled it yeah so we're rotating our cone you could really use use it like a three-dimensional object and in fact since we made this you can make a ton of cones on the single point all this but there you go I think I think this is pretty good I'm gonna make this project file available to all the patrons above I think it's five dollars gives you the project files and I'll also probably give the cone I made originally because there might be some variations this one might even be better than the one I made originally because I could talk it out and everything but um yeah let me let me put me on the main screen there you go you procedural what a what a what a wave part 1 part 2 part 3 part 4 you learned how to make everything and I might do more advanced shader node tutorials if people are into it and I like the idea so I'll do ideas more interesting than cones maybe we'll look into vector displacement I don't know but um yeah
Info
Channel: CGMatter
Views: 110,827
Rating: undefined out of 5
Keywords: blender, tutorial, course, procedural, nodes, nodevember, mayterial, free, shader, material, cg, 3d, vfx, animation, cgi
Id: BqijDcTdfZ8
Channel Id: undefined
Length: 107min 57sec (6477 seconds)
Published: Thu Jun 04 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.