Blender Procedural Nodes [LEVEL 1 - FULL COURSE]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys welcome back to another default cube cg matter tutorial and what this video is is it's basically a merger a merge of the last seven blender procedural node tutorials into just one video that I consider level one so everything here is pretty much everything before texture coordinates and this videos for anybody who just kind of wants to watch the whole thing in one swing and just do one after another after another which kind of makes sense because I made them in a certain order so that they flow together so this is the best way to watch all the level 1 content and before we start you know this whole video I just want to mention two things first of all I'm just literally merging these videos one after another after another so there's gonna be a tiny drop in quality nothing noticeable still be 1080p and everything because after encode and all that and that also means that each one has an intro and an outro and those are going to be preserved so hopefully that's not too annoying if it is you can always skip through the video but I recommend watching the whole thing and second of all I just want to say this is a free course I mean I'm gonna keep making it this is a level 1 free so if you want to support or donate or whatever patreon is the best way to do that and again it's a free course so at your discretion it's up to you or there's also an email in the UM in the description if you want to donate or anything so I'm just saying that because it's free I wouldn't be doing that otherwise and you're also gonna see those patreon plugs at the end of each tutorial but again free course best on on Blender procedural notes that I've seen so I'm really proud of this and I hope you enjoy the course hey guys welcome back to another default cube cg matter tutorial and as the title probably shows we have started the procedural node series so this is episode 1 and we're just gonna go over some getting started stuff so don't expect a lot of math and a lot of node stuff right off the bat I'm just gonna show you what procedural even means and you know how you kind of navigate blender to even start using nodes so if I can get this over here you can see that I want to start off with some reference material of just what is possible so I'm on the Twitter of Simon Tom's Simon Tom's he's pretty much a legend with this kind of stuff so let me show you some results that are possible not necessarily that we can make but that are definitely possible so you can see that first of all what you have to understand is all these are just fears in blender and basically everything you're seeing just a bunch of math he threw at this to get these results so this is like top of the line stuff this is just what is possible and you can see that all this is animated as well which we're gonna get into so that's part of what it means to be procedural that you can animate everything about it but these results are just crazy so big shout out to him he doesn't need a shout out everybody knows him so basically I think we're gonna do some of these at least like the theory if some of these we're not gonna make the results this good but like doing stuff like gas and atmosphere and all that we're definitely gonna do and then also this hedge maze I think we cannot work our way to the L labyrinth as well so these are just some of the crazy results that are possible but yeah so let's just talk about what procedural even means so here we have a normal blender scene with a plane and a truck outside without any material so this is just a black plane I mean it has a material but nothing's connected to it and normally what you're probably used to is using textures so for example I've this texture of a circle it's just a JPEG or a PNG and in this case I think it is a 1k texture we can check so we have a thousand by a thousand texture PNG etc has an alpha Channel doesn't matter so this is just a texture that you could probably make yourself or download online and when we take this we can plug it in to our surface and again you don't have to understand what any of this means I'm just talking over some very very general without knowing anything theory so basically we have a node here a node here called circle texture which is containing our texture we plugged it into here and now you see it on the plane and it's a circle but the issue is we can't really control anything about it because we just took an image and slapped it on there well not only can we not control it but when we zoom in far enough you can see that the circle is actually jagged why because this picture has a limited resolution and the more we zoom in the more apparent that is so it seems like a limitation of textures is you just get what you get and that means you're probably gonna have to buy some textures or you're gonna have to make a bunch of them just so you can cover every scenario and then also the resolution matters then you're taking up space on your hard drive especially if you go high resolution on the other hand on the other hand we have this note that I made and if we look into this note it's actually a bunch of notes it turns out that this thing I made is actually a group of notes don't worry about it when I take this and plug it in it also gives us a circle it almost looks exactly the same except you can see when i zoom in the curvature doesn't look jagged at all it just keeps going and that's because this circle is not made with any textures at all so mathematical so not only does this not have any resolution issues because it has infinite resolution but you can see that this node also has a slider that I made what does it do well it just controls the size of the circle and that's like not not that big of a deal like technically you can take a circle texture and scale it so you can do that kind of operation but you could add tons of more controls that let you do other stuff with more complicated shapes so really what we have is a procedural approach and a texture approach and once we get into more sophisticated stuff you know you could just take this node and do a bunch of stuff with it so let's say we duplicated it duplicated it again don't worry about any of all of what this means now I'm gonna view this one and make it a bit bigger and we can just combine these using some math so let's just take this one let's take this one do some subtraction or something and let's play around with the size of this and now you can see that with a very simple edit we have made a torus which is kind of like a 2d donut if you want to think about it that way and we can control the outer ring the inner ring and again this is procedural and you could again do this with textures but now we have a infinite resolution doughnut so you can see how this stuff kind of scales really quickly we went from a circle to a doughnut which it is a bit more complicated okay that's fine but what if we want to do something that's actually more sophisticated well there is room for that too you can see I made a node over here called a tiler node and if you look into this it's not that much it's amass node some other stuff don't worry about what it means but what we can use this for is let's put our circle in here and then we are gonna take this and plug this into this mystery vector socket that I haven't explained and now you can see we have a bunch of random circles and now we have many many more and this is completely procedural infinite detail on all these circles that we can zoom into and the best part is the best part is we can actually animate this kind of stuff and get different seed values and kind of control where we want the circles or you can fill everything in maybe make this a bit smaller so we have less of them and now you have if we make the circle that bigger now you have some kind of fancy floor texture so really you have a ton of control over this stuff so really when you think procedural think something that is basically does not have any Tetris that's the best way you want to think about procedural if it doesn't have textures and you can control it all mathematically it's procedural and the benefits are you're not taking up space on your hard drive and you have controls if you add controls and you have infinite resolution so that's just kind of the intro for what it is we're gonna be talking about and that let me start a new blender scene and I guess we shouldn't save this that's fine the only other thing I want to talk about is how we even get to the menu I was in before so I'm gonna assume you've never touched notes so we're really gonna start from the super super basics so luckily this is actually very simple because you can just over here we have our workspaces you have a layout modeling etc all we have to do is click shading and we're in this pretty much the same menu we were in before so that's pretty much the tutorial for that you can also by the way really what we're interested in is this window over here the 3d viewport we already had but this window is called the shader editor or sometimes just the node editor but we'll call it shader editor and if you don't want to go to the shading workspace you can just open up a new window like that you just drag that up and then we can select instead of 3d viewport we select shader editor and now you have pretty much the same thing but now it's in the layout workspace and you can also do this sideways so let's do it like that normally I'm just gonna be clicking a shading so that's how you get to the menu that I'm usually in the only other things we need to take care of before we get started talking about nodes and all that is some settings so go to edit preferences addons and i want to make sure that you are using a special addon called node wrangler so you just type it in it's going to be there and for you it's probably disabled if you haven't enabled it before make sure you enable this add-on we are going to be using it literally every tutorial and what it's going to let us do is a bunch of cool stuff so for example normally if you have a node a node and you know a branch between these we'll talk about what all that means the way you disconnect is you just pull it off and then you can connect like this and when you have a lot of nodes that takes a while so what node ring will lets you do something like that and then you can connect like this so it's kind of like shortcuts for these kinds of things and especially if you have two different nodes do you really want to do it like this and if you're zoomed out it's kind of hard to do that or would you rather just connect really quickly like this and disconnect this is just a faster way to work and there are a ton of other commands and things that node regular lets you do but I'm not sure if this one what I'm about to do if collapsing a node and hiding everything except what we're using is a node Wrangler feature but it might be but either way make sure you have no tangle or enabled and the other thing that you guys might care about is I think there is kind of a divide between people who like curved noodles and people who like straight ones and I'm just going to show you how to switch between those so again edit preferences this time it is in themes and then you go to node editor so this time not shader editor but node editor whatever same thing and we can control pretty much a lot of these things like what color it's going to be when it's highlighted etc if you see the bottom setting it says noodle Curt curving and you can change that so now if it's zero you have perfectly linear straight lines and I think a lot of people I think Simon Tom's even likes to work this way or you could do yeah I'm sorry about all the stuttering today or you could use something with a lot of curving which kind of gets ridiculous so I like to keep this at around four and really now that you know what procedural means you know how to get to this workspace or maybe just go to the shading workspace is the faster way to do it and you also know about the out on and everything I think you're ready to probably get started on the second tutorial where we actually talk about stuff that matters and we're just going to be talking about some super simple stuff like valley you color etc how to control those and generally how to work with nodes so there you go that is the first part of this tutorial hopefully you enjoyed it and again it's just a preview I know we didn't go over much but tomorrow I will come out with the second tutorial hopefully I'm not gonna rush it see you guys hey guys welcome back to another default cube CG matter tutorial and this is part 2 of the procedural note series and in the last video I said I'd be talking about values and like RGB and these are all just different kinds of nodes we'd be talking about and it turns out that that probably doesn't make too much sense because that is actually making and modifying a material where we probably don't already know what materials are at least I'm assuming you don't because I'm gonna assume that you know nothing to begin with and I actually already just recorded this tutorial it was very very good but I forgot to show my mouse cursor because OBS does not show it by default for me so I'm a bit mad but that is fine so hopefully let me make sure can I see the cursor yes okay so this time we are in business and I don't have blender open because you know whatever so we are going to be using version 2.8 one again if probably at some point in this series it's gonna transition to two point eight two which has some differences in some of the math nodes and all that which isn't important right now but I'm just letting you know so two point eight one let's make that fullscreen and can I still see my mouse it was such a good tutorial but this time I'll probably be able to say everything more clearly so yeah assuming you already saw the first tutorial because it's a series and it would make sense that you did you probably already have everything set up but I just want to make sure you have two things go to edit preferences add-ons and make sure that you have no tangle or installed again we already talked about this if you have no drink if you have no Durango or you're good in my book and then the only other thing we talked about is how to get the shader editor window which is where we're gonna be doing all our work and you can either do that again by opening up a window going to shader editor or what I like to do is just hitting this button shading workspace which gives us everything we need and that pretty much covers the first tutorial so I even watch it now okay so again like I said we're not going to be really tackling material creation because we need to talk about the material system which is this whole system and blender that kind of tells you what objects are do objects have materials what our materials made out of then it's just all these layers that go down and down and down so let's try to keep it simple to begin with so we have this default scene which has a default cube and that cube has a material you can see we already have nodes down here okay well how do we know this has a material well when we select our cube you're gonna see it says material over here and then our drop-down we already have a single material we can take this and give it a name it can be any name it can be it can be dumb name which isn't that creative I'm gonna go with I'm gonna go with first ever matte as in first ever material and this still represents the same material no matter what name we give it it's still that material so the way you want to think about this is we have an object being the cube and that cube has a material and it's called this and that material is effectively this node graph which means as you might expect if we change the instructions the node network that makes up the material it's gonna change the material and therefore look different on our cube it's pretty simple so again we don't know what any of this really is but you do see something called base color which has a white color and you might expect that we can change this and you see we turned it red and the whole ripple effect takes place the node network has changed which fundamentally changes the material itself which changes this cube we can duplicate this so now we have two cubes and we can change both of them well why is it changing both of them is it because it's a duplicate well what it is is is it that it's because both of these objects both these cubes which are separate objects you can see they have two different objects cubes 0 0 1 and cube in the outliner there are 2 different objects they both have the same material which means if we change the node Network it affects both of them but can we have two objects have different materials we can all we need to do is add more materials so that they can have different ones because right now if do you have two objects one material you kind of have no other option so how do we make a new material in our drop-down we only have one option to do this there are a bunch of ways but the easiest way to do this is you hit this button right here which is new material so now we have first ever matte to zero zero-one and first ever met I'm gonna give this another name like why do I need to record this again and you can see that now we have two different materials in our drop-down and they kind of look the same actually exactly the same like these node networks don't change and the reason for that is it's not a glitch blender is working fine it's because we duplicated the material when you create a new material we'll just pull from whatever material already exists and therefore they already have the same node networks but if we take this one this why do I need to record this material and change the color you can see now this cube is blue but why did this will not change well this cube when it's selected shows that we have why do I need to record this material and then this cube has a first ever matte material so there are different materials so if we want to edit this one we go to this one I change it to blue this one change it to yellow etc and of course at any time we can switch so with this one we can switch back to this so whatever you select from the drop-down will be the active material and it actually gets a bit more complicated than that because we've talked about different objects having different materials but can one object have multiple materials can it be both yellow and blue at the same time and that's where it gets a bit confusing and it actually has to do with something called material slots which is just another layer of abstraction because blender loves that and you can already see that in our shader editor we have something called slots so you might expect that we can do something with this by you know creating subtracting slots whatever so let's talk about that let me just delete this so right now we have a single object with two different choices and materials one is blue ones yellow etc but how do we actually have two different materials at the same time well I was kind of lying to you when I said that it's as simple as object has a material and that material is the node network because it's not that object has material object has a material slot it's a container that container has a material and you can have multiple slots and those all go to the object so it's kind of like you have a list of node networks our sense of the objects well how do you see these well luckily for us in the shader editor we don't only have her sorry the shading workspace we don't only have the shader editor and the 3d viewport we have this properties window which again is in the layout so if you pull up this window you still have this property so you're all good there but this properties window actually has a materials tab which has a lot of the same options so for example you see this is blue this is blue they're all linked together but we can take this and change it to red and you can see everything synched there and the names are synced etc but what you're gonna see is a material slot so this is a slot and inside the slot we have first ever material and we can pick different materials to be inside the slot and we can add different slots so now we have two slots and let's say for the second slot we want the other material now at this point you might think oh this kind of looks like a wire system so we have two different layers each with a different material why don't we bring this yellow one to the foreground and then you do that and you wonder why the cube is still red even though it's in the background and that's because slots are kind of confusing it's not what you'd expect it's not like a layer system where you can make something in the foreground and make it transparent so that both are seen at the same time what a slot is the way you want to think about it is a slot is a selection meaning that right now this slot which is in the second down the list this slot has the full cube selected this yellow one has none of it selected okay so what do we mean if we go into edit mode you're gonna see these three buttons appear it's not going to be an object mode you have to go to edit mode and I'm just gonna deselect everything with this material selected which again is the entire cube we're gonna click select which is so select by active material slot we click this and now the whole cube is selected what did it do basically selected every single face that had this material so I mean deselect everything now we're going to do to this yellow one select nothing happens because none of them are selected so what really the way Bunder really works is an object is of a bunch of faces and it's that each face of an object can only have one material but since say most objects have more than one face you can have a bunch of different faces with a bunch of different materials so one material per face but if you have more than one face you can have a variety of material so what do we mean so let's just select a face like this top one again all of them are red I'm gonna select this top one and you can see no matter what I select so I'm gonna suck this yellow no matter what face I select it's gonna automatically switch over so I'm gonna select a face then I'm gonna switch materials and you see it didn't actually turn it yellow what we have to do is once we have everything set up we click assign so now we have assigned a selection so now we have one object with multiple materials but again each face has one material as far as I know and if we go back into edit mode now if we select our yellow material and click select it's only gonna highlight the top face whereas this red one we click select it's going to do the other five and we can make this a bit more complicated so we can just select these three and do an assignment of our yellow so now half the cube is yellow half of its red etc and even from this properties window which is in the materials tab we can also again add more slots but also create new material so you don't necessarily have to do it here we can also do it over here so let's add a new one we'll call it um we don't have blue so let's make one blue and you can see the slot now has the blue material but nothing changed because it just duplicated our yellow material so blue yellow they look exactly the same so if we turn this to actually blue now you see that everything works out and let's say that we wanted a blue and yellow cube well what would we need to do well the blue can stay blue and the red needs to become yellow so with this material which again has the selection the selection of these three faces what we need to do is just switch this over to yellow so I think at this point we are starting or at least hopefully understanding the hierarchy we have we have an object is composed of faces and each face is basically a soul action represented by slots which are containers for materials and each slots gonna have a material which is a node network which when you say it out loud makes it sound pretty confusing and I guess I guess it is pretty confusing so I think you'd be right about that and really the rest of this series is the art of taking a material and making it into what we want so now that we know how the material system works it's all about actually messing around with these nodes so you know something more complicated than just taking the color and like switching it up I think we can do better than that this camera switching setup does quite something the only other thing I want to talk about hopefully I'm not forgetting anything by the way you can also do all this slot stuff we were talking about you can do it from here as you can see we have different slots and you can see it switches um if we go to slot 1 you see slot 1 is blue so toggles over to our blue material and then you know same thing for this so if we change this one to red we're now in slot 2 and it's gonna be red and everything's linked is what I'm trying to say the only other thing I want to go over is material deletion which is actually also a bit confusing so you might expect the way you do eat a material it's right next to create material you go to this X to unlink data block which is just digging into blenders data block system which is great but very confusing if you click this X you're gonna see that it removes the material but it's still in this list so first ever matte delete it's still there what's up with that and it has the zero next to it basically what it means is when you click the exit on the links the data block and what should happen is when you close your blender project assuming it's saved you close it and then you open it again only then will it actually be deleted and the zero basically means that nothing is using that material and you chose to do it and therefore it's gonna be gone when you restart your blender project you close it you open it and you know that can be a bit off-putting because you can't delete something even if we you know do it on all three we're basically jumping around over which one has the zero how do we actually delete something without restarting wonder the way we do it again it's all this stuff with datablocks so what we have to do is in this outliner window you can hit this button which right now is on view layer I think and what we can do is instead of that we can view the blunder file which is just a list of assets that make up your blender projects and now we're really getting to getting into this hierarchy stuff what you can do is in these assets you're gonna see sorry about the face hopping around it's automated what you can do is go to materials and you see we have three materials which makes sense we open it up and we have our three materials if you right-click one we can do all this stuff without linking whatever but you can just flat-out delete it and you can see it's gone from here and our drop-down only as two so let's just keep going with our deletion so just right-click delete and now we have nothing in our drop-down sorry about the voice so yeah but that's how you actually delete something without restarting the project and then to create new stuff you can see it kind of has some kind of white sand default material it must because clearly have no material selected so it's defaulting to something we can create a new material which will give us this simple node Network to begin with and then we just modify it in the same way as before so that is pretty much the essence of everything you need to know you can see that it only showed up on these three faces because even though we deleted the material the slots the material slot still exists so if we want to have everything be red we can just do eat the first slot which is gonna make everything be red because when you have only one slot it's gonna default to every face having that material so there you go I feel like you now know the hierarchy and I understand that it's a bit confusing but you have to understand the material system before you talk about materials so in the next tutorial I think now we are ready to talk about actual nodes and not just you know how do you handle materials how do you make a material and we're gonna talk about some very simple nodes and I can I can actually give you a taste we're gonna talk about nodes that aren't as crazy as as this one over here it has too much stuff going on we're going to be talking some simple notes like the value node and color and we're gonna be talking about the bare basics and then building up so hopefully you understand everything we talked about so far so really the rest of this procedural note series is about making node graphs no trees whatever you want to call this which again is the material the material is this node graph the materials put in a slot which represents the suction on your objects and all that is sent to the object so hopefully all that is now understandable and hopefully I recorded it correctly this time so yeah it's it's rough if you want to support this tutorial series and more so if you want to support me the only way to do that is via patreon your likes your subscriptions your dislikes doesn't matter I need a page patron so if you want to donate that is the place to do it if you want to help you know thank you for watching hopefully part three will be out tomorrow I'm not sure about that I don't know if I'm gonna record another especially after this this I can't think of the word now that I'm at the end of the video this um scarring event and that's a dumb thanks for watching guys and I'll see you in the next one hey guys welcome back to another default cube CG matter tutorial and today we are doing part three of the procedural node series I know it took a while for me to actually sit down and record this but that's because I was waiting for a new microphone and now everything should be working yes I had some recording issues earlier so I want to make sure everything's going before I invest a lot of time and like usual we're gonna be using version 2.8 one and I'm gonna keep pointing that out until we switch to a different version and yeah let's make that fullscreen so what are we gonna be talking about today well a while ago I said I'd be talking about value color maybe a bit of math and that's supposed to be part two but of course we have to talk about the material system so today we are doing all those things so in the first episode we learned that the way to get to the shading workspace or just to get the shader editor in general is either to you know I'm gonna stop repeating this after a couple episodes but again you can either open a window go to the shader editor do your thing or just hit shading workspace and this time for real for real I need you to have it wasn't important last episode but for real in add-ons make sure that you have node Wrangler because today we're actually going to be going over shortcuts that depend on it okay so we're in the shading workspace we have the default scene with the default cube which has a default material again remember our cube has a bunch of faces each one has the assignment of this material which we can name anything I'm just going to call it default material and you can see that when we change this color it's actually changing this node network which is the material which is on the surface of the object we we already went over this I'm not gonna keep talking about it so today I just want to talk about how this shader editor works in the first place and then we're gonna get we're gonna kind of get rid of this big node and replace it with something that we can actually manage but before we do that let's talk about some basics so you're in the shader editor and you see me you know zooming in and out navigating how do I do that well pretty much all of blender is pretty connected with its hotkeys there's still a couple exceptions to that which they need to get to but most of the stuff makes sense so for example in the viewport how do you navigate well you hold the middle Mouse to pivot you can zoom in and out by scrolling you hold shift to do this thing and it's pretty similar so in the shader editor which is 2d not 3 not a 3d we zoom in and out with the mouse wheel we pan around by holding you know middle mouse button and that's pretty much all there is there's no 3d rotation for this 2d thing so zooming in and out and just moving around ok cool as for the nodes we can select them by clicking them you know do box selection alt a to deselect same stuff as usual I'm assuming you've probably used blender a bit and you're not just hopping into this first time with materials yeah so we we move around we select for moving nodes you have one selected you hit g4 grab and it works exactly the same pretty much every shortcut you already know works here too to delete something you hit X and you can undo it and again X over here it's all the same stuff over and over and over again and yeah I think the only other shortcuts we're going to be talking about right now there are a ton but for right now we want to talk about how to quickly disconnect and connect nodes and normally the way you do this is you just hold this connection and drop it into the background to disconnect and then you do the opposite to connect and you can do that to any socket of the node but since we have no during or the fast way to do it is you hold ctrl and then right click and drag to cut so again ctrl click and drag to cut this works if you have multiple connections so I'm going to draw a line passing through all three of them and now that's gone and then for a fast connection so instead of doing this what we're gonna do is hold alt and then do the right arrow or right mouse button drag and you can see that it's highlighting which nodes are going to be part of that connection so if we duplicate this by the way duplicating is shift-d or you can just you know copy paste should be yeah there we go same same commands as always seriously if we have two of them we can hold alt right click and drag and then choose which one we want to be fast connected we're going to do this one then let's do this one and we hold ctrl and right click to sever this sever that and that's pretty much what you need to know so pretty much right clicking is the thing that lets you do no danglars stuff and you either hold ctrl alt and there's also something for shift so for shift if you hold shift and in and then do it you're gonna see we get this line and when we drop it it's gonna have a hinge I'm sure there's a good name for it I think it's called rerouting so the point of this is let's just delete it instead of having something like this which can get pretty messy when you have a bigger no network you hold shift right click drag and you have this nice thing that you can reroute everything to still has the same information but whatever ok cool you know you now know hotkeys I hate talking about them so we are done with them and by the way yes g4 grab but rotation and scaling don't do anything because it doesn't really make sense in this context ok so now some other basic stuff before we switch out this node for other types of nodes you can think of this as this giant green principle tsdf is basically holding a lot of information about what we want their material to like and then we're sending all these instructions through the connection or the noodle to the material output and more specifically it's going to the surface socket meaning take everything here and send it to the surface the material surface of any object that has that material pretty pretty simple so it doesn't really matter where this is this is the same node network as this one it's really topologically equivalent or there's a name for that there's like this doesn't matter doesn't matter I was going to do some math II nerd stuff so what I'm saying is if we have two of these ones red and one is blue no matter what we do to this it's not gonna matter until we make this what is connected and vice versa for this doesn't matter and again control right click to sever all right click to connect and if you can't remember that because your brain I don't know can't handle that much information you just do it like this and yeah yeah there are many many many more hotkeys but let's ignore those so instead of messing with this principle D SDF that can get pretty confusing you have color you have how metallic it is I mean you can just kind of drag these things and see what they do here's roughness it's like how much does it look like a mirror instead of doing all that what we're gonna do is we're gonna simplify so instead of that giant thing we are gonna add a node called the value node which is the kind of to Adam it's the base most basic node you can have and then you build up from there so to add you do the same thing as in the viewport so viewport you do shift a or you just click Add and then choose what you want to add same thing here shift a to add a node or you just go to add and select your node so we're gonna do shift a and then either go to input and then pick value which is going to add that you can do that or you can do shifting and then type it in right here value and I think you can just hit control a no that's a that's a function notes thing shift a type in value and this is how I like to add all my nodes because once you know the names you kind of don't want to go through the menus so again we take this we connect it either that 'we are alt right-click and now you can see that it went from black to you know gray or white or something and this note isn't as scary as what we had before which was this giant thing called again you can just type it in principle be SDF i mean compare these two nodes if you know what i mean okay so we have a value node which has a value right now that value is 0.5 and we can change it and by the way when you hover over something it tells you what it does so default value input value used for unconnected socket sometimes it's going to be more useful than that description but whatever what we do is we take this and change it and you can see our cube is going from black to white etc and if we look more closely notice that as we go down towards 0 it gets darker and then once we get to 0 let me just type it in it's a pure black and if we go to negative Z even lower than that it stays black conversely if we go up from 0 towards 1 it turns more and more white and then because of a technicality which we'll talk about in a second you can even make this bigger and you can kind of tell it's getting even brighter so 1 compared to 10 times brighter but normally we use the value node for numbers between 0 and 1 of course this isn't always true I mean we have so much freedom we can put whatever we want we can even type in something like pi and it's going to give us you know an approximation 3.14 - and if you click this it will give us like 6 digits or something you can put in whatever number you want fractions negatives whatever giant numbers but there is a reason that we'll talk about that we go between 0 and 1 which makes me think okay well if 0 is black and everything under 0 is still black and one is white why does it get brighter and then it is currently when you go above 1 right if I'm saying it goes from 0 to 1 why is this showing something different and you know there's a lot of reasons for what I'm about to explain but really this is just a color management thing so if we go to the render tab and we go to color management's that render tab color management and view transform it should by default be set to filmic for you I think we're going to take this and switch it to standard and basically what this view transform it kind of tells blender how to handle colors so standard kind of works the way you expect it to so one is white and if we make it brighter nothing happens nothing's happening meaning one is the cutoff and zero is the cutoff for black meaning that you can still do something below zero on something above one but it doesn't really matter in this sense of seeing the color on the surface of our object something like filmic has more high dynamic range or whatever and that lets you go even higher than one so maybe you can think of it as a I don't want to say 1 over X but I'm saying that you can you can keep getting brighter and brighter and brighter and as your numbers get huge you know how much brighter it gets kind of slows down but you can always keep going so it goes from like 0 to infinity instead of 0 to 1 I'm just saying keep it on standard and don't worry about it so there you go so we have this on standard we go to 0 it's black negative is you know still black anything under 0 and then we go all the way up to 1 and then nothing happens ok cool so now we know the value node and this is a great way to make an object either black or white and you're thinking okay I don't know what this has to do with anything but it's a good fundamental thing to understand because we build everything up from this so hopefully you understand the value node we can have two valley nodes 1 0 1 0 point 5 that's a comma 0.5 if we take this and connect it what's going to happen think about it it turns gray so somewhere between black and white halfway in between if we change this one to 1 and we connect it what's going to happen think about it it's going to become as white as possible assuming we're in the standard view transform okay cool what about negative numbers we said that it's black so how do we even know that it's actually storing this number what if it's actually just if it's a negative it just says that it's 0 and makes it black right is there a difference between negative 1 and 0 so here's a negative 1 here 0 is there actually a difference and I would say there is and I'm going to prove it to you so we're gonna have two negative ones and now I'm going to teach you about another node so you can go shift a to add and then I'm trying to think where it is is it in converter I'm looking for the math nodes so in converter you're gonna find math or of course shift a tie-pin math node okay cool so now we have something a bit more complex it looks a bit bigger than the value node not as big as the principle DB SDF okay so if you go to this master node and check the drop down you can see there's a whole bunch of math e stuff which some of that you may recognize some of that you don't but I can guarantee you recognize division multiplication subtraction addition and that's what we use for most of our mathematical operations so I mean if you're scared by this get out of here okay it's just addition subtraction multiplication division you can handle it I swear so what we're going to do is I'm going to set this to multiply and you can see it has two values we can connect this let's connect this to our surface and notice that right now we have 0.5 times 0.5 which is 0.25 which is you know it's closer to black than it is to white because it's you know closer to zero than it is to one if we do 0.5 times to it which is one you can see this turns white so if I make this value node one so these two things are essentially equivalent here we have one here we have two times 1/2 which is one if we switch these and nothing really happens it looks exactly the same okay cool so you can either just you know put in numbers here and here and have it do an operation or you can instead plug in numbers instead of just typing them in here which is good because you can control them from separate nodes so let's take this and connect it so we have negative 1 multiplied by negative 1 and it gives something that's white because negative 1 times negative 1 is 1 which is as white as you can get but that proves that negative 1 isn't like rounded to 0 right even though it's black it still has that information and hopefully you understand what I mean by this if these were zeros this wouldn't work again so times 0 is going to give us 0 because anything times 0 0 and I think you get the point we can also do other operations like let's say addition so negative 1 plus a negative 1 is a negative 2 which is under 0 so it's black and if we want this to be exactly white we would need this to be 2 because 2 plus negative 1 is 1 if we want this to be exactly 0 we put in 1 1 plus negative zero and then if we make this anything bigger than one it's gonna be slightly more closer to white than it is black right it's it's gonna become gray here's what I'm saying and you can see that in action okay there we go that's pretty simple I think you understand of course the math node let me undo that the math node has tons of operations like you know sines cosines you know trigonometry and then also some other things that greater than or less than let's just do one of these so greater than will check if you know it describes it one if a is bigger than B else zero meaning if something is bigger than another number it's going to output true meaning white otherwise it's going to say false which is zero so let's try it let's see two and one is two bigger than one yes let's try it 2 greater than one now it puts white so it's outputting one if instead I made the zero is zero bigger than one no outputs black now if we make these the same I'm not sure what it's gonna do exactly I guess it's going to output false because greater than is like strictly greater than it's not greater than or equal to if we make this anything bigger than one immediately it shifts to white and I think you can probably understand why so math node tons of stuff and then the last thing I want to leave you with for this you know introduction is we have value which is one kind of grayscale if you think about it's either you know black gray white you can't really get any color out of it um how do we take this and then level up to color well the way I want you to think about this is any color it can be described by how red green and blue it is so red just the color red is a hundred percent red and zero percent green 0% blue and then you know and then something like purple is like you know half red half blue it's like mixing colors we'll talk about it so what we're gonna do is we're going to do shift a and then is it converter we want a combined node let's ease it in here yes so in converter you can see all these combines I'm going to add a combined RGB or you can just type it combined RGB and just add that in and we take this and you see it has a yellow socket which normally indicates you know color or something that isn't grayscale so you can see values have this kind of grayness to them and these three sockets for inputs are also gray and it outputs something with color and we'll talk about what green and purple mean and all that Bloods just connect this which gives us black we can take this and make it more red so you can kind of see what's going on there we can make it more green make it more blue or we can mix them so if we take something that's one on red meaning you know a hundred percent red and also make it a hundred percent blue we got you know purple right it's mixing colors if we do red and green I think that's yellow yeah and green one hundred percent green hundred percent blue what does that give I guess it gives like teal turquoise something like that so normal mixing colors and again we don't need to type it in these sockets instead what we can do is we can have three value nodes again that's a shift D to duplicate and I'm just going to connect them and again use the Alt right click thing for the shortcut and you can see that we have something that's perfectly white because it's a hundred percent red hundred percent green hundred percent blue meaning that it has all the colors and that's white and of course if we change these to 0 we get black okay cool and you can see that if you pull this slider it doesn't let you go under zero maybe you can type it in nope it just rounds to zero it doesn't let you go under zero or above one and this is what I'm talking about where a lot of nodes just wanted to use the zero to one interval of course you can type in over here negative two and we talked about how it actually stores that but um yeah I mean zero to one is what we're using a lot of the time so we need to get used to it so we have combined RGB let me just reconnect these and you can see the nice thing about node regular is it will automatically detect if a socket is filled up so if we do this it's gonna automatically go to green and then to blue and then whatever so let's just set all of these to one making it perfectly white and I just want to play with this a bit more so you understand so here's blue we can take this down and if we remove the blue all we're left with is yellow doesn't matter what arrangement we have these in again it's a topologically equivalent it's invariant to change I've a word for this again doesn't matter but it exists yeah so you can just slide these around and then you can also do the opposite operation where if you have a color so instead of combined RGB we can just add an RGB note which is kind of like skipping the middleman of choosing a red green and blue I mean you can you know pick your color wheel and then set RGB values or just you know choose it from this color wheel conversely let's put this so it's going to be you know this shade of green we can do the opposite so instead of taking three numbers combining them into what is a 3d vector don't worry about it right now and then you know showing that as a color we can take this 3d vector meaning just a list of three numbers how red green and blue it is we can take that and instead of a combined RGB converter separate where is it separate RGB or just type it in and in the beginning you're probably not going to memorize these names but that's fine and what this separate RGB note does is it takes our RGB you know the art color that has some amount of red green and blue and then separates it instead of combining it so I'm just gonna choose a color that is you know pretty much perfectly green so you see red it's outputting black which meaning it which means it's a zero again black is zero or negative but in this case at zero meaning this shade of green has no red in it if we do green you should expect this to be somewhat white perfect and then blue it should be closest to zero let's see yeah and then if we bring this somewhere over here that's kind of like a turquoise we can expect our blue to become think about it slightly brighter cool and we can actually put an exact value so let's have this me one one and one meaning that blue is gonna be one green is gonna be one red is gonna be one we can make this exactly 0.5 and it's only outputting our red which is 0.5 so if we had a value node of 0.5 this should look exactly the same there you go and of course you can mess with stuff in between you don't have to immediately connect it to the surface of our material output we can add in a math node we can add in a math no as we talked about so here we have red value 0.5 and 0.5 and we can just add these making them one perfectly Wyatt and then we can bring that down so if I make this zero it's 0.5 if I do negative 0.5 so again point 5 plus negative 0.5 is zero so yeah there you go I mean we can always like dive into this a bit more so you know there's math for combining values which is one number but there's also math for combining colors which are lists of three numbers and there's ways to do that but I think this is a good introduction to the hot keys to simple nodes and to me ending this video very soon if you enjoyed this you can like you can subscribe these are all things you can do but if you want to support me in a way that sees results and lets me keep making tutorials please donate to my patreon there's a link in the description and you also get benefits but that's not the point you do it if you want to support me but it is your choice that's all I have for you guys hey guys welcome back to another default cube CG matter tutorial and today we are doing part 4 of the procedural note series and over the last three episodes we've kind of been building up the difficulty we went from baby to toddler to probably still toddler but today we are going to full teenager so I expect to lose some of you today and yes you are the weak ones if you drop out so let's get into it so today we are gonna be doing green screening and I found this dopey looking image that we're gonna be using can you guys see that yeah you can see that and yes we're going to be doing green screening using a bunch of math and if you remember from everything we learned we now know how to use value and how to use color and also a bit of math and it turns out that's all you need to do green screening and I think that's a pretty unique way to teach uh notes so like I said this is a procedural series meaning that we're not going to be using tetris but just for this one for the purposes of example we're gonna be using this image as a texture but these ideas these fundamental ideas are transferable but I thought it'd be funny if we use this businessman and basically the approach we're going to be taking here is we're gonna take this image we're also going to pick a color being you know this green in the background and then we're going to calculate the distance between the green we chose and the rest of the image and as you might expect the distance between the green and this background the green screen is going to be zero because they're the same and then wherever this businessman is it's gonna be some number bigger than zero so like for example maybe the skin is closer to green than the black of the business suit and then we're gonna say wherever the distance is zero just get rid of the texture that's the idea so that should isolate the green screen and that's just a bunch of math and to calculate distance in a 3d since that's what we're doing because we're finding the distance between two colors which has RG and B three-dimensional vectors and all that we'll talk about it we need a formula for calculating distance in three dimensions and that formula is going to be this one which is the Euclidean distance formula and yeah it looks intimidating but it's just a three-dimensional version of the Pythagorean theorem so instead of like x squared plus y squared is equal to Z squared or maybe a squared plus B squared is equal to C squared I don't know what school you want to basically now we're doing the three-dimensional approach and the whole idea of this tutorial is just getting used to using math more intimately so again version 2.8 one I'll point out I'll point out when we finally upgrade to 2.8 ooh let's switch back there we go let's go fullscreen and then for this one first time ever we're not going to be using the cube but instead we're gonna be using a plane because we just want to see our green screen texture so we have this we go to the shading workspace like always and we have no drink or enabled I don't want to tell you again and since this doesn't come with a default material because the cube does it should be in our drop-down so let's check and it is so we're just gonna assign a material so now this object which has one face has the assignment of this material and again we can choose the color so truly this node network is the material affecting the object we'll stop talking about that maybe five tutorials from now so we can call this the green-screen material since that's what it's gonna be and then we're just gonna select this and then X to delete we already talked about the same hotkeys and we're going to start off by actually importing in our image texture and that's something we're not going to be doing very again procedural to do this either shift a to ad or just go to ad and we're going to type in image texture image texture node you can also do shift a input and then is it in here it might be somewhere else it might be in texture and then image texture so same thing and what we're going to do is connect this to the surface again alt right click drag is the fastest way to do that and then open up the texture of you can I just downloaded this from Google Images you can pick anything and yeah so again this node which we haven't talked about and probably won't talk about again just stores an image texture that we loaded from the hard drive and sends it to the surface of the material output and you can see it's kind of looking stretched horizontally like compressed and there are ways to deal with that without changing our plane but since we haven't talked about texture coordinates we're just going to scale our plane on the x-axis to correct for that but there is a way to do that without changing the shape of it okay cool so how are we going to do this well again what we said is we need this image a color being this shade of green and we need to calculate the distance between them between the green and detects are using Euclidean distance and all that let's take it step by step so since we need access to the whole three-dimensional stuff and all the math we don't want the color again yellow sake means color of the image texture we want to control the individual values of red green and blue and like we talked about we can use combined RGB and separate RGB so shift day this time we're just going to type it in and add a separate RGB node which again shows us only the red of the image only the green only the blue and as you might expect for red and for blue the background is going to be completely black because it's a value of 0 of red and blue but it's 1 or should be around 1 for green and by the way I haven't talked about this hotkey you're probably wondering instead of doing my like alts right click or you know maybe just selecting one and dragging it another hotkey that I'll now introduce is you hold ctrl shift and then click your note and that's going to hook it up to this like temporary viewer node but what it really does is it just has it display really quickly so ctrl shift click on this one now we're viewing this and then here and if we keep clicking it it's going to cycle down so that's control shift click that's a useful one I use it quite a bit okay so now we have access to red green and blue of the image and we're also going to add a color again we can do that from combined RGB which lets us control the amount of red so this is completely red if we add some green it's going to turn yellow because we're mixing these etc so we can either do that and then try to you know guess what shade of green it is or instead we're just going to add an RGB node which I think we talked about and now we're viewing that one and we need to pick the shade of green so you can kind of like approximate it based off our texture but instead what we're going to be doing is actually using a handy feature which is you open up your color wheel and then with this eyedropper tool you just select the exact shade of green so we can I wonder if it works for the whole screen like could I select this shade of grey looks like I can so that that's really the trick we're gonna be using here so instead let me just undo and that should be the same shade of green let me just make sure and yeah so now we use this we're using the same shade of green and we can send this through another shift D to duplicate or just again control C control V eventually we'll stop talking about hotkeys we're going to send this through a separate RGB node which again lets us see red green and blue and it's going to be most green which is going to be closest to white and by the way I didn't even mention as always since we want to be working on intervals between 0 and 1 in this case that doesn't matter because we're doing it all mathematically but visually we want to be using the standard view transform and we talked about this instead of having a whiteness that can just keep going past 1 all the way to infinity we want one to be as white as you can go and 0 to be as black so negatives negative numbers are black numbers above 1 are perfectly light ok cool now the only other thing I want to make sure that you do is with this RGB node you open it up and you're going to see it's going to be selected to hue saturation value that's what this stands for make sure it's on RGB basically these are two ways to UM choose a color RGB as the color is how much is it red how much is it green how much is it blue hue saturation values just what hue like what type of color it is I'm gonna change you you can see goes around the color wheel that's what that means saturation means how intense it is so if we drag it you can see it's going towards the center and value is how bright it is so you can see we're changing the brightness so really this is kind of like polar coordinates versus rectangular coordinates whatever I just choose RGB and make sure to select whoops let's view our texture and make sure to select that I'll get perfect so make sure that's RGB okay so now we have two three-dimensional vectors in other words we have two colors one of them is a bunch of colors being the structure and the other one is just one color and we've separated them into their components now we just need to do the basic formula and again if you don't know the Pythagorean theorem basically what we're going to do is we're going to compare the Reds by subtracting them so we'll do this red minus this red and then same thing for the green the screen minus this green this blue minus this blue whoops so basically you basically we pair them together then we square them add them and take a square root so it's kind of like a squared plus B squared and the square root comes from the C squared don't worry about it don't worry about it this is just practice practicing some math read up on the Euclidean formula if you have no idea what I'm talking about I said this is gonna be adolescent level where we wrapping it this is high school math now so we are going to be adding in a math node to do our math and first of all we want to compare Reds so we are going to set this to subtract and you can either click that or you can just type in the letter s and for like division you type in D greater than G basically the first letter so we're gonna do subtract we're gonna do read alt right click drag and then same for this one so now we are comparing the amount of red so there you go you can see that you can see that the background is black because this color is perfectly green so it's not going to have any red and this texture also doesn't have any red here so when you subtract them it's going to be now we can just take this duplicate it and now do the same thing for green and by the way let me talk about another shortcut that might help because if we all tried click drag it's still going to use our red because that's the first dump a way to avoid that I think is you hold alt shift and then do it so now we get a blue line and now we can actually select where it comes from so instead of going from red we're gonna start with green and send it to the first value so it goes from green to the did I say a second amount first value over here so again alt shift right click drag from green to the second value okay cool now let's just pair up our blues and really you can do this more efficiently with actually only one or two notes but I just want to talk about separating colors into their elements so from 3d vectors to their red green and blue do the math and then combine them again later it's not the best approach but it's fine so we are gonna combine the Blues now and this one I'll just connect manually so here we go red green blue cool nice so now what we need to do is we've subtracted now we need to Square and you can either do that by setting this to multiply and just multiplying it multiplying it with itself which is the same thing as squaring or instead you can use power which is like exponent and you set the exponent to two so we take what we plug in here and raise it to the power of two take that duplicate it and do the same thing over here so once you make a kind of this stuff for the red you can just duplicate everything down and it will be pretty fast and again we can view all these ctrl shift click click click okay cool so now we've done all the differences squared now we just add these things together so duplicate another math notes that this want to add by just clicking a we're gonna add these and sadly there's no way to add three things using a one note as far as I'm aware so we're gonna add these and then we're gonna add that to this sum so instead of adding it in one step we have to do it in two and you can already see what we get over here is surely a mat of basically where there isn't green or where there is green to where there isn't green and you can see that it's not perfectly white like this area is a bit gray meaning that the original image this shade of like purple or whatever must be slightly closer to black than everything around it so technically this is a fine measure for measuring the distance between our green and our texture but technically it is correct it is correct to take a square root at the end which is a monotonic function so it doesn't matter but there you go so now we've basically made a node network that takes two things and then calculates the distance between them in terms of color so again the way you want to think about this is that where it's white you have maximum distance between the colors meaning that they're very different they're kind of like on opposite ends of the color wheel very far apart and then where it's black the distance is very close to zero meaning that they're almost overlapping and are almost the same okay cool so now how do we take this mat and you know use it on our texture so we want our texture but also you know remove all the greens so we can put something in the background and there are a bunch of ways to do that but I think probably the coolest is to introduce if Aven already the mix RGB node which is kind of like the math node these math nodes but for colors so not just two values but two colors it doesn't work with the gray sockets but rather with yellow sockets is the way you want to think about it so we can either shift a and then I think it should be in converter I'm not sure exactly where it is we're looking for mix RGB maybe it's in color yeah mix RGB or again you can just type it in okay cool and it looks pretty similar to the math node you have like two inputs a kind of mode you choose like addition subtraction whatever then it has some extra stuff it also has this clamping which we can talk about later but yeah it's pretty similar so what we are going to do is for our mix node we are going to and this is where node Wrangler becomes very useful because trying to select this and then do it from very far away's hard we're gonna Alt right click drag and now this texture is in the first of our mix RGB note and then we're gonna take this on the same thing okay cool and view it with control shift click and basically what it's doing right now is it's taking our two inputs being the texture and the color and doing something called mixing and there are a bunch of different things you can do you can either mix you can color burn whatever each of them have different meanings and then we can also control which like side this operation favors so we can pick a factor of something that just favors we'll talk about what that means our color or we can have it favor our original texture and I'm pretty sure what mixing technically means is it's averaging out the two colors so it's splitting it up into components averaging in them on red green and blue and then combining them but there's also different kinds of operations but you can see that when we change this factor we can have it you know kind of reveal one or the other so what we want to do is have it reveal our texture only where this is white and then reveal our background wherever it's you know black so what we do is we just take our factor and instead of picking a number we input this um you know it's a value meeting it's between zero and one and it's one dimensional but really it's kind of like a texture of its own because it's different at different points it's not white everywhere which is something where we haven't done before I don't think we're it's different in different areas of our geometry so let's take this make it our factor and view it and you can see that we're getting something very confusing so first of all to clarify what I'm going to do is I'm going to take our green and I'm going to disconnect it and you can see now we have something that's pretty close we have our green and then we can actually choose the color so it's kind of like we have an inverted green screen and as you can see like we talked about hopefully YouTube compression doesn't kill it you can see a bit of difference over here where the color was originally closer to green and the way you want to think about these notes that have two inputs especially not necessarily in the math node but in general you want to think of bottom as foreground it's this really horrible design that blender has so instead of layers where the top one the foreground the bottom ones the foreground so we have our image texture and then in the foreground we have this shade of purple but only where this factor allows which is you know where this was white originally so what we can do is we can just take this and put it in the foreground and now you can see wherever the factor is white we have our image texture which is on the bottom which means the foreground appearing and then we can actually choose our background color and this is exactly what green screening is we've removed the background and then chosen to pee yeah we've chosen a different color now of course there are two things to address first of all can we put like a image behind here and second of all what about this green outline so first of all let's talk about the texture in the background well first of all let me ask you where would you plug it in think about it well it'd be exactly wherever this magenta is which is the first socket which is the background so again shifting image texture again we're gonna try to not use these in the future open desktop and let's go with the thumbnail from the last one of these really strange thumbnails so let's take this and plug it in to the background and that is a green screen now the question is how do we get rid of you know this green outline meaning our factor is a bit messed up at the edges and as you can hopefully see this thing is mainly black mainly white but on the edges it's very very slightly gray meaning that the distance isn't super far away on the edges but just kind of halfway in between and that kind of makes sense because you have the green screen probably spilling light onto his sleeves or whatever so it's a bit green so it's actually a bit closer than everywhere else so the way we deal with this is we want to say only keep everything that is very very far away so instead of just looking at the distance and then being like show this wherever the distance distance and is high and where the distance is low don't show it and in between kind of half show it what we want is a cut off and to do that there's a bunch of ways we're gonna take this first of all it's kind of clean up over here I'm gonna bring this down so what we want to do is we want to take again all these nodes we did all these blue nodes are calculating the distance and now we just want to do a bit of a cut off so I'm gonna duplicate this and add it over here so now this is what's going into the factor and we are going let me actually view it as well and we are gonna set this to greater than which again it outputs white if it's going to output white if this whatever we put in here is greater than what is over here and clearly the whole image is black because nothing is going to be greater than 2 because our factor is going to go between 0 and 1 the distance goes between 0 and 1 so if we set this to 1 we have only the parts of the texture that are very very very not green which I guess is probably apparently where skin tone is so maybe a second's very orange which is very opposite from a green maybe now it looks pretty close on the color wheel whatever so what we can do is now we have kind of like a threshold and we can just bring this down and reveal different amounts of our image if we bring this to low like to you know zero everything is going to be white because every even if it's a distance of zero or maybe point zero zero one it's going to be bigger than zero so the green screen is effectively not being used so we need to just choose a factor that has a nice effect with our edges so I don't know let's try point three and we can view it and you can see we still have our edge so we just want to slide around this value and you can see it's kind of going away but of course the issue is if you make it too intense it's also gonna cut out you know parts of the interior like you know these fingers and all that so you kind of want to pick the optimal value that doesn't have that effect and of course you can do a bit of math to actually do what we want to do but also keep the interior we're not going to get too complicated on this this is just like a tutorial to do a bit of math but you can see that this is a better result than not having it so this is not having it and this is having it and by the way what I'm doing is I'm clicking M which is another hotkey to mute and basically what it does is it kind of goes through the node network but almost assumes that it's not there so you kind of want to imagine this wire just passes through it so M to mute and unmute and yeah the the cool thing about this setup is once you make it you can use it on a bunch of different scenes so if we just look up more green screen stuff let's just find a different one it could even be a different shade of green looking for something that looks a bit different okay this one's probably not gonna be the best but we can try it because um there's two different shades of green and our green screen setup is very very not intelligent we can make it better but right now this is what we got we can make it kind of like have different kinds of sensitivity depending on different situations but don't worry about that so what we're gonna do is we're gonna set our image this is our businessman and change it over to green screen number two and then let's also view it what we want to do is also change our green this is the color we're comparing everything to and we want to pick the updated style of green so something like that and then let's view it that's not looking too hot probably because of our greater than value so first of all if we set this to zero nothing happens because of the reasons we talked about but if we gradually you you've probably seen this if you've done green screening in any kind of program kind of does this kind of thing where it has this up has this kind of rough edge and this means the green screen prop probably wasn't very evenly lit there might have been more shadow over here for just trying to remove pretty much all the green which is everything except the head and that did a pretty good job of course like I said our note is garbage you can kind of optimize it by adding a bit more math so something people like to do is that a power node so right now we're doing a power of one so anything to the power of one is itself so it doesn't change anything but we can kind of change the fall-off using this technique as well but um yeah I guess that is that is green screening I think I taught it to you and I think I didn't even go too much higher up in difficulty than the stuff we were talking about before again you know colors math all that stuff make sure to refresh yourself Euclidean distance because if you don't know where that formula came from it might seem like magic basically what I did is this is the Euclidean distance between two points so imagine you have one point here another point here whoops is it now only showing imagine you have two points one here one here and you need to find the distance D between them you compare the X so that's X minus X like we did so that's the red minus the red you have the green minus the green and then you do some squaring and the whole Pythagorean theorem nonsense but instead you're doing it done in three dimensions so there you go I'm sure I lost about 90% of you but don't worry they're the weaklings and the rest of you can keep going forwards in the next one I think we're just gonna kind of go off-topic a bit and just talk about drivers and then eventually kind of the goal is to get to texture coordinates because that's where all the interesting stuff happens so yeah there you go if you appreciate these tutorials what I mean is if you want to donate to me the way you do that is via patreon it is the best way to make sure I am funded to keep making tutorials and have the time and I'm willing to put in the effort although I love making these it does help if it actually is kind of a job and I try to make the best tutorials out there so hopefully like this procedural note series patreon would be greatly appreciated but that's up to you and other than that I guess that's everything I have for you but hey guys welcome back to another default cube CG matter tutorial and today we are doing part 5 of the procedural note series and the topic for this tutorial is going to be drivers and if you've never heard of drivers that is a good thing because you're about to learn learn about it so it's kind of hard to describe without showing you so let me just do that and I should preface this tutorial by saying that I just recorded a CG matter tutorial so my voice is gone and it might crack every once in a while so that's going to be embarrassing for me so first of all what our drivers and what am I going to be teaching you so remember from the last four parts assuming that you've seen those we have a combined RGB node which is basically saying let me just add another that we haven't altered yet a combined RGB node is just a way to choose a color by picking a red green and blue amount so I can make it more red as we approach 1 it becomes fully red and we can make it was something that's fully green so red and green make yellow and then if we also add one for the blue which means maximum amount we are going to get white because we have maximum amounts of red green and blue and then conversely if these are all 0 we get black so we already know what combined our G B is but you can see that my version which I'm going to connect my version is purple and you may be thinking ok what's up with that what does that deal well what these um sliders are actually rigged to do right now is notice what happens when I take my cube and move it oh so moving it is actually altering what these values are and you can see once I finish a movement so I'm just gonna click here you can see I moved it along the x-axis and this has updated for red to two point six six five and if you're thinking oh did I take this x value and copy it here dynamically then yes that is exactly what I did and that is exactly what a driver is so we have a pretty simple set up we can either control it by moving these location sliders which again are the same as these sliders or we can just move it move it in the viewport so if we want something that's perfectly red and green meaning yellow we just set this to one set this to one and you can see these don't really update that quickly it's kind of strange but usually you just have to toggle a frame and it happens you can see that it's actually updated and again this works dynamically and that is the point of drivers and the z-axis I reserve for making it a blue but again it only goes between zero and one so once you go past um an x value of one it just remains red ok so that this is what a driver is I think you understand the demo so let me just go fullscreen and start up the new scene and then I guess there wasn't really too much point to that because we just need to go to the shading workspace you know what that's all about it's where you edit your material so again probably the last time I'm gonna say it for this tutorial and I'm not gonna say it in future ones hopefully we have a cube that is some geometry which has this material assigned to it with the name material and that material is basically made up of this node network with this node network I'm gonna replace this principal be SDF with shift a to add and then I'm just going to type in you can either do an RGB knotek but what I would recommend is combine RGB because then we can actually manipulate these sliders individually and then additionally we like we talked about we can add an a value which is a single number to control this instead if we just want to separate it for some reason so to do this Driver stuff it used to be pretty hard but now that we're using 2.81 and onwards it's actually gone a lot easier what we have to do is I'm going to hit n to reveal this location rotation scale stuff or you can go to the object data I think no it's one of these object properties yeah here you have a location rotation scale what we're gonna do is we're gonna right-click any value that we want so let's say we want the X location you right-click and then you click copy as a new driver so we are going to be copying this x value whatever it is no matter what we update it to as our driver and then let's say we want this affecting our red Channel we right-click and then do paste there we go paste driver and now when we change this X value you can see after we toggle the frame it's actually going to update here and you can tell that it's being affected by driver because it's purple and of course you can do this dynamically and you should be able to animate this and have it update per frame so if on frame 1 we want it to be 0 we can add a keyframe here frame 40 while that go so like 3 again it doesn't matter once it goes past 1 I mean I guess it does matter a little bit since we're not on standard again standard actually has an accurate 0 to 1 where anything beyond 1 remains white whereas filmic has the 0 to infinity thing you can watch a video about that that I made if you care and you can see that it's actually dynamically doing it per frame and of course we can do the same thing with other stuff so for example we can actually take the same driver and it's still in the copy we can still paste the same driver over and over we can right click on green we're gonna paste it and then we're also gonna do it for blue and I want you to think about what's going to happen before I play this animation one value being the X location is controlling this red green and blue so what do you expect to happen we play this it remains perfectly grayscale so it goes from black to gray to white and that's because at all points that every frame these three sliders are gonna have the same value so they have the same amount of mixing so that should be pretty intuitive and I just want to really stress the point that you could do this for anything so let's say we take the Y location copy as a new driver set this to paste so now let me actually remove the animation here so we're no longer messing with that so now x-axis controls the amount of red whoops let me remove this driver by the way if you want to delete a driver because the blue is still being affected bunch of ways to do it the easiest way is to right click and then delete driver you can either do that or go into the you know driver editor which is one of these somewhere in here there should be drivers yeah here drivers but now we should be able to move to the x-axis to affect red and move along the y-axis to affect green and these things of course mix because of this combined RGB we can do the same thing by just you know putting it in a value thing that goes to green it's an equivalent setup although there is reason to do that because you can take this and plug it into multiple different nodes so you only have to have one driver so let me just paste it ooh blender crashed I would normally cut this part of the tutorial but that is the reality so that is some kind of bug or something I don't know maybe it's because I plugged a driver into something that has the same driver that is that's an issue but it's in the tutorial and let me just reset up quickly combined RGB so I guess that's a warning to be careful with some kind of contradictions with drivers or I don't know but we can take the same kind of lessons and apply them to everything we talked about before with a node so for example instead of just doing something simple like we just affect the amount of red we're gonna send it through some math first so let's add a math node and I'm gonna connect this to red so again right now it's out put in one for a red which makes it perfectly red because we have 0.5 plus you know addition 0.5 so instead what I'm gonna do is I'm gonna do division I'm gonna set this to 1 and then for the second value what I really wanted to stress is that you don't again need to pick X Y or Z location you can pick scale you can pick a dimension and fact anything that has a slider like this or that we can put an input and put an input for you should be able to actually copy as a driver so we can actually take the strength of the world I mean it's kind of like unrelated but you could use that as a driver so in this case what I want to do is take the frame number so this controls what frame were on and I'm gonna right click copy as a new driver and I'm gonna paste it into the second socket so we have one divided by the frame number so the reciprocal which means as we go frame by frame it's going to become kind of dimmer in terms of red so here we have one divided by one which is one redness then point five redness then a third a fourth and as we tend towards you know a bigger number it's gonna get closer to zero and I think let's see what happens when we play this yeah you see that it's not updating on every frame so usually it's better to just you know go frame by frame but when you render is since it renders on a frame by frame level it should work so sometimes viewport playback doesn't make too much sense and I don't know if that's a bug but this video is all about bug reporting for blender there there are some issues unless this is a design feature or something ok so what else do we want to talk about we can pretty much put this anywhere I guess the last thing I want to talk about is instead of doing it the way we've been doing it which again is kind of new to 2.81 I think I don't think it was in 2.8 we can do it the old-fashioned way which in some ways gives us more control if we don't want to mess with math nodes so let's say we wanted to take the reciprocal but not send it through the math node where we did the division how would we do that well let's say we want the scale the X scale to be our driver we're gonna copy this and paste it into red so paste driver and right now that means that if the scale is 1 on the x-axis which it is and we're going to have 1 for red and then as we scale down on the x-axis it gets closer to 0 which means it becomes dimmer in terms of red if we want the reciprocal we can either do what we did with the division or we're just gonna right click and then we're gonna edit the driver and this is where it gets a bit confusing if you don't know what you're doing basically what you're looking at right here is what is happening behind the scenes so what we are looking at is this driver is looking at the gaile of our cube and the zero instead of having it one or two basically means is it looking at X Y or Z where I think zeros x one is y + 2 Z that's just some array stuff don't worry about it but what we can do is instead of average value we're gonna set this to scripted expression and instead of taking the scale we're gonna do 1 divided by scales the same way you would write it in a program or in a calculator or something I don't know so 1 divided by the scale then you update and then right now it's still the same because the 1 divided by 1 is 1 but now when we scale down you can see it's getting brighter because it's filmic so normally we wouldn't see that but I want to show you is that when we scale it up it's gonna get dimmer because now it's a reciprocal relationship before it would have just stayed equally red if we were on the standard view transform so that's the reciprocal we can also do other kinds of math so at a driver we could do 1 - the scale so right now it's going to be perfectly black because the X scale is 1 so 1 minus 1 is 0 but then if we make it smaller it should get more red yep and you could you know do any kind of expression there and on top of that let me delete it if you're using a different version of blender if you want to call different whoops call different data paths that for some reason you can't like right-click or whatever you can again right-click whatever you want effect we're gonna add a driver now so instead of pasting one we're making one from scratch and then let's say that we want instead of like the cube we're gonna look at the light so that's the this light right here so we're looking at the light at a driver so we have the light selected and we can say oh do we want it have do we want it to reference you know where we're moving the light how big it is whatever and I'm just gonna choose like X location is fine you could do a whole bunch of different stuff but this is a good way to do it in world space meaning like what location does it have in the world instead of like local space or whatever and that is going to be our variable and then what's being outputted is the variable plus 0 so the way you want to think about it is we're looking at our light we're looking at the X location this is our variable and we're outputting the variable plus 0 which is you know the variable okay so let's actually see if the works so we have our light I'm going to zero it out and you can see this actually made our key black and as we move our light on the x-axis you can see it gets more red and then closer to zero and basically that means you can kind of texture or have a material of one object reference the location of another so you could do a lot of cool stuff with that once you do kind of more complicated math alternatively what you can do let me delete the driver alternatively we can add a driver and then instead of you know picking an object we can just you know put in a arbitrary data path and do a lot of different stuff with this so let's do single property we can look at I don't know I don't really know what I want to pick so what I'm trying to say here is you can access any part of blender to use as your driver so for example you can see we can pull like stuff from fonts we can pull stuff from lights we can you know so you can kind of have like the curvature of a spline affect the how red it is whatever but yeah this is just a simple example and now you should be able to use drivers and this goes beyond just the you know shader editor you can create a driver for the strengths here so let me just add a you know what let's copy this we are gonna copy as a new driver and then paste this into here and then let me go to rendered view what this does is as we move our cube on the x-axis our world should be getting brighter and then darker so it works on all parts of blender but I wanted to show it on the shader editor so I know this is kind of like kind of a departure from all the procedural stuff but you can see how it might be useful so maybe you want a material that changes color depending on how close an object is to another and if you wanted to do that you could either do all the math about you know you could Ian euclidean distance like we talked about last time or there's actually a distance option I think yeah distance and then you pick whatever two objects you want but we're not going to do that here you can probably figure out how to do that so yeah there you go another successful I'm gonna burp another successful procedural notes tutorial hopefully enjoyed this one if you did the best way the only to support me is via patreon if you become a patron it supports me obviously but then you also get benefits that are mostly CG matter related but you do get some benefits even if you just want to donate so thank you for checking that out you know likes and subscriptions just not not as valuable to me to keep making tutorials but whatever thank you guys for watching and enjoying I'm gonna make more tutorials in the future and that's it that's the show see ya hey guys welcome back to another default cube CG matter tutorial and today we are on part 6 of the procedural note series which is two parts away from what I would consider as level 2 where we actually make stuff difficult using texture coordinates so make it through this tutorial make it through the next one and then you're gonna get on to some harder stuff with some cool results and today I just want to talk about kind of what addition subtraction multiplication whatever what these things mean in terms of regions which kind of sounds like nonsense until I explain what I mean but it's gonna be very simple and this is what I expect to be a very fast tutorial although I said that last time and it ended up being a 15 minutes so again we have a plane I said I won't say it again but we'll do it we have an object that is a plane it has a material I called it add multiply and that material is the node network that I'm looking at over here the reason this looks black is because nothing is connected to the surface of the material output but you should know this by now and you can see that I made two nodes over here don't worry about how I made them I mean this is how I made them if you actually dive into this this is called a node group I just grouped a bunch of nodes and just compacted them into one unit so you want to have to see everything eventually I'm going to teach you how to make these but what these node groups do is I'm gonna connect this to the surface again you can either do that manually or Alt right click drag or ctrl shift click these are all ways to do it and you can see what this does is it gives us a circle that is a bit off-center again the centers where this 3d cursor is and it's just a bit to the left and what we want to think of this as is where there is a circle where it's white we have a value of 1 it's perfectly white and then everywhere else is black zero so 1 in the interior of the region and then Z on the exterior and then if we switch over to this one we have kind of the same thing but it's just over to the right so now here we have one and over here we have zero okay cool so what can we do with both of these together so one's a bit to the left one's a bit to the right you can imagine that we can kind of make a Venn diagram out of this so let me just add a math node and this is kind of the focus of this video right now it's going to be set to add and we're just going to be adding these two inputs which kind of gives us this Venn diagram looking thing and let's think about why this makes sense so in this region over here being like the circle on the left it looks you know a normal amount of white the same as if we were to just have this node only so what's happening here is we have one from the circle on this node plus zero if we look at this one this region is black on this one and it's white over here and then together they add to one so what I'm trying to say is when we add things in the past we've just been adding like two different numbers as in two different values so let me just make two values and just plug those in here and here we've been adding just two numbers and then we know you know how this works so if we make this negative 0.5 we're going to get zero negative 0.5 plus 0.5 is zero and we can do all kinds of stuff but you see that it's the same shade of gray white or black everywhere and we say that means that it's kind of uniform because we're just adding two numbers it gives an output and then it shows it same thing for multiplication or subtraction or whatever but again if we add something that doesn't look the same everywhere like these circles we actually get something more interesting so the math node doesn't just add things in general it adds per point so it will add the two values at this point and at this point at at this point and it may give different results in different areas which should be obvious if you're seeing this so again this is going to be one this is going to be one and then where they intersect where the Venn diagrams the area in common that is going to have a value of two and you can tell because it's a bit brighter and again if you remember if you've actually been watching this whole series the reason why even though it's above one since normally you do things between your own one the reason it's even brighter than the one which is normally not what we're used to is because the color management our view transform is sets a filmic instead of standard where standard caps off at one and then everything beyond it is white and then film it goes from zero to infinity where the higher you go the brighter it gets but just for this video normally we use standard just for this course but for this video I'm going to use filmic just to show that we can do addition beyond one like it stores those values okay so my point does addition just kind of combines things right so we add one circle another and now we have both of them together and kind of this peanut shape if you ignore that this area is brighter and that's what we'd expect so addition is kind of like an or so this or this cool what about multiplication with multiplication we only get the area in common right we only get where the left and the right circle are intersecting and let's think about why that's the case so in this area both circles exist so they're both have a value of 1 which means when we multiply them it's 1 and it shows up here but let's say something a bit to the left over here what happens here well it's on the left Circle it which means it's 1 but on the right circle that area is just black so focus on this area over here where my mouse is maybe I can yeah this area right here so on the left circle that is a 1 I'm sorry about all the radiator noise if you can hear it that's going to be annoying it's not going to stop on the right circle though this is zero because you can see it's black one times zero is zero and that's why it kind of goes away so multiplication is kind of like an and statement meaning where is this and this at the same time so just to reiterate multiplication can I erase this multiplication is and addition is or and I can tell you're getting bored of this video but I'm telling you we're gonna be using these concepts all the time so like say we want to combine regions isolate them do other stuff this is very important and and to just understand what this method does on a per points a level so again we're adding or multiplying or whatever at every point on the point okay so now let's try to do something a bit more challenging let's say we want to do this circle but we cut away this piece right here kind of like the Apple logo or you take a cookie and eat it or eat a bite out of it well what we what we would want to do is take this and subtract away this area over here in other words we take this and then we subtract set this to subtract the other circle which gives us this and if you're not seeing this immediately you'll get used to it it will make sense and then what you have to remember is that since we are subtracting this area over here isn't actually zero even though it's black it's like negative one and most of this region over here and we can see that if we should be able to see that if we do something like we're gonna put another node here another math node and we're gonna do less than and we want to see where this is less than zero meaning negative and you can see right here it's negative but this is just very highly theoretical stuff okay cool so we know how to do and or kind of subtracting pieces away from each other let's try to combine all these ideas together for the final challenge of this video so of something at my nose see if you can figure this out before I show you what we're gonna try to do is have this shape but then subtract away the interior so we basically have two moons without the intersection in the middle how would we do that there are a bunch of ways think about it okay let me show you two methods hopefully I can come up with two so the first thing we do is we take everything and then we also want the intersection so let me just duplicate shift D or ctrl-c ctrl-v set this to multiply and then let's connect both of these so we have our addition we have our multiplication try to show that there you go and then we just use subtraction kind of like the same trick as before so set this to subtract and remember we take the first thing and subtract away the second thing this radiator man take this subtract this gives us well that didn't give us what we expected let's think about why for a second okay good this is actually a good point I didn't expect this the reason why that this didn't actually take away the area from the middle even though we did the subtraction is remember technically this air - it's not one it's one plus one is two so we can either do some more math to fix that or you might have been wondering what this clamp button does and what it does is if there's anything above one it will just send it to one if there's anything below zero it will send it to zero so it kind of gets rid of anything that's outside the zero to one range which is normally where we like to work so I'm just going to set this to clamp and you're going to see now just does our addition as if we were seeing it through the standard view transform and now we're gonna subtract it and you can see that it works so I'm glad that the error happened there so I could explain about clamping so that's what clamping does on any of these so clamping works the same for multiplication subtraction or whatever okay so that's one way to do this is there another way of course there is let's try to do kind of the longer approach where we take these and I'm going to subtract meaning meaning we take the left circle subtract away the right circle and I'm gonna set this to clamp which means all these negative values we were talking about are now pushed up to zero so again zero to one range and then let's do the same thing but the opposite and I'll show you a cool trick so right now these to subtract nodes are doing the same thing but if we want to change the order which will do what we want it to you can either you know do it like that and it will flip it we have too much stuff going on here let's view that and it will flip it or what you can do is instead of doing it manually there's a hotkey for this and that is alt s and that's probably for swap or something that's what the S is for so all tasks can toggle these so now we have this moon this moon and then we want both of them so how do we do that is it multiplication or addition that's right dora the explorer viewer that is addition so let's just add these again doesn't matter what order if you do alt s or not because addition is um there's a name for this it's not associative it's a commutative I don't know I've lost it haven't done math for that but that's the other way to do it so you can see we can make two different node networks that achieve the same result and yeah there you go you can try to do all kinds of Venn diagram challenges with this but really we are going to be using these concepts all all the time let me emphasize that we are going to be using these concepts absolutely all the time subtracting things from each other and multiplying and adding make sure you actually understand this video and then after this one now that you've completed it we're just gonna talk about how to group stuff so basically how how I made this node over here that's actually just a group of all these notes how I made that nice and compact and has one output and we're gonna talk about how to set that up and then we are gonna talk about extra coordinates which one thing that lets you do is actually make these circles in the first place because right now we only know how to handle something that is uniform the same everywhere so hopefully you enjoyed this tutorial if you did the best way to support me is via patreon you can donate there you get benefits but really the point is if you want to support me that's the way to do it likes and subscriptions help as well but just not as much but yeah one take not bad hopefully you guys enjoyed this hey guys welcome back to another default cube CG matter tutorial and today we are doing part 7 I think round seven of the procedural node series the blender procedural nodes and this as I mentioned before is going to be the last part of level one and from here on out we're gonna get into much much more complicated things mainly being texture coordinate so I want to congratulate you on making it this far and today we are just gonna be talking about our last topic for this you know baby easy stuff and that is gonna be group nodes and you may be thinking okay group node sounds cool but what is it okay and here's what I would say to that so here we have a node network this is should be almost if not exactly the same one that we did on part three or four where we talked about green screening and what we want to do is take this uh node network which is kind of I mean from our experience this is a pretty big node network but in reality this isn't too bad but we want to take something like this which is a mess and turn it into only like one or two nodes because this is kind of disgusting to look at and if you remember if you remember this node network specifically does green screening so what we did is we took a texture so you know any color background we just happened to use green screen Boop but a blue screen works as well we also had an RGB node which is the color of the background so this blew a blue screen we'd set it to blue and then we sent it through a bunch of math and then finally using this mixin ode we could then pick the background so we could have the red background or a you know make it green again for some reason but yeah so if you want to learn how to do that go back to that tutorial but again the basics where we took these two separated them into their red green blue components again these are three dimensional quantities they're they're vectors however you want to think about it and we just separated them into components and for each one we just you know took the difference squared it and then added everything together so that's why it looks like the same for RG and B and then we basically just computed the distance between these two colors creating a mat which we can control using this greater than note to be like oh how what kind of tolerance do we want and then finally we use this matte we made as our mixing factor for the for the foreground which is the image and then the background which is whatever we choose so there you go so let me just connect this again alt right click drag for that nice connection and now what we want to do is kind of like make it one node that we can plug two things into so instead of having all this math exposed we're gonna make this one node so we can plug in whatever image we want and then pick whatever color we want to do the green screening with and without getting like too in-depth to start off with what we can do is we just select everything except there are output so this is everything we want grouped together into one node so again you could do box selection or you can do any kind of suction and then you are gonna hit control G and that is short for group and you're gonna see that you know all your nodes are there the ones we selected and there's kind of like this green background thing going on over here and this is just indicate it's on the same group layer to get out of this weird menu you just click this button which is go up the parent node tree so we just click it and now we have one node and you know that's cool but as you can tell we've kind of lost all control we can't even change the color of you know what we want a green screen out or our source image or whatever we can disconnect we can connect we can even like do something in between like I don't know multiply this by 2 or whatever we can do stuff but we've lost all control so clearly we don't want to group everything we just want to group everything except the inputs and outputs and all that that we want really I just mean inputs so again if you want to look at your know tree and again this is a node group you can name it whatever you want and you're gonna see if this updates maybe it does an update in here there should be a node group section here it is node group and you can see we have our node group we can rename it like this is our green screen node group and it's gonna update here and this is useful I need to make sure my face cams out of the way this is useful because if you make a bunch of node groups you can then send them over to your different blender projects and that's how you don't keep repeating the same thing over and over and over again so you only have to make it once so that's part of the power of node groups but to look into this node group you just hit this button on the top right you click that and then you can see everything on this layer so let's get rid of this node group you can either right-click and then do ungroup or shortcut is ctrl alt G and you then have to just move it over okay so now we we are pretty much where we started off but now we want to do this a bit better so let's think about this what do we not want in our node group and so what do we want to be able to change later outside the node group well we want to be able to change again what we're inputting we want to be able to change the color so let's start with that so let's say we select everything except those and then we're gonna hit control G and then we're gonna go up to the parent tree well now we have a node group that actually has inputs and you can see it has two inputs for the texture one for you know just choosing the texture and the other one goes to the mix node from before and then we have a third input and that is the color of our background but now but now what we can do is we can change the image so I'm going to take this texture and I'm just going to choose the second image I have now since this has a similar green it should work whatever color show's over here but again you can try to fine-tune this so let's switch to RGB and you could like you know you can see that you can do different green screen stuff so this is our green screen node and then we can plug in any two things over here but of course there are a couple issues first of all why do we have two inputs for the same thing I feel like we could do it with one input it'd be different if there are like two different image textures but because of the logic of our node group we want this input to go to both and second of all we want to have a bit more control like that a greater than value they'll let us pick what we want in and out of our map we'd like control over that as well so wait first of all before we fix those things let me see if I can pick the best shade of green remember we can use this eyedropper and now let's delete that yeah so for example we do want that greater than value so we can control that so I'm just gonna control all G that is ungroup and try to reorganize everything there is an add-on as well other than a node Wrangler I think it's called node arrange that should handle stuff like this but let's ignore that for now so the first thing we want to take care of is not having to have like two inputs just for this image texture and you can see it's because because it has a two wires going to different spots and I don't think I talked about this yet but we can actually use something called rerouting and the way you do this is not control right-clicking or shift right-clicking but whoops but your know it is shift right-clicking I was trying to say not control right-clicking or alt right clicking so you hold shift right-click drag over any two or three or however many wires and you're gonna see that it creates a reroute but actually connects them so basically we have our color going here and now that one is what branches off into two so if we group now if we group everything including this reroute and again you could just by the way you could just type in reroute and add just this node here that you can add two different areas and this is just for like a graph organization if you just do it on one wire but what we're gonna do now is we're gonna select the same nodes as before but then also our and then control G and let's go up the parent tree and now we only have one input for our image texture and one input for our color that we want a green screen okay cool so how do we make this even better well first of all maybe you're sending this node you're selling it or whatever you want some better names here how do we do that so those are just organization stuff so in here you click n for properties the same way you click and up here it's a window dependent so this is what happens if you do it in the shader editor when you're in a node group and you can see we have our inputs or outputs so make sure you're on this node tab over here so you can see we have our inputs all the names and then our outputs and if I haven't already mentioned it you can see once we're inside this node group basically you can see we have our two inputs which are really from out here and the background so you plug stuff in to this node group and it comes out here does it stuff and then goes to the group output so normally we do nodes to the material output node to the surface socket or whatever but here inside a node group the name of the game is you start with your group inputs do the stuff in between and your group output so what I'm gonna do is change the group input name so it's just like the first one and the first one is actually you can see image is going down here and this is the one that we actually choose the color of our green screen and I want this to first of all be the second option not the first so I'm just gonna click it and then drag it down or just use this up and down arrow and then we can rename this to maybe keying color you know what color you're gonna key up and then for this input we can choose let's just say like inputs actually pretty okay but let's do input image something like that so now these are renamed it doesn't change anything but it just makes it more organized for the viewer if you send this to somebody and then you can also see we have this default value and this is gonna change depending on what it is that you're doing here so here we have colors you could also have values or vectors so this default values basically what it's gonna be when you don't connect anything to it so what is it going to be by default so for example if the math know with the math a note you can see that by default these are 0.5 there's no reason this couldn't could not have been 0 but it's because blender chose 0.5 is the default value so for the keen color maybe it would make sense to you know I guess it's already has this kind of green let's just do blue just to illustrate a point and now when we go up our tree we have our renaming and then I'm just gonna disconnect everything and then normally you have to actually re import in the node group before the default values refresh and everything so you can either do that by you know shifting now that this thing exists you can type in the name which I think was green screen and you can see now it shows up but I guess this was our first node group before we started messing with stuff so the second thing you can do is go down to group and it will list all the node groups you made so I think it's probably the newest one and now you can see it has its default values inherited and blue is what we set for default but of course what we can do now is just connect what our input images let's make that a bit bigger and then our key in color and let's connect that to our surface so there you go and let's actually do a bit of cleanup so in our node groups I said if you if you don't have all these options go here and choose blender file instead of I don't know you're probably on view layer blender file this again lets you delete stuff from the file itself so let's delete our green screen node group our node group node group and we can rename this one we can rename this one to a green screen final and you can see changes the name over here and now we said we wanted a couple more things I think the main one was actually adding a value input for our greater than and again if we go into here our greater than is this one right here and we want to control this number and you can see why we would want to do that because before we had it somewhere here and there's a bit of clipping but if we just drag this down it actually solved the issue so we we like controller that so normally what we do is if this wasn't in a node group we just put a value in here and just connect it so we can kind of control this externally but of course we're in a node group so what we want to do is for this we wanna use something from our group input and again we want to make a new one so you can see we have our two inputs and then a blank slot which is for adding stuff so what I'm gonna do is I'm gonna take this the the third one in this case and connect it to greater than and you can see effectively this added a third input and it automatically knew it needed to be a value again that's like a one dimensional it's just a number it's just a value and it's not a color which is like almost the same thing as a vector so it automatically recognized what it needed and then for our value we can give it a name something like you know threshold would be appropriate and again for this one the default value stuff gives you even more control so first of all we can choose what a default value what default value we want so let's say one when you don't connect anything to it or you don't specify what you want and then the second thing is if we kind of exit out of here you see that this already gives us a nice slider that we can control and it does you know what it would have done if is connected to the greater-than node but you can see we can kind of go negative positive and in this case there's no reason for us to go negative so we can actually like clamp we can make a cut-off so we don't want somebody to scroll beyond zero so we don't need negative numbers and then for maximum I made a mistake in that tutorial I said you wouldn't want to go above one because the distance between any two colors can't be greater than one but that's not true it's actually square root of three which is kind of obvious once you look at it from the sense of this equation because you can have a maximum distance of one between your red valleys green values and blue values you add those square root square root of three so we wouldn't want to go above square root of three which is like one point something so let's say two is the highest you can go you can get more accurate I wonder if you can actually type in like square root of three no apparently you can so there you go and now let's see do we need a refresh notes you see it doesn't go I'm trying to go left it doesn't go under zero if we type in negative one I guess you can't override that but there you go or you can override that that's the issue and then we can't go higher than square root of three but now we have control over this and it has a nice name and then finally probably the last thing we need for this one is for our output and by the way you can have multiple outputs for a group for a group note in this case it doesn't really make much sense because what we'd want to output is our image but we all actually add another one just for demonstration but we can rename our color output and again default values and everything you know how that works now so let's call this keyed like output or something because that's what it is and you can see just like our group input we can have more outputs and that will specify what it is when we actually make it and maybe it'd be interesting to also output our mat and this is just the black and white image that we're using as a factor so I'm just gonna connect this automatically knows it's a value not a color it's a black and white you know it's just a number it's a one quantity and we'll call this our mat and this is something actually that's kind of realistic that you do so let's in this case default value and all that don't matter because it's gonna be determined by this math so let's go out and you can see now we have you know we can change this I'm just gonna go back to our I guess we don't have to really we'd just select it from here so green screen one and then just to make sure I'm just going to view this and then select the shaded green I want just in case it's a bit different so again we can do all that and we have our group node and everything's nice but then we can also view our mat which again is the black and white image and maybe we want to do something with that I don't know what it'd be maybe maybe we could do something like this so now that we've done all the calculations we can send this now through a mix RGB we're gonna send the set this to multiply let's say and we haven't really talked about what all these blending modes do but right now I'm not too worried about it so we're gonna set it to multiply and let's have it multiply I want to only have the background so remove the person it's gonna look like black where the person is and then blue elsewhere so let's multiply it by the Matt I believe and then we have to invert it is that right no I'm going crazy let's see what does this look like yeah that should be right I don't know it's not giving the other area goats because of this mixing factor so once we have the mixing factor of one it's just going to do the multiplication how we'd expect and without like too much explanation because this is a group note tutorial what's happening is we already talked about like math with regions so you should now understand this what we're doing is we're taking our image and then multiplying it by this where anything in here is going to get multiplied by zero and therefore be black zero and everything here is multiplied by one meaning it's going to be whatever value was before so just retains whatever color that is if this was two right in the background it'd be like a brighter blue in our output and I guess we could do that just to again prove a point now I don't think we're gonna see this currently because of our color space but I guess you know you could do values in between and that controls the brightness of the blue so if we want to are we already in filmic standard I guess it does work so there you go I feel like you now know everything you need to know about group notes and if we were to go to a new blender project what we'd have to do is let's say we want our green screen node you go to f3 or spacebar or you know file append but I'm just gonna type in the command append and then you just want to choose the blender file you just worked on for me that was untitled and then you're gonna find either in materials you know we have our green screen material or like we don't need the whole material we just need the node group you can go to node tree and then you can see our green screen final and you append that and now in our new project that again this is independent from our previous one now if we go to group we also have our green screen and you know it's a nice looking node this is something you could sell for like nobody would want this but you know it's a good example so now you understand everything there is to know about group notes how it helps you organize how to control your inputs your outputs and you know append and all that so you you guys made it through level one congratulations this is where it starts getting really really mathematical we'll tell you that you know you could learn nodes without math anybody know you need math and the math happens to be pretty simple in most cases but this is where the math starts laying on not too badly I think the next thing we're gonna do is probably just make a circle that we can control but um yeah there you go hopefully you guys enjoyed all the tutorials for level one I think I'm gonna upload this as one segment of the course so I'm just gonna make it compilation video but um the best way to support me now that you made it through level one and you've gone your free education is via patreon so if you appreciate the series and want to effectively you know donate to me but then also get some benefits and there are some nice ones there's some hidden information you'd only know via patreon right now if you want to do that there's a link in the description it'd be very very appreciated but other than that thank you guys for sticking through level one there are twelve thousand of you to begin with as I'm recording this losers they're out of here now and now we're down to like 6,000 or 5,000 or something so you guys you guys have made it past this threshold we'll see if you make it pass although to thank you guys for watching that's it
Info
Channel: Default Cube
Views: 302,928
Rating: 4.9623446 out of 5
Keywords: blender, procedural, nodes, shading, materials, tutorial, easy, level 1
Id: O3gLBhC353Y
Channel Id: undefined
Length: 121min 27sec (7287 seconds)
Published: Tue Jan 21 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.