How To Create Atlas Master Materials in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone in this video I'm going to show you how to make this really cool texture Atlas Master material that allows you to select sub textures inside of a texture Atlas inside of the material editor rather than setting them up in UVS in something like Maya or blender so let's go ahead and get started uh so the first thing we're going to do is create a material I've gone ahead and done that it's m underscore Atlas here you can name yours whatever you want that's just the naming convention I'm using so I'm going to go ahead and dive in so to start out the first thing we need is our texture parameters so I'm going to go ahead right click I'm going to type in texture parameter and we want this texture sample parameter 2D and once we click that I'm going to go ahead and give it a name I'm going to call it base color and then I'm going to click on this guy and then down here where it says this default texture I'm going to go ahead and switch that and we're going to go ahead and select the UV texture that comes with Unreal Engine so I'm going to use this UV grid SM and the main reason for using this one is that this is a great way to visualize your material whenever you're doing anything with UVS so I like to use it for this texture or not this texture but this material specifically as I'm going to be doing a lot of UV stuff so it really just helps me visualize this I'm building it out so from there we're going to go ahead duplicate this guy and then for this one we're going to go ahead and do our MRA so I'm going to type in MRA I've made this T preview MRA texture and I uh oops hang on I accidentally duplicated it and didn't change the name before I changed the texture so that changed both so I'm going to go ahead and set this guy back to the UV and then I'm going to duplicate this guy again and this time I'm going to make sure to change the name first if you don't change the name first like if this is base color and this is base color and then I change one of them it's going to change both which through an error there so I'm going to change this to MRA so this is going to be our metallic roughness and ambient occlusion and then I'm going to go ahead and change this to MRA and T preview MRA now this isn't going to come with the engine by default but you could easily throw just a generic texture in here that's set to masks or just has srgb disabled that works too so I'm going to plug this guy in so red and metallic uh green roughness and we're going to throw the blue and the ambient occlusion all right from there we're going to duplicate this one more time and we're going to call this one normal so this is going to be our form for the uh normal map and then we have our T preview normal once again one I built you could use any normal though the one thing I would recommend is if you are using preview textures for your master materials make sure that they are very small in size so I think these are actually like 64 by 64. uh this one isn't because this isn't mine but these are and that's just because these will be referenced by all of your material instances so if you had a really large texture anytime you use that material instance even if it's the only thing in a level you're going to reference these textures so it's best to keep them small is it's going to load less all right so the next step now that we've got those set up is to actually set up our UVS the UVS are what's going to control the you know actual Atlas selection so what's going to allow us to select the top left texture or the top right or the bottom right Etc so that's what we're going to set up now so to start out I'm going to just go ahead and hold s on the keyboard and left click and that's going to go ahead and create a parameter and I'm going to name this uh U position and then I'm going to go ahead and copy that and this one's going to be V position so we're going to have one parameter for our U and one for our V and that's so that way we can control the uh essentially the U and the V separately so if we wanted to go right but stay in the top column we could control that with the U position if we wanted to go down we could control that with the V position right uh the next thing we need is we need a clamp and what we're going to do is we're going to go ahead and set a Max default on this clamp that's greater than one because we're going to need a higher value than one for this just depending on how large our atlases are going to be I don't foresee myself using any Atlas that's bigger than 8x8 which would be 64 individual textures if it was eight by eight so I think that's a pretty safe bet for a Max and then the Min can stay zero and then I'm going to go ahead and plug our U into that and then I'm going to copy that clamp put it down here and I'm going to plug in our B what we're doing is we're just clamping at this so we can't go lower than zero and we can't go above eight and that's just to make this break a little bit less in case an artist was setting some crazy numbers it's not going to throw everything out of whack the next thing we need to do is actually do a seal and all the seal does is it rounds it as it rounds your value up to the nearest integer and this is just to keep them from setting something like 0.1 as the value uh so if you typed in like 0.1 or 0.2 it's just going to round it to one if you typed in 1.1 it'll round it to two Etc and that's just to keep it from uh setting the tile like in between two textures it's just going to round it to the nearest texture rather than setting it in between and we need to actually take these and we're going to do a multiply for each one and we're going to set this into the a we're going to set this into the A and then for the B we're actually going to make another parameter here I'm going to call this uh Atlas EV tile size bit of a long name there but it gets the point across and what this is going to be is the Atlas UV tile size is going to be how we actually scale the UVS up and down so this is what's going to allow us to scale it down to the one particular texture and then these here are what's going to control which texture we're actually going to look at so we're going to go ahead and set the default value of this to one and we're actually going to set the slider Max one so the reason we set this to one is one is going to show us the entire texture if we see the entire texture that's going to be one and then we can lower this in order to see smaller increments of the texture so if we just wanted to see this top left corner we would set this to a smaller size right uh but if we said it's greater than one we're just going to be tiling the texture more and more which we don't necessarily need for texture Atlas we need to tile it down but not up so it's safe to set that slider Max to one just to make sure it doesn't break I'm going to go ahead and plug that into the B and into the B and then finally we're going to take these two and actually append them together right and all this is doing is it's taking the individual U position and the V position that we're setting up and it's creating a UV from that so we're creating basically a texture coordinate that's the main section there for actually selecting the individual tiles that we want I'm going to go ahead and throw a comment UV position uh selector decently descriptive I'm going to go ahead and just set this to a less obnoxious color just set it to Black and now we need to do the next section which is going to be setting up the UV size right so this is the UV position selection now we need to actually have something to set the size and this is easier we just need a texture coordinate and then all we're going to do is we're going to drop in multiply and we're going to plug this in the top and for the actual thing we're going to multiply it by we're going to take this Atlas UV tile size so if we just copy this and paste it up here if we were to change Atlas UV tile size it's not only going to change here but it's also going to change here and the reason why is we essentially want this multiplier to be set the same as our tile size and that's going to Crunch down that offset so if these weren't separate and then you set this to the correct value and then this one was still at one what would happen is you wouldn't be able to actually select the proper tile because it would jump the entire texture because if this is one and then you go and change one of these it's just going to move it over by one which is the entire texture so it's going to look like nothing changed I find you almost never need to have this be different than this so I just make them the same and that's pretty much all we need to do there we're going to hold a for ADD and we're going to plug these in together so we're essentially adding these UVS to the others we're going to plug these in so just plug this into the UV of the texture parameter and as you can see everything's working so we're going to go ahead and hit save and this guy is pretty much done so we have our UV position selector which is going to allow us to select the individual sections and then we have our texture cord here which is going to help us select the UV tile size so I'm going to just go ahead and comment this guy or say uh EV tile size and I'm going to make this black as well I tend to make a lot of my comments black just so that way they're less obnoxious personal preference I mean it's safe once again so I've made a material instance and I've just set it to this material and everything else should be pretty much default here as you can see here's our material it looks just like the preview all right and we have our texture parameters here so you could go ahead and swap out the different textures if you want to but for this just to make sure that everything's working I'm going to go ahead and work off of this UV grid just so I can see what I'm doing so let's say we wanted to cut this into like four by four or just in half actually we would want to go ahead and set our Atlas UV tile size to let's say 0.5 and 0.5 is going to do just that it's going to cut the U in half and it's going to cut the v in half so now we have the top left quadrant here the next thing we can do is we have our U position and our V position so this top left quadrant right now is essentially zero zero so if we wanted to go to let's say 1 0 which is the tile to the right we could go ahead and set the U position to 1. and as you can see we're at one zero if we want it to be 1 1 we could set the U and the B to 1 1 and there we go we're at one one and we could obviously go to zero one as well and that's how we select the different parts of the texture and if you wanted to make this smaller you could just do 0.25 instead of 0.5 so just to show you a more practical example I've gone ahead and set up a similar material that I have over here for this Plasma Blast so I'm going to go ahead and open up this material instance and then go to this material this is pretty much the exact same setup nothing's really changed the only difference here is that this is a decal so I've set it to defer decal and I've got the blend mode to modulate and then since this is going to be for a Plasma Blast I've gone ahead and added a emissive texture with a black body just so I can control that so all we have to do is much like before we can go ahead and just set our Atlas tile size which will shrink it down so in this case since we have four textures four quadrants rather we need to cut it in half and then in half so half in the U half in the v so we just need to set this to 0.5 which is half of one which is the whole thing so we set that to 0.5 now we have one right so in this case it's going to be the top left because that's zero zero so if I wanted let's say the one to the right of it I could set it to one zero so one and U 0 and the B and now I'm on the one on the right from there I could go ahead give this some emissive so I'm just going to set this guy to like 4000 because it's a temperature based black body and you can see we have this really nice Plasma Blast there we go uh and yeah it works pretty simple let's say I wanted to go to one one I can go to 1 1 and just like that so the main reason you have something like this is let's say you had a game with uh you know shooting mechanics and you had bullet decals that you had to place for hitting Stone metal concrete glass whatever you could have a texture similar to this although it could be like an eight by eights and have different bullet damage decals and then using a material like this you could create a dynamic material instance in Blueprint and simply adjust these values and even do something uh with it being random you could plug in World position for the U and the V instead of having them be set parameters you could add some parallel exclusion mapping kind of whatever you want but you could see where this is a very simple trick to allow you to use less textures inside of your game ultimately making your game smaller reducing the number of assets less things to load so on and so forth so hopefully this was helpful if you liked the video go ahead give it a like uh let me know if you want to see more videos like this consider subscribing if you want to see more and yeah have a nice day
Info
Channel: Z-Axis Up
Views: 8,185
Rating: undefined out of 5
Keywords: Unreal, texture atlases, unreal engine master material, master materials, texture atlas, unreal engine texture atlas, texture atlas material, unreal engine texture atlas master material, unreal engine material, master material tutorial, unreal engine 5, unreal engine, atlas master materials, unreal engine 5 master materials, unreal engine 5 atlas, unreal engine 5 texture atlas, unreal engine 5 master material tutorial, unreal engine 5 tutorial, unreal engine 5 beginner tutorial
Id: WmM19H8Uwu8
Channel Id: undefined
Length: 12min 54sec (774 seconds)
Published: Thu Oct 13 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.