UE5 Series: 02 Intro to Materials in UNREAL Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Understanding Material Graph in UNREAL engine 5 is probably one of the first areas to explore when you start with the application. We’re taking a step-by-step approach to create
Materials and talk about the surface properties of objects in UNREAL 5.  If you are a beginner and would like to know more about this topic then this video is for you. I hope you enjoy it.

👍︎︎ 1 👤︎︎ u/SARKAMARI 📅︎︎ Apr 20 2022 🗫︎ replies
Captions
hello everyone reza here welcome to my channel we are going to continue with our unreal engine 5 series and in this video we are going to explore materials we'll learn how to create a material how to use material graph and how to apply textures to our materials in our unreal engine 5 scene so we've got a lot to cover let's get started so in the previous session we actually created this ue5 lessons what i can do is to create a new folder here or to double click on the icon and that takes me to our project browser you can create a folder for this session via this browser as well here we are going to go to film blank and let's create a folder new folder and it's going to be material i'm going to select that folder and for the project name i'm just going to call this lesson to underscore materials simple as that we want content browser to stay on we get some goodies with that we get a lot of textures materials props we may or may not want to use it but i still would like to have it and um we don't need ray tracing with that i'm going to go ahead and go create here we are inside unreal engine now hopefully you all have watched the previous video where i talked about the user interface world outliner content drawer how to drag and drop objects navigations so on and so forth so we are not going to cover that but what we have in the scene is just basically a simple static mesh floor mesh so let's put something on this scene using the starter content that we have i'm going to go straight into props and have a look at what we have probably this matte preview is a good starting point i can kind of click on that and i'm going to press e to rotate it in z-axis so we get that beautiful golden looking u pressing f on it and we have the scene of course at any point of time where you feel like you reached a level you can always go ahead and save your current level a project file is out of date not a problem just go ahead and update it from this point onward we are going to just focus on how to create materials i can select these lights and press g on it so we hide them for time being from our viewport not from the scene just the viewport and let's go to drawer content and let's put together some folders we would like to always stay organized and we would like to have our own folder so i'm just going to go ahead right click new folder call this lesson02 underscore materials and you can double click on that and i would like to create two folders in here one folder is to hold the actual material another folder is to hold textures we want to get the terminology right and if you look at the starter content we actually have the same hierarchy we've got textures and materials so basically all i need to do is just to go in here rename what i have to materials we will be having more than one material and i'm going to rename this to textures well it's already set to textures we have more than one texture and again if you would like to get the lingo right you always can come here and have a look for example there is a folder for shapes there is a folder for particles there is a folder for your levels there's a folder for all the blueprints so you can kind of mimic that and sort of understand why we do what we do all right we have these two folders let's go ahead and create two materials i would like to have one material for the ground level and i would like to have a one material for this sphere to begin with static preview mesh that we have so let's go ahead and create those to do that it's really easy you go to the folder that you want to save the materials and you just right click and you go material now this material doesn't have any specification it just comes with its default values and attributes but we will get to that really shortly first things first we would like to name it i'm going to call this floor underscore matte which indicates that this is a material for the floor so i can just simply drag and drop it onto the floor we don't see much of a change because obviously this material is also a default material and i'm going to go in here and right click and create another material and i'm going to name this one matte preview underscore capital mat which indicates that i'm about to apply this material to this matte preview object in the scene that's the name of the object and i'm just going to drag and drop it and we get that nice checkerboard now what should we do with these two guys how are we going to edit them we have the material but there is no attribute associated with those materials so that's actually very very easy let's go to the next chapter and see how we can use material editor or material graph to our advantage now once your materials have been assigned and ready to go we can go ahead and edit them well how to edit them simply by double clicking on them as soon as you double click on the material you will be getting the material graph as a floating window one way is to just go back and forth between background and foreground another way is to just dock that as a tab so i'm just going to left mouse button drag that right next to my main window and there i have my material tab now be mindful of the fact that this material tab only linked to this material so each material gets its own tab as opposed to some common 3d software packages when you have one common shared environment for all the materials you get a material graph per material what does this mean that i can double click on this material match preview and basically have this as my second tab so this window to work on the floor and this window to work on the matte preview let's actually start with matte preview and explore this node right here first things first let's have a look around this window and see what is available to us how to navigate in this window simply hold right click and move your mouse that's how you move to zoom scroller it's going to basically zoom in and out in and out same rule applies here scroller to zoom in and out in your preview page where you change your material and see the update in this window and of course if you select any of these nodes the attributes will indicate what you need to change with regards to the selected node that's not the only node we have plenty of nodes to choose from as a matter of fact just to show you how big this window can be i can go to palette and show you all the nodes available to us all the nodes that we can access and bring into this scene and you can see how long this list is but don't let this overwhelm you or intimidate you because we're starting with just the beginner level we are not going to use too many of these guys and another way of accessing these nodes is by right clicking so if you right click if you know the node you can actually type it in another way to do it is just to press tab and you bring the same node the good thing about that is actually brings the categories for example if i want to access the vectors i don't need to go through this long list to look for vectors i can just press tab and scroll all the way down and i get to vectors and that's going to kind of shortlist what i need for me now let's go through these guys and see what each mean so base color is basically your base color weight the color that would you would like to assign to this object then we have metallic and that carries all the metalness values you may assign 0 to 1 to turn a completely rough object into a metallic object or you can assign a black and white map to this metallic value and at any point of time i can hover my mouse left mouse button and drag and you can see i get a wire and that wire can get connected to another wire and that's how you actually assign an attribute to this material node then we have specularity or specular which is in charge of the amount of specularity or highlights or reflections that you're getting on this model it can be as a form of a float value zero to one zero non-specular completely rough and one completely glossy but you can also give this attribute also a black and white map now the way that specular works is opposite to roughness how rough the surface is going to be and based on that you get a much rougher value or glossier surface so zero on this is going to be no roughness it's going to be 100 glossy the surface and if you set the value of roughness to one you get a completely rough surface and not much specularity can be seen chances are you're going to use one or another not both of them anisotropy specifies how stretchy your specular highlights are going to be and you would see that in kind of brass metal surface or compact this where the specular highlighters are usually stretched along the surface and you would like to create those type of effects you can specify a value or you can just use a map to have an impact on only a region of your model which i'm going to admit is not that common and then you get emissive the color where you would like one part of your model to have self illumination or the entire model and with that you're just gonna plug a color to this channel or even map in conjunction with the color and you get self illumination and somehow a glowy sort of color appearing on the surface the rest of these channels are auxiliary channels the one that we do use the most is going to be normal this channel expects a normal map it's an rgb texture that you provide to the application and you can create normal maps in variety of techniques using variety of software packages we're not going to talk about that but that's probably the most common one that you will be using at least at the entry level of adding materials and texturing within unreal engine 5. now with that said let's talk about constant expressions and how we can use them to our benefit to assign values to metallic specular or roughness and at some level add colors to our base color or even emission value now if you start with unreal engine 5 material graph probably constant would be one of the first five nodes that you need to know there are two ways of getting the constant note into the scene one way is to right click on it and just type in constant and you get constant another way is to go into palette and type in constant now you immediately notice that we have not one but one two three four five constant nodes we've got a normal constant node and a two vector three vector for vector and constant double we are not going to talk about constant double but we do talk about some of these guys um because they're actually quite important and you can see we've got shortcut assigned to each one of them right now let's start with just a normal constant value so or constant expression rather so i'm just going to bring constant click on it and the shortcut for it is number one if i hold down number one key on my keyboard and left mouse button click i can just click and create constant notes what is a normal constant node let me just select them and delete them bring this guy into the position snap it and get it close to this preview matte node because i'm about to actually connect this guy to some of these attributes let's talk about what a constant node is so this constant expression node is just a simple single float value that float value can go from minus infinity to plus infinity and the default for it is zero what does this mean it means that you can actually apply this expression to any input and change the nature of this attribute now we know what normal constant does let's go and explore other constant values because to begin with i actually would like to give this ball a color before i apply specular roughness so on and so forth so the next constant is called constant 2 vector and the shortcut for it is two on the keyboard so if i hold down two and click i can get this constant note now this uh constant expression has got not only channel r which is just a simple float node but it has got also channel g so if i click on it and look at the details window you can see you've got r and g but to get uh the proper color range we need rg and b and the channel b is missing so probably this is not the best pick if you want to channel that or plug that to your base color so this output provides two channels vector values for us um with two constant numbers you may say if channel b is missing why we're even using this what's the use well it's actually very useful to use constant 2 vector to modify texture coordinates simply because texture coordinates are usually green yellow and red again useful but not when you want to apply that your base color so we are going to remove that the next one on the list is constant three vectors and the shortcut for it is uh three on the keyboard so i'm just gonna hold three on the keyboard you can click on this as well but just to practice those shortcuts three on the keyboard click and we get three channels r g and b if i extend constant you can see now we are getting the full range so constant three vector expression outputs three channel vector values basically there are three constant numbers r g and b now we can connect this to our base color so i'm just gonna click left mouse button drag and drop into base and we're not getting any result because the color is still black i'm going to double click and increase the brightness and now it's time to use this color wheel to pick a color let's say i'm going to make this um blue and i'm going to go okay now every time you make a change every time you add a node you need to press apply to apply the changes so far what we see is just a preview of what's going on if i go to my main we still don't have the material i need to just press apply so the texture gets compiled or the shader gets compiled through the material graph and only then if i go to main i get the result i believe my matte floor shader is missing so there you go reassigned it again so that's how you apply material using a normal constant 3 vector you may be wondering what constant 4 vector does and constant 4 vector is actually quite useful i can press 4 and click and that uses alpha channel to its advantage so what basically you can do you can have one channel goes to base color another channel goes to opacity and create see see-through objects we are not going to talk about that at this stage but i'll make sure to put together a tutorial and talk about more intermediate to advanced material video so with that i can actually double click on it and change the color to whatever i want i can darken the color if i want right and make the color richer make it more vibrant and of course apply and see the result now that's where you can actually use this constant float expression now you can say that all right i want to change the value of my roughness so all in a sudden i get zero roughness look how shiny the object is and you can use the same node and say well i don't want to get roughness really i want to get specular the way that you break this you right click on the channel and you go break link to break link to material expression constant of course another way to do that is to hold down alt and click and you break the link now let's say i want to take that to specular which does the opposite and now you can see zero doesn't make the object glossy it makes the object rough that's why these two are kind of working against each other and you better to pick one i tend to use a roughness a lot i tend to use roughness a lot i don't use specularity as much because of the workflow that i'm using so alt click and i go from roughness to the constant note or the other way around and all of a sudden if i go and apply my sphere gets very reflective now same rule applies when you want to add metalness so i can hold down one and click and we get a value you go ahead and assign the value and right now metalness is set to zero i can set metalness to one and all the sudden we're getting a super metallic conductive object or material i can go apply switching back and here's my metal chrome ball so you can see how simple that is to apply nodes to your model you can even combine and mix and match if you wish so let's go to the next chapter and see how we can use lerp node to our advantage to basically mix to the base color that we already have all right let's say i'm going to bring another constant pressing three left click and i'm gonna give this one a completely different color i just wanna get that contrast really i can just close the stats window we really don't need it i'm gonna go to content drawer and i'm gonna go to texture and i'm ready to bring in my very first texture i'm going to right click and i'm going to go import to lesson 2 i will be using desktop lesson 2 and i've got a folder called texture and i'm going to bring my own logo it can be anything that you can bring just browse and just find a black and white map that works as your mask if you want to combine two textures two maps what have you now to the way to combine the two one way of doing it is to apply a multiply and then channel the multiply to your add node and bring it to your base node that's how we used to do that in older versions but now we have a lerp node if i press tab if you type in interpolate we have linear interpolate and that's a very useful node because that allows you to have channel a to have channel b and to have a black and white alpha channel to mask between the two so i can go and press alt click and i can probably deactivate metalness as well and say well channel a goes to blue channel b goes to red and now i can just drag and drop my textures in there and this is going to be my alpha so i'm just going to bring this one here which is a texture sample and i'm going to say all right this goes to alpha every time you bring an image you're bringing a texture sample you can even press tab and called texture sample to the scene and from here actually go ahead and bring in whatever texture you have in mind now usually unreal is going to re-link the last texture that you used but you can actually browse through your library and pick any texture that you want and use it just so you know now this is ready to go i'm going to go and connect that to my base color and look what we have if i just change the shape of our um preview mesh you can see now the black portion is getting the color from color a and all the remaining what portions they get in color from color b so that's how you actually combine two nodes with the help of your lerp node or linear interpolate node to be able to achieve a slightly more complex result now let's go to the next chapter and see how we can bring in and assign textures to my base map and to my specular or roughness and make use of normal as well to get a more pleasing result so let's go to the next chapter i'm going to unplug these guys and see you in the next one now we have a few materials we've got floor and we've got matte preview it's time to bring some textures so i can plug them in here again if you would like to follow along feel free to use textures from this folder under starter content i'll be using some of my own textures so i'm going to bring in few textures so wood planks for the floor and i'm gonna bring another set for my matte preview guy so everything is ready to go i can actually go ahead and clean up this scene a little bit i may or may not use these guys but i would rather have a clean slate so we know what we're doing now again keep that in mind you don't want to bring everything into the scene each material graph is linked to a particular material so right now i'm in matte preview material and that's why it's important to name your materials because then you're not going to get confused what window or tab belongs to what material so with that let's bring in the materials i have for my matte preview now you can double click on these guys to see them this is reflection i can go in there by the way you can always dock this uh into the layouts you don't need to press ctrl spacebar every single time i personally don't mind this is the color version and this is ambient occlusion and this is my normal map now one very important thing that you need to be mindful of is color space what color space you're using so with base color you would like to get srgb and make sure that srgb is enabled however if you have normals you need to make sure that srgb is unticked and again unreal angel is smart enough to realize that that is a normal map right so i'm just going to bring in a normal map and you can see that unreal engine under details specify this map as normal whereas if i bring this color map unreal engine says well your sampler type is color and if i double click on the map in here srgb is ticked however it's not that straightforward for all of them for example i've got let's say reflection which is my roughness map if i i'm just going to delete this right now if i double click on this you can see srgb is on it needs to be off because with data maps such as opacity map metallic map roughness map you need to make sure to set this to linear color space not rgb color space so i need to make sure that this is off and then i need to save and only then i'm going to press ctrl spacebar and bring my roughness map and now it says that all right your sampler type is set to linear which is a correct sampler type so be very careful on that and try not to make mistakes because inaccurate color space is going to change the nature of the material your material either looks odd or it just doesn't do what it's supposed to do we have another one which is ambient occlusion we are going to do the same thing for ambient occlusion and we are going to save and i'm going to bring that data map in as well because well if we can use ambient occlusion then why not so let's plug them in and see how we can benefit from these maps well it's actually very straightforward after this rgb goes to base color and if i go ahead and apply and go to main we should be able to see the result and it shows the result beautifully i can go to and plug my roughness map and of course i'm going to apply and it applies roughness only to certain part of the material so it's not going to be um as intense i will be having ambient occlusion which is quite useful plug and drag and drop and that mp ambient person is going to kind of intensify some of these some of the shadowing effect that i would like to get adds more depth to what i have so you can see i'm getting more ao to my scene which looks fantastic and of course uh normal which i can just drag and drop apply normal map and that plays a massive role in terms of getting realistic looking result i'm going to press apply and go in there and you can see right off the bat we're getting a really really good result now the tiling needs to be changed and i will talk about that not to worry but for now we're um moving forward as planned at any point of time if you feel like um nope this doesn't do it for me i really don't like what i'm looking at well you know what to do number one and left click bring a constant and let's say all right i really don't want to get that level of shininess i can just add a value and make the whole result a lot rougher so you can do mix and match and get a slightly different result now with that done let's go ahead and do the same thing for our floor so i'm going to go to content browser and this time i'm going to bring the wood material and drag and drop into the base and i'm going to go apply to the main we have the wood grain nicely presented i'm going to go to the content drawer and make sure that my reflection map doesn't have srgb it is linear so saved and bring it to the scene drag and drop it to the scene so i'm going to go to matte preview bring it to the scene and plug it to roughness rgb to roughness and of course we have with planck's normal map which i can bring and just apply to my normals and that immediately really adds realism to what we have in the scene so if i zoom in you can see i'm getting a really nice looking result that's perfect let's go to the next chapter and in the next chapter we are going to talk about how to deal with tiling because obviously tiling is off for actually both models um i might actually select this and rotate it ever so slightly in 90 degrees so the wood grains are going actually this way that's much better let's go to the next chapter and talk about [Music] tiling now to do tiling you really need to target the uvs of all of these nodes so we have in every texture sampler we have uvs that we need to be mindful of if you don't use texture sampler then you're off the hook but if you're using texture sampler you need to make sure that if you assign a coordinate your uvz asana to all the texture samplers in one go otherwise you will run into some discrepancies now let's just dive right in and see how we can tile our material that's actually fairly straightforward you just click and then you type in coordinate and the first node or expression that comes up is texture coordinate now texture coordinate expression outputs uv texture coordinate in the form of a two channel vector and that's why we're using this in conjunction with constant two vectors because they both have two channels now this by itself is not going to do anything i need to have a normal constant as well so i'm just gonna hold down one and click and say all right um this although we have tiling u and tiling v i still need to specify their value how much or how often the texture needs to be tiled how to connect the two you can just use a simple multiply node so i'm just going to use a simple multiply node in the case of the lerp node we really don't use the alpha so just a simple multiply node can do the trick for us and the output goes to this uv and it goes to this uv and the output goes to this uv so make sure whatever you do you apply to all of the texture sample nodes now everything gets controlled by the help of this value and this value is set to zero meaning that no tiling whatsoever i can set that to 0.2 and all of a sudden we're getting fewer tiles than the default of one so if i press apply and go to the main we're getting a much bigger pattern and that's how you tile your patterns admittedly this looks a lot better i can even go to um 0.15 and this will get applied to all three nodes i can go apply and go to main and this definitely looks much better at any point of time if you would like to save your graphs and i highly recommend you to do so you go ahead and save them and that saves your material that saves this graph so make sure to do that by the way in order not to redo the whole thing you can always press ctrl c go in here and press ctrl v to copy and paste them so you don't need to kind of redo the tiling nodes that goes in here that goes in here and that goes in here of course so you get fewer tiles i'm going to go apply and let's see how it looks that looks much better so that's basically in a nutshell how you apply materials to your model how you create them how you assign textures to them at any point of time you can go to your material let's say you would like to create a brand new material you go material call this emissive and let's say i'm just going to drag and drop it on to this and you can just go in there double click on this create a constant so holding down three let's say i would like to just make these guys metallic hold down one go in here and go to metallic and set this one to one and then i click and create another one to specular and set this one to zero apply and create a base color for it and go apply and you can see how quickly we're kind of back to normal so very very intuitive very easy to use and i personally love this workflow and the way that you work with these individual windows is very intuitive at any point of time if you wish to change any of these materials let's say i want to change this texture to any of these textures that i have in the material outliner you can do that of course you need to do that respectively with your roughness map and with your normal map but it's actually very very simple all right last stop let's go to the next chapter and see how we can create glass and transmissive material inside unreal engine 5. we did talk about materials and if i just double click you can see everything is right in front of us however i'm not sure if you noticed opacity has been turned off and refraction has been turned off but it doesn't matter what we do we can actually go in here and connect it's still not activating so to do that we need to make two changes and that's what we're going to talk about in the next chapter okay let's start by making a material right click go to material obviously we're going to call this material class drag and drop into our match preview and let's double click go to the material graph and tab it right next to our main scene now let's bring the material and observe we indeed do not have opacity right now and we do not have refraction now the reason that this is happening is because unreal by default things any material you create is opaque until we say otherwise so how to change the nature of this material from opaque to transparent by going to its details right underneath the material rollout we have a blend mode opaque to translucent and the first step is done why the first step because unreal says okay this is a glassy object you probably don't need metallic you don't need specular you don't need roughness so on and so forth but the reality of the matter is we do and the problem that we have at the moment is because none of these attributes are visible our light cannot react to this object and that's why we need to have the second change i'm going to scroll down under lighting mode i'm going to pick surface translucency volume now this material can react just like a glass because we're getting opacity we're getting base color all the attributes that we want so speaking of which let's plug in some of the constants that we already know and make a beautiful glass out of it first things first i'm need a constant three vector holding down three click and let's plug this to a base color by the way if you wish to tint your glass that's how you do it at the moment we just want to plug in a white color holding down one i need a single channel float which is a normal constant goes into metallic it's going to be fully metal we need the same node holding down one click to get another single float expression going into our roughness and we don't need to have any roughness if you think your glass has got a degree of roughness in it then by all means feel free to do that and then we get to opacity using the same expression holding down one click and it's up to you how much opacity you would like to give to this model opacity of zero makes this glass invisible so we need something let's go with actually point five let's meet halfway there i'm going to go apply and then let's go to the main scene let it compile there we have it by the way we are going to address this compiling issue then you always need to have to wait for a few seconds for the material to compile and for it to pop up we are going to address that in the next video but for now we have opacity working for us there's only one problem and probably you already guessed it it looks like a see-through plastic it does not have refraction that's why every time you hook in opacity you need to do something about refraction well let's use another single channel float to our advantage and drag and drop it to our refraction and refraction helps the light to react to the surface and to bend and scatter now how much refraction we're going to give to this glass comes down to what material you would like to simulate and this is something that you need to do a little bit of research on so um table of refraction index of refraction you can actually search on the internet and see what value is close to a value that you want for example if you would like to simulate air the index of refraction is one so basically we're getting the same result if i go apply and go to the main menu let it compile you can see there is no refraction refraction is set to one which by default means that no refraction and then you can just bring it closer to what you need for example water is 1.33 and if i go ahead and apply we can see now we're getting a little bit of refraction i love that that's where you go and tweak a few of these attributes let's say for example you would like to tweak roughness a little bit you introduce a little bit of roughness make the whole glass a bit frosty or foggy you go apply let it compile and you can see we are getting a little bit of that beautiful you can just go ahead and increase your index of refraction for example oil has got 1.46 and introduces more refraction let it compile and you can see now we're getting even more refraction introducing to the scene and that goes all the way you can just increase that get um diamond get silicon which i think has got an index of refraction of 3.5 which is very very high but it comes down to what material you would like to simulate and based on that you are going to apply refraction value so that's how you tweak index of refraction as simple as that and that brings us to the end of this tutorial now the compiling scenario we need to address because every time i make a change i need to apply and every time i need to wait for a few seconds and based on your computer specs you may need to wait more or less but we are going to address that through material instancing in the next video is going to be a very useful session but for now we it that was a really quick overview on how to apply materials how to create materials and how to apply textures what color space you need to be mindful of so on and so forth again i hope you found this video useful thank you very much for supporting this channel and i can't wait to share more of these topics with you next week is going to be again on material we are going to go over this compiling issue and how to parameterize our materials until then stay safe and see you guys soon
Info
Channel: SARKAMARI
Views: 20,616
Rating: undefined out of 5
Keywords: unreal engine 5, unreal engine 5 tutorial, unreal engine tutorial, unreal engine 5 beginner tutorial, unreal engine tutorial for beginners, unreal material tutorial, unreal material editor, unreal material function, unreal material tiling, unreal material nodes, tutorial ue5, ue5 tutorial, ue5 tutorial series, ue5 beginner, intro unreal 5, learn unreal engine free, epic games fortnite, ue5.3 preview
Id: N4PT3FhW_wU
Channel Id: undefined
Length: 47min 44sec (2864 seconds)
Published: Tue Apr 19 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.