UE4 - Texture Optimizations

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're going to walk through all the different settings that you have available to you as it relates specifically to texture maps so let's go ahead and dive in and we'll get started if you want to follow along with this video uh in particular using the content that i have here if you go over to the unreal marketplace just do a search for construction site silver tm was the one that put this together this is the asset pack that i'm using so feel free um to follow along if you'd like to okay so again specifically this video is going to focus exclusively on the texture editor so before i jump over there i just want to show you a quick how i got to this point so we're going to use this rode closed sign as i think it does a really good representation it shows you exactly what's happening but i want to make one adjustment to the material so it's a little bit more clear as you're watching this to see exactly what's happening so i've just simply clicked the road sign there is this material i've double clicked it which happens to open this guy and all i'm going to do is actually go in and turn off the normal map so unchecking it turns it off that's literally all i'm going to change we're not going to do anything else with this process the next thing i'm going to do is if you notice in the rose clothes sign there's also this diffuse so you can just double click it which will open up this texture okay all right so let's go ahead and dive in the first thing that i want to cover is actually just the ui really really quickly of our texture editor so again if you go into your content browser or you open up any texture you're going to get this window so just kind of going from the top and working our way around in a clockwise fashion all of these are exactly what they what they say they are so you can actually open you can save um you can go in change this is just kind of a global edit uh your asset um this is actually a handy one so if you've got a texture open you're like hey i don't even remember where i got this from if you do find a content browser it'll actually navigate to your content browser exactly where that's at which is really cool um we can also do a size map audit assets i'm not going to cover that too much because that's actually more of a global function than unreal but super super handy to find out how much does this texture cost which is really cool you can re-import from here which is actually also available here as well and then if we go to our window you can see we can change a few things and then help so we'll ignore that um on our main bar we've got save and browse again browse is actually going to do the exact same thing which if i was in say for example here looking at something else and i click browse it will take me immediately to uh that in my content browser reimport will actually re-import the texture from the file specified in it which i will explain here in a minute once we get to that but that's just a quick way to reimport and then this mip which we can check and adjust which again i will show in a little bit as well all right so kind of we'll actually come down here to view uh this is a way that we can actually isolate our different channels um here um i'll also show you too how you can bind that to a hotkey i find that in my workflow it's much easier to have a hotkey bound to that than trying to manually click through all of these desaturation is exactly what it sounds like it's a way to just view the texture in a grayscale mode it doesn't actually desaturate the texture it's just simply a preview in our window background you can change this as well so you've got checkered you can see here in fact because there is an alpha channel right here you can see that if it's checkered fill goes all the way to the top if i go solid color you'll see that so by default it's easier with the checker and draw border which will simply draw a border around the actual texture so you can see exactly where the texture ends and then we don't need to worry about settings i'll just open it you can see here again a couple things you can change which is great you may want to change your texture size something like 16 which should change this guy but again don't don't need to worry about that right now moving over to our details panel so you can see here there's a lot of good information at this top and which in fact we will reference back to this to see exactly what's happening you can see the imported texture size the displayed texture again which will also view here which is also viewed in our viewport max in game which is a specified maxing game texture the resource size this is important your resource size is an indication of the actual file size and how much that that particular texture is taking up in terms of memory has alpha channel in this case is true method is streamed format dxt5 we'll see how we can change this lod bias and number of mips as well so again the details panel at the very top is very very important we'll reference back to this a lot all right so moving down we've got a bunch of different settings here and we'll actually expand some more we also have a search details which is very very handy so for example if i wanted to search for brightness i can start typing and it will isolate those particular parameters we don't need to worry about the property matrix or any of these unless you want to that's simply just to help you with the organization in there all right so before we start going through all the different settings i'm going to change one thing real fast which is again if you know me i love these little show advanced these little kind of triangles upside down triangles there are so many hidden goodies in unreal um that are hidden behind this so all i'm going to do is i'm actually going to work my way from the bottom and expand all these because like i said we are going to go in depth on the texture editor so we want to see exactly every single setting that we have available to us so okay um moving down kind of wrapping up this we've got this ability at the bottom to kind of zoom into our texture and also change uh specified zoom levels scale to fit or scale to fill which are kind of the same but scale to fit so you can see as i adjust my window you can see that it actually adjusts it there so okay so before i actually go through this let me show you real fast how to enable the different hotkeys so example if i click in here and i just type alt one two three and four while pressing alt you can see that i can quickly toggle between all of my different texture maps so if i go back up here you can see as opposed to me clicking individually one by one so to do that real quick all i'm going to do is go up to edit editor preferences in here just type texture um i believe it is texture editor yeah if you type in texture editor you will get this so you can see here i've got my hotkeys bound so alpha blue red uh green and red so they're working backwards so red green blue alpha respectively alt one alt two all three and all four easiest way to do it is if you just click in new binding press alt and one at the same time then you'll get your binding so that's how we've said that okay cool let's go ahead and dive in now and actually step through every single process and every single parameter that we have for our textures so the first setting that i want to hit has to do with our compression so in our compression rollout um we'll go through a few things um it's important that i want to make a a distinction here uh you it's it's entirely possible that you'll be working in a pipeline where you may get a handful of texture assets with varying sizes you may get some very small textures and you may get um some massive ones you know like some 4k some 8k textures um that is okay i say that's okay um you're probably if you're working with this you're probably shaking your head no no it's not um in a way it is okay and what i mean by that is we've got tools inside of unreal editor that allow us to actually override what the source material coming in is so for example if you've got somebody that's been authoring all their textures at 4k it doesn't mean that it's necessarily going to render out at 4k in the end we can change that so we do that through a few different settings but the process that you need to be aware of is called cooking and what that means is when you go to package your product you know so when you are all done you're getting ready to deploy it unreal engine will go through and actually package everything up it's you know there's optimizations there's code snippets you name it so the settings that we change in our textures do affect that cooking we can also see a preview of it in editor we'll see in our stats how that kind of changes as well so uh really the the the short sweet summary of it is um just because you get a 4k texture doesn't mean you're locked at that doesn't mean you have to go back to the original artist say hey i need you to change this we can actually change it in editor which is really cool so okay so back to our compression settings so compress without alpha is exactly what it sounds like if we were to check this when it goes to cook it's actually going to discard that alpha information why is that important well if you look at a a typical texture map you've got essentially four channels red green blue and alpha here's the kicker though your alpha channel cost as much as your r g and b combined together the reason for that has to do with bit depth and when everything is packaged so again if you're pushing out a bunch of textures and you've got alphas and stuff like that this is a way for you to save some information now unreal is smart enough that if it doesn't have an alpha coming in typically you don't have to flag this it will just discard it anyways because there's no information however if you're exporting a texture in this case a targa which i believe was authored at 32 bits to be able to have that alpha just be aware that this is a way you can override that again if i check this it will discard the alpha of course you lose information but i can save some resources with that defer compression um really what this is i've got to double check at which part of the rendering pipeline um in the packaging pipeline this totally affects but essentially it's just saying hey don't compress this keep it at a high resolution there's situations where you might wanna use it but by default you probably should have it on all right compression settings so this is probably the single most important thing out of all of the settings that you have in a texture in the texture editor that you should be mindful of what compression settings are is this actually tells the engine how to process all this and what i mean by that is um a game engine with which is you know what unreal engine basically is is derived from game technology is um there's all these little bits of i kind of liken it to like garbage disposals and what i mean by that is like you've got a bunch of information coming in and it has to chew through all of the the bits and the bobs and then spit out an end product um so if you if you think about it in that way what compression settings are is kind of telling the engine hey i want you to take this texture and go through this garbage disposal process information and spit it out so if we look through the different settings we have available by default we've got these different compressions i'll let you do a google search you can figure out what it is dxt one and five bc one and three and dx11 has to do with the way that texture is processed normal map if you're familiar again with materials is probably the most readily apparent like aha i know what that is well a normal map processes differently again it goes through a different processing chain i.e the garbage disposal um and it uses dxt5 bc5 and dx11 on directx 11 excuse me compression for that that's very important because um really really the to bring this full circle when your graphics your gpu is processing information your textures get pushed through a certain channel so normal maps have different information in them in fact we can see here if i just double click this one this is processing different information than say for example our diffuse our base color and all that so it has to go through a different rendering pipe to be able to do that appropriately and it does it through compression so by default again unreal engine is smart enough to know when you're importing it will recognize hey this looks like a normal map i'm going to go ahead and set your compression settings to normal map generally speaking you don't have to change this there are those rare few times if you're doing like a custom normal map or something that unreal doesn't get it it's very simple just go into your compression settings click the drop down and just change it to normal map all right let's keep cranking through here mask no srgb this one is probably the second most important flag that you'll run across and what that is is if you're familiar with the texture authoring pipeline you can do what's called like layered mask layer textures stack textures a bunch of different names for it but essentially what it is is you're you're taking multiple channels of your red green and blue and sometimes alpha and adding information so if i open up this srm real quick i'll show you what it is so you can see this is set to default which it may not need to be so if i go through here you can see this is my red channel this is my blue channel my green channel and there's nothing in alpha so what's been done here is it's a way for you to be able to use multiple channels in that texture for different material uses again we're not going to cover that but the the key part here and again this may actually be incorrect is when you import that you want to change your compression settings again for these layer textures to mask no srgb the reason for that is in color space srgb has a curve so it's it's got a little bit of a a bin to it for lack of better terms and so when you're creating a mass generally speaking you want it to be values of zero to one you want a linear curve linear color space with with a set to default dxt1 you're going to have srgb active so what that means is that your roughness channel will not display appropriately nor your metallic this is a common problem i see a lot when people are importing textures from other programs they say hey you know it looks like this in substance designer marmoset any other program besides unreality like it just doesn't look correct here chances are 99 of the time it's because you're in srg mode srgb mode for that layer texture so simply just go in change your compression settings to masks no srgb it will uncheck that srgb you can also override this and uncheck it but again if you think again those different garbage disposals your masks you'll want to process that as well all right grayscale is exactly what it sounds like however be very very careful with this i'm going to go ahead and actually just open up another diffuse so we can see what's happening here the reason why i say be careful with this is that the general idea and the thought process would be oh hey i've got a grayscale well grayscale should only have one channel because it's gray so i'm going to save a lot of texture not always in fact so if i take this one just here for an example change my compression settings to grayscale if you watch here the resource size we're going to go from 341 kilobytes to 1300 kilobytes so that's what i mean by that is that it's not always necessarily a compression savings so pay attention to your resource size i'll go ahead i'll go ahead and actually just reset this back so it doesn't affect anything and we'll close our normal because we don't need that okay uh the rest of these i'm just going to kind of skip over because i just want to highlight a couple a couple ones that you might be familiar with your hdr that's going to be if you import any kind of hdri into your scene you're going to want to use this because this is actually going to use a different shading algorithm to be able to support that full high dynamic range so you'll change that but again if you're inputting hdri typically it recognizes that user interface 2d this is another one that's very important if you're creating textures for ui you absolutely need to change this user interface 2d the reason for that is whenever you launch your game and you have your ui it will display on your screen however by default if you have this if you're bringing in textures for ui as set to default they will appear very blurry what's called mipping it'll be mipped down so by flagging this user interface it'll actually discard those mid maps and make sure that it renders at full resolution all the time so it's very very important alpha uh generally speaking um and this actually comes from years of working in kind of the dcc pipeline there really there really hasn't been um many times where i've needed to use alpha um if i'm being honest because a lot of times i'll just use a layered texture with no uh with mass noise uh srgb as opposed to an alpha but it's there so if you needed to do it um and again we'll kind of we'll kind of skip over the rest of these if you want to look more in the compression settings look at the documentation uh just do a quick research um a lot of these are not inherent to unreal in fact these are mostly just the way that you process graphics um and textures so okay very lengthy on compression settings but again i would say that this is uh hands down the most important thing if you gather anything from this video when you import your textures make sure they're set appropriately because again going back to our garbage disposal example then the engine is going to process information you want to make sure that it's processing it correctly okay cool all right let's keep moving on here in compression uh maximum texture size this is really cool so going back to a comment that i said earlier um you absolutely can get author textures into your project above what you intend for it to be so in this case you know imported this particular texture we're looking at was authored at 2k so 2048 by 2048 which is great and it's currently being displayed as 2048 by 2048. we can override this which is really cool so if i go into my maximum texture size and let's say for example i type in uh we'll use a really low number like 128. you can see that it looks actually pretty crappy and that's because um we're not using our imported size we're using our displayed so if i reset this here's what's really cool so again paying attention to our details resource size of this 2k texture is roughly i want to say about five five and a quarter megabytes uh or 5400 kilobytes if i set my maximum texture size to say 128 you can see that that drops significantly now granted it looks terrible because we're up close but if this object were way off in the distance and we never really get close to it that would be totally fine so i just shaved a significant portion of my texture size off by simply just saying hey i just want the maximum texture size to be 128 so again we can take this up let's say like 512. so you can see from our 2048 taking this down we can still read it but we've again shaved off a pretty significant amount of resource size so that's a great way again you can overwrite this which is very good okay lossy compression amount so really what this means is that when the engine is processing the compression side of your texture this is a way that you can kind of override it typically speaking lossy compression amount and compression quality default is totally fine for like 90 95 percent of the time there are situations that should run into where you may have a particular texture that just the way it's mipping down the way the engine's handling it it just doesn't look right um so this is a way that you can kind of override that to say you know hey you know unreal engine stop being so aggressive with this leave me some more detail etc again default should be totally fine when you start getting into your compression quality be aware if you don't know how to profile if you don't know how to run the settings changing this could get you into a world of hurt where your package size is still relatively large because again you're overriding compression settings that may increase you know the the deployment size of of your of the game so okay so that covers compression let's go ahead and move on now to um texture so i'm going to kind of skip over the power of two in the padding really what this means is just um if you bring if you bring a texture in and say for example that it's not necessarily squared so 2k so you've got you know 1024 uh the typical values where you got 64 128 256 512 1024 2048 496 all of your your scaled resolution be aware that the engine actually this is a really good performance note say for example i brought this texture in as 2049 by 2049 the engine is actually going to round up so my 2049 by 2049 texture is going to be as expensive as a 4096 by 4096 the power of two mode is a way that you can force this texture to actually render in uh power of two so again by default you probably don't ever need to change this padding color is more i think just a visualization so you can see it srgb again i i i hate that srgb is actually down here uh makes sense why it's in texture but again this correlates a lot if you have if you're bringing you know a particular texture and that's in linear space versus srgb uh note if you're actually getting a lot of information from substance designer most well i should say some of the more advanced substance designer authors that create materials know how to change the output from linear but i want to say by default something like substance designer does generate the textures in linear space so unchecking srgb will actually bring it back to the correct color space but again if using compression settings like mass no srgb you should be fine but again also be aware you may have some textures that come in as linear just simply uncheck this and it will change it for you so it'll recompile so we'll let that do that i'll i'll put it back on okay x-axis tiling mode wrap clamp and mirror is exactly what it sounds like um if this texture were repeating you would you could specify and overwrite this wrap it's just simply going to say as that texture repeats on the surface you'll just see it kind of wrap around as an infinite loop so by default wrap is totally fine um we'll skip over the dithered mip alpha and the alpha coverage threshold um let's again these are situations you probably won't run into much this has to do with some optimizations where you can kind of adjust the alpha the next thing is actually a one you you may run into a lot of situations which is this flip green channel now for our diffuse our base color we'll have no effect i'm actually going to open up this metal grid because this will be easier to see by default i want to say that unreal wants a normal map as though you are standing inside the normal map looking out so in this situation these grommets would be pushed outwards towards but you may have authored it accidentally or somebody would have authored it the opposite way you can do flip green channel which you can see is simply just a swizzle is what they call it we're just invert so if i go back actually here to our green channel you can see there it just simply inverts it so that's one way of doing it again that's really only pertinent to normal maps because typically speaking you're not inverting your green channel on your base colors or anything else so all right keep going here uh pvr tc4 is actually compression setting mostly for mobile um more specifically i think for the iphone i don't know if android uses this one but by checking this you're simply just forcing this texture to compress out there again usually not a time where you would want to use that filter mode again if you want to look at this research this a little bit later but this is just a way that you can help with the filtering of your texture so if we do default um this may be a little difficult to see i'll kind of zoom in here it's a little bit easier when you have high contrast points but you can kind of see the aliasing the stepping on it if i change this to bi linear again this is not going to show up too much but this is just a way to to process the texture a little bit differently so you get just a little bit cleaner results but again not super visible from this mip load options we're actually going to show this here in just a second but with your mipmaps what a mitmap is is when you create a texture the engine creates subsequently smaller versions of that that a gpu is smart enough to know how to use and what i mean by that is if this sign were way off in the distance and i had 100 of them the gpu knows hey this is super small on screen i don't need this full 2k resolution i'm going to go ahead and jump over to one of these mips that's much much smaller which we saw with the smaller texture size saves resources and the gpu will use that kind of smartly intuitively from that so with your mip load options this is a way that you can say go ahead and load all the mips or just use the first don't do it again it's one one flag to be able to override that we'll skip over asset user data this is a way that you can also kind of uh for like a bunch of terms hijack the texture and do some other things so we'll we'll ignore this for now again that's a much much deeper topic onto our file path so this is actually the original file path that the author created this particular texture so if i were to go up right now and say reimport the editor will probably say hey i can't find this file um additionally what's nice about this is say for example you know you're working with a team somebody else is doing all the texture imports and then they dump all these textures off to you and those textures reside elsewhere on your hard drive that's different than from what the author created that's totally fine you can actually go into here just click the little three the little button here and you can actually load the texture or a new texture and re-import that way so if you click it again you can go up to re-import repath it when it reimports it looks there another note that i want to make that i've seen a lot of people kind of get confused on you don't have to have the original texture in fact you don't have to have any of the original assets like the static meshes your animations anything any kind of data that you're inputting to the engine you don't have to have it in your actual project folder it can reside anywhere it could be on a separate hard drive um on a network share that doesn't matter when you import um unreal is actually going to create the u asset which is what you share with your team with other people that the project ultimately uses so again this is why we're seeing the source file path different than where the engine is but you can always repath it okay on to adjustments now um i'll i'll go kind of briefly and quickly over this because a lot of these have to do with the same thing which is you can actually adjust your texture in unreal do i recommend it no there's other programs out there that are far better and far faster ie something like photoshop a place where you can change it but it's important to note you can change it so for example we have this gray right now i could take my brightness up to say two you can see that my texture actually starts getting brighter which is great it's cool that this ability is in the engine um but again you don't have to necessarily worry too much about it brightness curve is kind of like a contrast so i could take this down less contrasty you name it so again this is kind of a nice little tweak you can make i could see situations where again you're working with the team you don't have access to the original texture maybe you don't even have access to a program like photoshop gimp's free so you can have that but you just need to make a quick change and you don't really want to go through another dcc program you can do that so i could say you know oh well this was actually not wide enough i'll take that a little bit and there you go so again all of these settings do take effect together again saturation i'll show you there so we can bump up the saturation a lot so really cool that this is available in there and you can change that so okay keep moving on in fact we are almost we are nearing the finish line here which is awesome um level of detail so going back to the mip settings in fact i'm going to show you real quick what's happening with mips if you're not familiar with that process so i'm actually going to go back up to our toolbar here and check this little box that says mip level so as i start taking this up you'll notice that the texture gets smaller and smaller and smaller that is the mip generation so the engine in this case i believe uh yeah gave us 12 mips so you can see the highest level because it starts at zero so 12 is just a one by one texture so that's just literally uh what would that be two pixels no it's just one pixel um so again this is the the gpu is going to use this to help to optimize performance but we can also do some things to help with that process as well so i'm going to uncheck the mid-map level and go back down to here um so let me actually show you real quick here i believe it's lod bias if i change this to four yeah okay so continuing with this so my mip level of four so let me change this back to zero go to a mip level of four you can see here displayed as 128 by 128. i'm going to uncheck this set this back to 4 and there's that 128 by 128. so effectively what i've done here is i haven't specified which is very similar to what we did at the top here on maximum texture size i've actually just specified use this mip and that is this lod bias which is great i want to keep this on here real quick just to show you what the mip gen settings are so i'm going to zoom into this one just a little bit more so you can see it and you can also see on this road sign here what's really cool about our mipmap generation is that we can actually change a couple things so we can blur or sharpen typically you're going to use sharpen and here's why so i'm going to take it all the way to 10. so if you notice on um in fact this is let me let me go up to where the road closed is you can see if i change this back to default you can see that things get a little blurry so by taking it to sharpen the advantage that we gain here is it helps that texture to be a little bit sharper so if it's way off in the distance and it's too blurry this is one way again in your mip gen settings this is one way that you can quickly change um how that mip generation is happening which is again really really cool and very very handy blur is going to do exactly what it sounds like so again if you needed to overwrite it so again this is kind of interrelated so you can do your lod bias you can see exactly what it's doing but again a way that you can control that go ahead and go back out to scale to fit and we should be good okay uh texture group and the level of detail um this actually kind of goes hand in hand with a little bit of what the the principle we talked about early on with the compression settings this is just another way for you to kind of specify um this does tie back to your project settings in fact um if you're an artist this is probably not something you'll take you'll you'll do engineers definitely know where this stuff is or at least should know where this stuff is uh but in the editor you can actually specify a few different things for example weapon hailing back from like old school unreal tournament days um the assumption was is that if a player had a weapon it's close on screen so you're going to want to have more fidelity have things better so that's why you have kind of this weapon texture group it's just a way for the engine to process it and make it look better so that's all these are again generally speaking most of the time you're going to keep it to world one thing you may run into and i believe it's in here is if you are creating textures for a ui again we go back up to our compression settings we're going to want to use user interface but sometimes the editor when you're packaging something weird happens you may want to go back in your texture group and just say hey go ahead and process this on ui the reason being is your textures may load into world space you may be very very hard work constrained i.e something like the switch so you you may have to flag in this texture group hey go process on the ui don't process in the world don't take up that memory so that's what texture group is preserve border um again if you highlight over this it's uh you know the border will be preserved during mipmap generation so if there's again some detail you have pressed right to the edge of your texture uh you may want to check that um so again when it mips down um that is important downscale um uh let's see exactly what it says there you can kind of look at that you can do uh you can actually do different overrides so for example on the downscaling you can have it on different platforms whatever it is downscale options very similar to what we saw before with sharpening and all that uh never stream so in the editor you can actually stream textures which is um one way to kind of save on memory but you may find that there's glitches whenever it loads in or it's doing something so you can change never stream to where it just preloads that so it's in there um and then global force resident mip levels uh we'll we'll ignore that okay that's level of detail compositing i'm not actually going to show how this works per se but basically what a composite texture is is it's a way for you to help in the mip generation process specifically more with the adding the normal roughness to red green blue and alpha um it's a way that can help you as things are mipping to keep some detail and or help with visual fidelity in the distance so um unless you do a quick search because there's a way you can actually author a compositing texture which helps out in that but again 99 of the time you're never going to use this so okay that should make you an expert now on the texture editor inside unreal engine so that will wrap up this video um i hope it helped um again there's a lot of settings in here that a lot of people don't know that you have control over so um yeah i hope that helps um you'll probably see in a separate video where we go through profiling and actually adjust some of these but that is literally a crash course in the texture editor so i hope it helped um as always i appreciate you guys support if you guys have suggestions for things that you're having trouble with in development or just want more information on absolutely drop a comment i will get it added to the queue so we can get those pumped out so as always really appreciate it we'll catch you on the next one
Info
Channel: Ryan Manning
Views: 4,058
Rating: undefined out of 5
Keywords: UE4, Training, Game Dev, Tutorial, Unreal Engine, Textures, Optimizations, Texture, Construction, Pipeline, 2k, 4k, Layered Texture, Normal Map, Normal Texture, Compression, DXT
Id: wFhHsPrHvN4
Channel Id: undefined
Length: 35min 17sec (2117 seconds)
Published: Wed Feb 03 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.