The Ultimate BEGINNERS GUIDE to Materials in Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys justin here with the realtimeessentials.com back with another unity materials tutorial for you so in today's video we're going to talk through the basics of materials inside of unity how you can set them up inside your projects some of the things you need to know in order to create more realistic materials things like that so let's go ahead and just jump into it so let's just start off really simple let's just add a game object so i'm just going to add a plane right here and we'll go ahead and set our location to zero and then i'm just going to add a cube so i'm just going to add another object over here it's just going to be a cube and again i'm going to set it to 0 0 0. and this will be good for right now so we'll bring this up and we're good to go so at the moment notice how these are just being shown as kind of like the default material right it's kind of a whitish grayish material it doesn't really do anything that's because we haven't really given any information as to what the materials on these objects should be so the first thing we want to do is let's create a location in our project assets for those materials to go so let's just come in here right click and let's just create a folder and we're just going to call it materials that's where we're going to store all of our material files and information for this project so notice how there's nothing in that right now we can double click in here and we're just in an empty folder well now let's add our first material so what i want to do is just right click go to create and select the option for material and so for this material we'll just call this something simple like red so i'm just going to come in here type in red and we're good to go so notice on the right hand side of the page there's a lot of information about this material that we can adjust in the inspector and that's going to show up whenever we select the object inside of our materials folder so first off notice how there's a lot of different options in the drop-down four different kinds of shaders so those are going to be things that tell unity how to display different things inside of your program so there's options in here for like sky boxes which can act as a background there's a lot of different things in here if you click on them notice how there's just a bunch of different stuff for now we're going to focus on the standard shader so that's going to be the shader that unity uses most in order to basically generate materials and so let's take a look at some of our options so first off the place where you're pretty much always going to start is going to be your albedo so your albedo is going to affect how your material looks so in this case if we click on this notice how this is going to bring up this color picker you can use the color picker in order to set the color of a material so you can click in here you can use the eyedropper to select something from the screen but notice how this material now previews as this red material down below so notice how that's not affecting anything in our scene though so at the moment these are just if we click on them and we look at our material that's applied to these these just have the default material in here but let's say we wanted to apply this material to an object well all you have to do is just drag the material out of your materials folder onto an object on your screen well notice how now this plane shows up as a red plane so it's basically taking the information from this material and it's applying it to that object and so notice how if you make an adjustment to this red material so let's say we made it a little brighter it's going to get brighter in our scene if we make it darker it's going to get darker so this is kind of a live link back to this material file right here and so let's take a look at some of the other options in here i don't want to get too far down this road we can talk more about this in the future but notice how for example if i was to drag this metallic to the right notice how the way that this material is interacting with the light is going to be different so notice how the light is now reflecting off of this as if this was a metal in a way that it wasn't before when your metallic was zero so usually your metallic is going to be either zero or one um so if something is metal then you want it to be one something isn't metal you want it to be zero so smoothness is going to affect how reflective your material is so if i drag this to the left notice how less light is reflecting off of this if i drag this to the right notice how more light is reflecting off of this if i turn this to one notice how this is giving me a really strong reflection of my sun in this material so usually your smoothness is not going to be set to one it'll be somewhere in the middle here okay so in addition notice how we have other options in here for things like normal maps and height maps and other things like that so we'll take a look at that in just a second so a lot of this is going to have to do with what these are going to look like if you actually apply like a texture file to them so instead of applying a material in here we would apply an albedo and so what the albedo would be is the albedo would be an actual file that would make this look like something but for now let's start by just creating a simple blue material so we've got a red material in here i'm just going to right click and i'm going to create a new material we'll call it blue and actually we'll call it um we'll call it blue dash reflective so all we would do to make this a reflective blue is we would just come in here and we would select a blue color like this and then we would turn our smoothness up and so what we could do is we could take this reflective blue material and notice how we're getting a preview of that material down here we just drag it on top of this object right here so notice how now you've got a blue material applied to this that's going to reflect things like the sun and so one thing i do want to note is notice how you can change these on objects so for example with our plane right here if we wanted our plane to be the blue material all we would have to do is just drag the blue material on top of this if we wanted our box to be red we could just drag the red material on top of this or if we wanted them both to be red we could drag the red material on both of them so notice how you can inside of the object with that selected adjust the shader and so when you do adjust the shader like this notice how you're adjusting the overall material so notice how if i adjust the material on the box the material on the plane is adjusting as well you're adjusting the red material right here all right so now let's say that we wanted this to be something more than a color let's say we wanted this to be or let's say we wanted to create like a pavement material so you're not going to create a pavement material just by using a color you're usually going to create a pavement material by using a texture and so what we're going to do is we're going to jump over to a website where you can download textures and so i'm going to a website called polyhaven.com so this is a repository of free textures that you can download there's actually other things like models and hdri images which we're not going to focus on today but we're just going to browse in our textures all right and so let's bring in this dirty concrete i think that's going to be a good one so we'll click on the dirty concrete one concept that you need to understand when we talk about materials inside of unity is the idea that we're trying to simulate realistic materials using light and so basically what that means is that means that the engine needs some information in order to simulate things like the way that things reflect in the real world other things like that so if we look at this material and then we click on this little button right here notice how there's a bunch of what's known as pbr maps these are basically maps that contain information about the way a material is going to act in the real world so we'll talk more about these in the future but we're going to want these maps because they're going to make our materials more realistic and so i'm going to link to a guide that i actually did on my rendering channel but i'll put it up on my realtime essentials channel as well that you can download will actually kind of walk you through some of that stuff so it's a pbr materials guide and it'll tell you what those do read through that because it's going to give you a good idea of what these are going to do and then we'll go ahead and bring these into unity and we'll just select the option for gltf we'll set this to 2k for right we're going to go ahead and download this file right here so we'll download the dirty concrete folder then we'll open it up and take a look you can see how that has a textures folder and this actually only came in with a diffuse a normal and a roughness which is fine it's a little weird because there were other ones listed on here but let's go ahead and let's do an extra large icons in order to preview this so basically what this came in with is this thing came in with three maps so the first one is the diffuse map um this is also going to work as your albedo that's going to be the map that we're going to load in that's going to basically be our texture image file that's applied to the actual objects inside of your 3d model so there's also a map in here which is a normal map that is basically designed to tell this uh to tell your 3d engine where things should look bumpy so if we zoom in on this notice how there's actually color information that's kind of encoded in a red green and blue so basically the colors in here tell the engine how far up things should be which allows it to simulate bumpiness and finally there's a roughness map which is supposed to tell your engine how much things should be reflected in different areas so let's go ahead and let's bring this into unity so the way that we're going to do that is we're just going to jump back to our scene right here let's go ahead and let's create a new material we're going to call this ground dash dirty concrete and let's go ahead and let's apply that to our ground so notice how right now nothing is happening so what we want to do is we want to load those three maps into our materials over here and so the way that we want to do that is we want to start let's click on this little circle right here we're going to bring this in well the problem is at the moment we haven't actually brought those textures into a folder that we can use so we want to go back to our assets folder we want to create a folder we want to call that textures so that's going to be where we're going to keep our information about our various textures and in this case i'm just going to take we'll just use the diffuse in the normal for right now i'm just going to drag this into the textures folder like this so now these textures are contained inside of our project file well now if i was to go back to my ground material we could click on this button right here and go find that map so in this case notice how we can bring the dirty concrete map in here this is going to apply this to our material so let's just double click on this and let's take a look at what this did so what this did is this basically came in here and this applied a repeating material to our ground plane so now instead of our ground plane looking like a color it actually looks like a material and notice how we can adjust things like the tiling in here so this is going to adjust how many times a material repeats inside or on your faces so one thing to note about this is you do need to be a little bit careful if notice how if i drag this way to the right i'm getting a lot of distortion in here so most of the time you want to you want to adjust your tiling proportionally so for example if i want this to be one and a half bigger here i probably want my y to be one and a half bigger here so you can also use your offsets to adjust how this lies on a material inside of unity and so what we want to do for right now is in addition to using our albedo we also want to apply our normal map so if we click on this right here this is going to be our normal map so we want to click in here we'll notice how when we click on this and load it in now this concrete material looks a lot more bumpy right so this is basically using the information contained inside of that normal map in order to make this surface look bumpy now one thing to note about this though is you are getting an error in here that this texture is not marked as a normal map so what we want to do is inside of our textures we just want to select this material and make sure that we set our texture type to normal map like this and then we want to click on the button for apply and so when we apply that now if we go back and look at our ground material in here we're not getting that error anymore you can also adjust how strong the normal map effect is by adjusting this value right here so if i type in a value of 2 it's very pronounced if i type in a value of 0.5 it's much less pronounced and so a lot of this is kind of an artistic decision so you can use this in order to set how much your material or how much the light is going to reflect off of the bumps of the material all right so this should give you a good idea of where to start with materials inside of unity we'll talk about a lot more in the future but if you want to download that pbr materials guide i will link to it in the notes down below if you have any questions on anything feel free to leave them in the comments down below i'd love to try to help out as always thank you so much for taking the time to watch this i really appreciate it and i will catch you in the next video thanks guys
Info
Channel: The RealTime Essentials
Views: 736
Rating: undefined out of 5
Keywords: unity, unity software, unity 3d, unity 2020, unity 2021, unity textures, unity materials, unity PBR maps, unity maps, unity PBR materials, unity create materials, unity materials for beginner, unity material beginner tutorial
Id: aiTl7B2xTmA
Channel Id: undefined
Length: 13min 50sec (830 seconds)
Published: Tue Oct 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.