# Tutorial | Optimization Techniques | Unreal Engine

**Channel:** C-Media
**Source:** https://www.youtube.com/watch?v=Ij-bUUO25OA
**Transcript page:** https://www.withtranscript.ai/video/Ij-bUUO25OA

## Chapters

- 0:08 — Introduction and Optimization Philosophy
- 6:58 — Rendering Paths and Graphics APIs
- 12:01 — Screen Resolution and Screen Percentage
- 20:00 — Anti-Aliasing Methods Overview
- 21:01 — Nanite Usage and Dicing Rate Optimization
- 30:30 — Nanite Displacement versus Parallax Occlusion Mapping
- 36:32 — Nanite Foliage and Voxelization
- 43:21 — Static Mesh Quality and File Size
- 49:12 — LODs and Cull Distances Setup
- 54:38 — Lumen and Material Optimization
- 1:00:30 — Texture Compression and Channel Packing
- 1:07:29 — World Partition and Profiling Commands

## Transcript

**[0:08]:** All right. So, in this video, I'm going to be going over optimization in Unreal Engine, specifically Unreal Engine 5 and more specifically the latest version of Unreal Engine 5 as of the date of this video, which is 5.7. So there's obviously been a lot of uh discussion and content created around the fact that a lot of games coming out using Unreal Engine 5 are not performing as well as they should. And there are a lot of uh reasons for that. A lot of them uh come down to at least in my opinion uh development teams not fully understanding how to utilize the engine to its uh maximum performance and also relying on too many of the offered systems uh to develop their games and not really understanding that they shouldn't rely on all that as a crutch and you should still go in and do your standard optimization techniques.

**[0:55]:** So, I'm going to be going over all that and clearing up some misinformation because there's a lot of that out there as well. So, in this video, I'm going to be covering uh things such as uh screen resolution and percentage, anti-aliasing, uh nanite and lumin. Of course, I'm going to be covering foliage, how you handle static meshes, materials and textures, and world partition. All these things are kind of like the the core components of Unreal Engine, specifically Unreal Engine 5. Another one that kind of ties into that as well is going to be VSMS or virtual shadow maps, when and where to use them. And uh the same for all those other techniques I mentioned like nanite and lumen and uh give you uh really good insight on how to utilize these tools in Unreal Engine. Now for the purpose of this video I'm going to be using the uh default Unreal Engine 4 layout.

**[1:38]:** So if you go to window load layout U4 classic layout that's what I'm using. That's why this might look different than your standard Unreal Engine 5 install. And it's just for the purpose of this video so everything sits on a single screen and I'm not having to expand and contract different uh panels and everything like that just to make it a little easier for the video. The only other thing I have done that's not part of that normal layout is I brought out this output log. So that's another thing you can go into window and you can check output log. It's normally down here. You can just click on it and it slides up, but I'm going to have it here because I'm going to be going over some console commands and everything like that. All right. Uh, one more thing that I want to mention is that I am using the AGX tone mapper rather than ASUS.

**[2:15]:** So if you look up AGX tone mapper for Unreal Engine, you can see some videos covering how to set this up. Basically what this does is it moves Unreal Engine's default tone mapper which controls how all the colors are represented from ASUS to AGX. AGX is a more modern tone mapper that lends itself better to real-time rendering whereas ASUS is a filmic standard. It was never really designed for real-time rendering, but that's what Unreal Engine uses by default. I'm sure a lot of that decision had to it came from, you know, Unreal Engine being used for visual effects and things like that. but it can create a very drab uh image and even when you do your own color grading and stuff like that, you lose some of the dynamic range. A lot of has to do with the fact that it's using ASUS. So, I recommend taking a look at that, but it's not really necessary.

**[2:55]:** So, if you see anything weird when I load up things and things are overly bright or whatever it is um in any like the mesh viewers, material editor, stuff like that, it's most likely because I'm using the ASUS um uh tone mapper rather than the default or sorry, using the AGX tone mapper rather than the default ASUS. Another thing I want to mention is my system specs. So, I am on a very high-end gaming machine. So, this is a 5090 with a the top-of-the-line Ryzen and 64 gigs of RAM. Um, so, you know, my performance is is going to be high just because it's a high-end machine. Um, but uh my other machine that I've done a lot of testing on as well is a 4090 with a Core i9 32 gig of RAM laptop. So, gaming laptops are roughly 30 to 35% slower than their equivalent uh desktop.

**[3:42]:** So, keep that in mind. So whenever if you're testing on a gaming laptop for example, it has the identical specs to a uh desktop that desktop in most cases is going to run uh 25 30 35% uh faster than that laptop. Now one thing I also recommend doing is uh whenever you do your uh testing to test it for your um target device, right? So obviously you want to develop on a high-end machine if possible, highest end machine you can get a hold of. When you do your testing, test it on what your target machine is going to be. Um, ideally you'd want to have your lowest uh target uh spec, a medium target spec, and then uh a high-end development machine uh machine if you're doing your own, you know, indie development or, you know, you have your own uh technique for that. And I also wanted to say that um everything I'm going over in this video is uh based on extensive research as well as my own testing.

**[4:33]:** So, you know, I did a bunch of AB testing to test, you know, different scenarios, different uh setups, console commands, different methods of using assets and basing it all on the actual core structure of um how Unreal Engine is designed to be used. So, this is not just uh stuff where, you know, I went on Reddit and found answers to it, which you know, a lot of the times those uh bits of information are incorrect. So, all this is uh been tested and all that. And for the purpose of this video, I'm not going to go in and show what my performance numbers are because once again, I'm on a highend machine. It's kind of a moot point, but um I will kind of describe what I've noticed the performance differences being between these different uh adjustments that I'm going to be covering. Right. So, one thing to keep in mind, and I think this is also a lot of where um the performance issues come from these uh games that are utilizing Unreal Engine 5 specifically, Unreal Engine 5 has evolved into more

**[5:27]:** than just a video game engine, right? It's used for many, many different industries from engineering and architecture to visual effects and virtual production, all that. So, it has all these really, really high-end features, especially for a real-time renderer, that are not necessarily intended to be used for video games, or if they are, they're intended to be adjusted from their default settings to facilitate high performance, high visual quality, and all that stuff. Um, and also reducing file size, right? Which I'm going to touch on a little bit later as well. So that's I think a real um uh kind of a negative point that a lot of people don't really understand is that yeah Unreal Engine is capable of all these amazing things but that doesn't mean that you are supposed to or have to use all of those amazing things and a lot of times when you do it can affect performance but it doesn't really make sense to implement for a uh for most video game situations.

**[6:18]:** Right now, I am going to be going over uh these optimization uh techniques and workflows and everything like that specifically, you know, for uh game development, but these apply to anything. You should always be as optimized as you can um without going below the visual threshold that you're looking to achieve, right? It doesn't matter if it's for cinematics, visual effects, whatever it is, it's always good to stay optimized. And this also allows you like let's say you you build an environment even it's for a uh backdrop for a virtual production set and then you go and add more detail to that later down the line you might not hit those performance requirements that you needed and you have to go back and revamp everything else. So it's always good to do it from the ground up and stay optimized throughout your entire process.

**[6:58]:** Now um one of the big things with Unreal Engine that I also want to touch on is uh image clarity. So it it's very noticeable um usually when a game is running Unreal Engine. one has to do with the ASUS uh color grading, which is very obvious regardless of what kind of color grading you're doing in your post-processing because it has a very specific tone mapper. When we switch over to AGX, it's a little bit less uh noticeable. Another one has to do with uh screen space and temporal effects, which are uh the core of Unreal Engine and how it does all of its really advanced um uh visual and rendering techniques. So there are uh two different rendering paths in Unreal Engine. There is deferred and then there is forward. Deferred is the highest quality, gives you all the bells and whistles, most advanced uh uh feature set and all that good stuff, but it incorporates a lot of temporal and screen space effects which are essentially um calculated uh

**[7:49]:** temporally which means over time and then accumulated per frame. So that's where you get things like blurring and ghosting and all that and depending on your frame rate that can be more or less exaggerated. The forward render is um not as featureful as a deferred render and it uh basically removes almost all screen space effects and a lot of the temporal effects but you do get a much clearer final image. One of the main limitations for uh the forward render is the amount of dynamic lights you can have that interact with each other and then also you don't get uh nanite and lumen support which are obviously uh you know big um key features of Unreal Engine. Now there's also uh there are different APIs. So APIs being directx for example. So the default um uh a rhi in um Unreal Engine is DirectX 12.

**[8:38]:** There is the option to use 11 and then there's also the option to use Vulcan. So there's a misconception that Vulcan will automatically just give you better performance and a cleaner final image if you understand, you know, how the uh how these different RHIs work. But a lot of those comparisons came from DirectX11, which was true. Vulcan was faster and all that good stuff. Nowadays, Vulcan is on par with DirectX12 as far as performance goes. In most use cases and a lot of use cases, especially on PC, DirectX12 is going to be faster. Um, it really just depends on which one you want to work with. DirectX12 also shouldn't have any issues with any of the the built-in um features of Unreal Engine where Vulcan is not is not uh stated to be as fully fleshed out for things like Nanite and Lumin. So you may have some issues with that or even some performance issues.

**[9:26]:** So it's really up to you to uh do your own testing and kind of see you know which one you prefer. Um Nanite or sorry Vulcan is mostly designed to be utilized for Android uh deployments but you can use it uh for other deployments if you like and you shouldn't notice too much of a difference over DirectX12 but um it's uh it's worth testing if you'd like to try it out. Now, I'm also going to go over some comparisons for visual quality because I mentioned uh image clarity, right? I'm not talking about sharpness or anything like that, but there's just like an inherent muddiness to uh deferred rendering in Unreal Engine, for example. So, some games that um I'm going to cite as being uh very clean, crisp, stable final images um are going to be Doom: The Dark Ages that uses IDTech 8 as their engine, and it's actually a hybrid um

**[10:14]:** Ford and Deferred renderer with a lot of their own advanced uh rendering techniques and optimization, but has a very uh clean final image. Uh performs very, very well for the level of visual quality it's pulling off, and it's just a you know, very good implementation. Another one would be Counter Strike 2, which uses Source Engine 2. Source engine 2 allows you to use deferred and forward. Uh I believe Source uh Counter-Strike 2 is actually using forward um which gives it the most performance that you can get and uh all that stuff because it is a competitive game. It's used in esports and all stuff. So, it has to be as performant as possible. Another thing to keep in mind with forward rendering in Unreal Engine, for example, is that when you switch over to forward, you do get on average a 30 to 35% performance increase because it is stripping out a lot

**[10:58]:** of those uh things that are performance heavy. Um, but like I said, it does have its drawbacks mostly to do with the number of lights you can use, but then also some of those screen space and temporal effects. So, you don't get real-time reflections and all that unless you use planer reflections. And there's a whole lot that goes into that, which I may cover in another video. So, I just wanted to cover all that and I'm going to very quickly just show you how to switch those uh rendering methods. So, if you go into your um edit project settings, type in forward, you'll see that there is a forward render section with forward shading unchecked. If you check this, it'll ask you to restart and then everything will be running in the forward render. If you type in RHI, you'll see under target platforms, Windows, default RHI is DirectX12.

**[11:41]:** In here you have the uh default uh which is probably just going to be DirectX12, DirectX11 and Vulcan. There's not really any reason to use DirectX11 anymore. And Vulcan, like I said, is uh pretty much on par with DirectX12 as far as performance goes, features as far as what it supports for Lumin and I may be lacking a little bit here and there, but it's up to you to uh up to you to do your own testing.

**[12:01]:** Okay, so the first thing I want to touch on is going to be screen. Now, this is kind of like one of the lowest hanging fruit is screen resolution, screen percentage, all that good stuff. So, um, just so you're aware, I am, uh, recording this video on a 27 in 2K monitor with a 300Hz refresh rate. This particular monitor, as kind of a side note, is an IPS panel rather than an OLED. Uh, the reason I use IPS is due to eye strain. So, I'm very sensitive to eye strain from OLED panels. Um, and most of it has to do with the blue light emission and all that good stuff, but I've noticed a tremendous difference between um, an IPS panel and an OLED. OLEDs are considered more expensive and more high-end, but they have a reflective screen and they emit a lot more blue light.

**[12:46]:** So, that can actually uh cause severe eye strain and headaches. Uh, for me, it's so bad that it's, you know, hard for me to use for more than 30 minutes at a time. I ended up buying a a new OLED, same uh resolution, refresh rate, and all that good stuff, and it just uh caused severe eye strain. So, I ended up exchanging an IPS panel, which is what I've been using for a very long time. uh IPS is less expensive, but it also has a matte screen and it uh doesn't really have any eye strain, at least in my experience. Um, and I do recommend looking into that, especially if you notice you get eye strain and things like that. I'm sure they're long-term uh detrimental effects to your eyes if you're really sensitive to it. So, if you are having those issues, I do recommend looking into IPS panels.

**[13:26]:** IPS panels uh have better color representation, but they don't have as good of a contrast ratio as um OLEDs. And then OLEDs also have much better um uh mitigation of ghosting and uh stuff like that. The only uh real drawback to IPS panels would be the fact that it has a little bit of ghosting regardless of how high the refresh rate is. But for me, it's uh not noticeable enough for me to deal with the eye strain. So once again, that's just a side note. Now, going back into resolution and percentages and stuff like that, if you uh Google uh Steam hardware survey, you can actually see they they list in there the uh survey for the hardware that is mostly used. And it gives percentages and things like that. And it basically lists every type of hardware, screen resolution, RAM, everything like that that uh users of Steam actually use.

**[14:16]:** And that's always a good benchmark to figure out what you should be developing for. The majority of gamers still play, according to Steam, at 1080p. Um, it's over like 50%. I think it's about 54%. Uh, still play at 1080p. Um, the next closest resolution is actually 2K or 1440p, and that's still only 25% of gamers on Steam using that resolution. There's a very small percentage that actually use 4K, I believe, is around four or 5%. So, just keep that in mind when you're developing your game. don't have to target these extremely high resolutions. Even though your game should support it and run well on high-end hardware for it, uh you shouldn't have to bend over backwards to make sure that it runs at a solid u 60 frames or 120 frames or whatever it is on uh 4K systems as hardly anybody um actually uses them.

**[15:05]:** Uh another thing that I recommend is every time you do testing, make sure you do your performance testing in a build. Do not test it in the editor. Don't do a standalone uh PIE session or plane editor session. Do an actual build. it's going to be a lot more performant and be more um accurate to what your final uh performance number is going to be. And also when you do performance testing, make sure you do it just like any other game to where you're closing all these other apps that uh take resources. So close Unreal Engine uh editor, all that good stuff and then launch your game and see what your actual performance is. Um don't just go by what the editor says because in my experience it's been a 20 30 sometimes 40 frame per second difference by doing it in a build and in the editor it's going to be faster.

**[15:46]:** And once you do your first build, all the other ones are basically iterative. Anyway, okay.

**[15:53]:** Now, I'm going to go into uh talking about resolution and screen percentage and all that. So, I just, you know, kind of went over the basics of resolution. So, in the editor itself, if you go up here to this little um looks like a throttling uh icon, basically, and you go into viewport scalability, you have your different scalability um presets, right? This is the level of quality. Most games, um, you're going to be good with playing at high. Um, epic is going to be basically like an ultra setting in most games. Cinematic you usually never want to use for actual gameplay. The only game that I can think of off the top of my head that uses Unreal Engine that has a cinematic mode is they can actually play with is Blackmth Wukong. And on my machine, everything fully maxed out in that game with cinematic looks phenomenal and I get really good frame rates.

**[16:37]:** But once again, I'm on a very high-end machine. So, you usually want to target between low and epic uh cinematic. if you want to add that in. It's basically uh bleeding edge, you know, uh graphics quality. And the visual difference between epic and cinematic is not going to be noticeable in most uh situations. Uh you may notice some stuff with like shadowing and lighting and all that, but it's not going to be um an extreme uh difference. And you can also switch over your scalability settings when you go into cinematic mode, like you're have a cinematic in game where you're not really worried about the frame rate being higher than 30 frames, for example, where you want the gameplay to be 60 frames plus. So, just uh keep that in mind. You can set all that here and then you can set the individual settings here like global illumination, shadows and all that stuff for their scalability there.

**[17:17]:** Now if you go below that in this same menu uh which is this little throttle icon um and you go to screen percentage you can see by default it sets the screen percentage. In my case it's 83. So this is going to be um the percentage of the screen that the window is taking up. So in this case it's this preview window here. this 3D preview window or the 3D editor window. This is going to be 83% of whatever this resolution is. So, since I'm on a 2K monitor, this is probably maybe 1K, maybe 1,500 uh pixels across and whatever vertically. So, it be 80 3% of that. And this is scalable. So, as I scale this window down, that's going to scale as well. And it always be a percentage of that. Now, you can go in and manually change this. You can even put values over 100.

**[18:01]:** So, I go to 100%. If I go to 200%. That's basically um over rendering the resolution, right? We'll set this back to 100. Now, uh the visual difference probably won't show through because I'm using a screen recorder and honestly um even in editor, it's it's very negligible if you're doing anything between 70 and 100%. Changing your screen percentage can offer you a massive performance increase. And I'm talking, you know, anywhere between 50 to 30 frames per second improvement by going from say 100% down to 70%. Um, I usually recommend keeping it between 70 and 100%. Uh, 70 to 80 is usually a good one. Uh, at the lowest, I don't recommend going below 65 because that's when you start to notice a deterioration in your um, image quality. And also keep in mind, the higher the resolution, the more noticeable that percentage is going to be.

**[18:53]:** So, if you're on a big 4K monitor, uh, your pixel density is much higher and you drop it down to like 65%. It's going to be more noticeable than doing the same thing on a 2K monitor of the same size. But keep in mind, most gamers are running 1080p or 2K anyway. So, you have that threshold to work with um, between those values. Like I said, anywhere between 70 to 100%. I recommend the 70 to 80 range. It's going to give you a big performance increase without really um, being detrimental to your visual quality. The main uh area where you're going to notice um the deterioration in quality when you adjust percentage is going to be distant objects. So everything up close to the screen is usually going to look uh pretty much the same. When you start getting let's say about twice as far away as this uh rock here, you're going to start to notice a degradation in your image.

**[19:36]:** And if you have a large open world for example, and you have a very high visibility distance with no real fog or volumetrics, um that might be more noticeable. But if you have a scene like this for example where I have snow and some uh distance fog that is adding into the ambiance, it can also be used to hide uh certain performance improvement things you're doing like that. So anyway, just keep that in mind. Once again, I recommend doing your own testing to see what works in your use case.

**[20:00]:** So the next thing I want to touch on is anti-aliasing. So if you go to edit project settings and start typing in anti, you can see the anti-aliasing method for mobile and default. So, the one you want to focus on default is default. The default is TSR, right? Temporal super resolution. Um, this is going to be the most advanced and uh overall highest quality and it's designed for the latest and greatest and with like nanite lumen, all that good stuff. Um, if you switch over to TAA, uh, temporal anti-aliasing, um, which is, you know, kind of the older version of TSR, then you're going to notice a slight performance increase, but it's going to be a less stable image and less clean and refined. Um, but you will get a in my experiments about a 3 to four uh, frame per second improvement. Okay, so I just wanted to touch on that fairly quickly.

**[20:52]:** And also, if you switch over to like the forward render for example, then you want to use MSAA instead. um it it'll look uh cleaner for the forward render.

**[21:01]:** Okay, so let's move on to one of the big ones when it comes to performance especially in Unreal Engine 5 and that is Nanite. So Nanite is an advanced um geometry handling tool. It allows you to have uh millions and billions of polygons on screen and have it render as efficiently as possible. It's a basically like a macro uh geometry LOD system and you don't have to use normal LODs when you utilize this. One of the biggest misconceptions about Nanite and I've heard this quite a bit is that it's an all or nothing solution. So you're use either using it for everything or you're using it for nothing. And that is uh absolutely 100% not true. And this is uh also verified in the documentation and also through my own experimentation. And I've noticed a massive improvement performance when I'm not trying to use it for everything and only using it for the things that it's actually designed for.

**[21:50]:** So um what Nanite is great for and should absolutely be used for is high density geometry. So if you have like hundreds of thousands or millions of poly's uh you know static meshes for example uh you would obviously want to use nanite on that as well as um you know if you're using like AK textures for example it also helps uh with that along with virtual texture maps and everything like that. Um it's also really good for assets that repeat uh many times in a relatively small area of your environment or across your entire environment. Uh what it's not useful for is low poly objects that are not used uh that often in you know uh uh close proximity to each other throughout your environment and just lower poly objects in general. Um and another thing that is can also be used for is landscape actors.

**[22:35]:** Um but it's only really necessary if you want to use nanite displacement which I'll go over in a little bit. So I'm going to go in and show you what is using nanite in my scene. So, I'm going to go in here up to where it says lit and go into nanite visualization and click mask. Everything that's green is a nanite mesh and everything that is red is not a nanite mesh. So, you can see this tree here uh this uh repeating uh rock mesh in the background and this little uh repeating mesh here are all nanite and so are these little uh twigs that I have repeating over and over on my ground because once again, these are lower poly assets, but they're repeating over and over in my environment. So, it makes more sense to have nanite take care of them. it's just going to be more efficient.

**[23:15]:** And one of the reasons for that is also um how Lumen utilizes Nanite. Um when you have a bunch of geometry like that, it's just going to be more efficient to use Nanite for Lumen as well, not only the geometry caching. Okay. Um and one thing to keep in mind is when you're using Nanite, um you do want to use virtual shadow maps. If you're using Nanite in any capacity, you want to make sure that VSMs are enabled, which they are by default. So, if I go into edit project settings and start typing in shadow maps, you can see under direct lighting shadow map method is set to virtual shadow maps. Shadow maps or the normal uh cascade shadow maps, which you would want to use if you're not using Nanite um at all. Uh shadow maps are also going to um just using normal shadow maps instead of virtual shadow maps will save uh performance uh quite a bit too.

**[24:01]:** So virtual shadow maps are essentially required if you're using Nanite to any capacity because it it is needed to handle the geometry density and the amount of geometry um uh from different instances and all that good stuff of Nanite meshes. Okay, so uh just keep that in mind. Now there are some console commands you can utilize to optimize um uh nanite. One of the most important is the dicing rate.

**[24:30]:** So if you start typing in dicing in your output log or console, you'll see nanite dicing rate. Right? So if I hit enter, you can see the default value is two. Right? Now if I go in and change this value to six, which is what I recommend, you'll notice that there's no visual difference in the scene, but this is drastically reducing the amount of dicing or uh subdivision essentially that Nanite is doing on surfaces, especially large repeated surfaces like landscapes. This uh setting alone has given me a 10 to 12 uh frame per second increase in performance without any visual quality loss that I could notice. So, I highly recommend adjusting this. I wouldn't recommend going higher than six or lower than two. Uh two is the default. Um but going from two to six has given me, like I said, a 10 to 12 frame on average uh improvement in performance.

**[25:19]:** So, I definitely recommend doing that. I'm going to set it back to the default cuz I want to show you what this does. So I'm going to select the landscape actor once again. If I go into Nanite visualization and mask, you can see my landscape is not utilizing Nanite. I'm going to change that. So I'm go to the landscape itself, collapse all these categories, go into Nanite, check the enable Nanite box, and then build data. So now if I go into Nanite visualization, you can see

**[25:46]:** that my landscape is also utilizing Nanite. Now I'm going to go back into the Nanite visualization, change this to triangles. So now you can see what my surface looks like, right? So these are nanite triangles on the landscape. If I go in and disable nanite and go into wireframe, you can see what that what that looks like. So it's essentially using the existing subdivisions just because the material I have on there is not utilizing nanite. So what I'm going to do, I'm going to go back into nanite visualization, set this to triangles. I'm going to enable nanite on that surface and build data again. So you can see what it looks like now. Now what I'm going to do is swap out this material. Um, this material is not using nanite with one that is using nanite. And you'll see what a difference this makes on the surface.

**[26:27]:** So you can see how many triangles this is generating because this material is designed to use nanite displacement. Right? So the dicing rate is going to have a major impact on how dense this actually is. So I'm going to go back and change the dicing rate to six. And now if you look at that surface, you can see how much less dense this is. But this level of density adjustment isn't really going to affect your nanite displacement as much as you might think. So I'm going to set this back to the default value of two. I'm going to uh rebuild the data for that surface is already done. And I'm going to go back into lit mode so you can kind of see what's going on here. So the this particular material that I have on there now is using nanite displacement. So if I drop down here, you can see that it's actually displacing the surface.

**[27:08]:** If you look at the silhouette here, these little chunks of snow on the ice and all that stuff are actually being deformed and everything like that. If I go over to the snow itself, uh let's see, let's find a good little spot where we can see it. You can see these little ridges in the snow. That's all being displaced um using nanite displacement. So, you get full silhouette. And if I go over to like an edge here, you can see all that silhouette detail showing up, right? That's all from nanite displacement. If I go back into the landscape and disable nanite, you can see that it's just a flat edge. you just see the polygonal geometry of the the uh landscape actor, right? So, I'm going enable rebuild that data. Okay, so now we have nanite uh displacement enabled. Now, if I go in uh once again, right now I have the dicing rate set to two, which is the default, but I'm going to go into a little area here.

**[27:51]:** We can see a little more micro macro detail. So, these little rocks for example, right? This is all using nanite displacement. If I go in and set that dicing rate back to let's say six, and you pay attention to the viewport, you can see that the difference is very, very minimal. And you're not going to notice this in uh standard gameplay anyway because your character is going to be, you know, standing roughly this height. And even if they're prone, they're going to be laying like right here. And you're not you're not going to notice a difference between this and this, right? It's not a major difference unless you see them side by side. You'll won't even be able to tell. So for most use cases, this is going to be fine. So I do recommend this is one of the most important console commands you can put into Unreal Engine if you're using Nanite to improve performance.

**[28:31]:** Like I said, 10 to 12 frames is what it got me on my uh my tests on multiple machines. So, it's a big uh big improvement. Okay. So, I'm going to leave that as that is there. Now, talking about console commands, I'm going to be going over a few of them. If you ever want to um have those console commands carry over into your game when you do a build, it won't necessarily carry those over if you put them in the console here. You have to type them into the game as well. But if you want to have them load every time the game loads, you can go into your level blue blueprint by clicking on this open level blueprint, right clicking, and type execute console command. Just type in console and execute console command is the one you want. You can plug this into your event begin play.

**[29:13]:** And then in here, you can type whatever that console command is, right? So rn nanite dicing rate, whatever it's going to be, and just like you would in the console. And then it'll play it. And if you want to have multiple console commands, you can just duplicate this out and tie them together and it'll execute all these on uh as soon as the map loads in your game, right? So, just keep that in mind. For the purpose of this video, I'm not going to be doing any game compiling, but just know that you always want to do your performance testing in your actual uh game. Um, another thing with Nanite is you do not want to use world position offset. Um, always use Nanite displacement if you want to offset the surface on a Nanite uh enabled mesh or landscape actor. Another thing that Nanite um is used for uh nowadays, I believe as of 5.6, it may have been in 5.7, is uh skeletal meshes.

**[29:58]:** You can actually use these uh use Nanite for your characters um for highly detailed characters. The only game I know of uh I believe that has shipped using Nanite uh for their skeletal meshes was uh Blackmith Wukong. Now, once again, I keep referencing that. I do think that's the highest visual benchmark for a released Unreal Engine 5 game. And they also did a really good job u I think mitigating performance. And also keep in mind that game was released before nanite foliage was a thing. So it's still using non-nanite foliage which also impacts performance when you're using nanite for everything else.

**[30:30]:** Okay. Since we're on this landscape service uh once again I currently have uh nanite uh displacement enabled on the surface. Right? So you can see I have actual silhouette detail in the surface. It's not just faking it. Um it is actually uh adjusting the surface geometry. Right? Um, now one thing to keep in mind with this is when you use nanite displacement, it does not adjust the collision hole. So the collision is still going to be the base um, uh, surface of the landscape actor. So that's why you don't want to use too high of a um, offset value for your nanite displacement um, because you know your characters will uh, bleed through it. But for things like this, we have these little like uh small details like the chunks of snow, the little um uh ripples in the snow itself, these little uh rocks and things like that.

**[31:15]:** It uh works very very well if you're going to be using uh nanite displaced uh landscape actors. What I recommend using instead for most use cases is going to be parallax occlusion mapping, which I'll go over in just a second, but I want to show you uh one of the the drawbacks or one of the other benefits of using nanite displacement over parallax occlusion mapping. And that's going to be a shadow casting. So since this is actually um elevating the geometry of this surface, um you are getting shadows from that elevated uh surface. Right? So if I slide this light around, you can see the light uh actually casting shadows on the little ridges being created by this height map information. Right? If you go over to parallax occlusion mapping, you do not get that. But you do get enough shading from the normal maps that are also offset with the parallax effect or the parallax offset effect that it almost looks like it's self- shadowing.

**[32:02]:** And in most use cases, that won't be noticeable because you'd have to have a pretty low light or really low directional light or something like that to really start seeing these uh detail shadows. But in some cases, you may want that, like if it's a brick wall with a lantern next to it or something like that. Okay, so just keep that in mind. So I'm going to switch this material back over to the one that was originally, which is parallax occlusion mapping. So I'm going to disable nanite. I'm going to switch it back to the parallax occlusion mapped material, which once again is the exact same material. is just using parallax occlusion mapping rather than nanite displacement. So if we go close to the surface here, you can see that we still get all that uh height information for these little toughs of snow on the surface for example uh the snow itself, even these little rocks

**[32:41]:** and all that, but this is not actually offsetting geometry. So if I go down here and go, you can see it's a a straight line. So this is uh virtualizing that um height information, basically making it look like it's height when it's not really. It's just shifting things around on multiple different layers that are stacked on top of each other to make it look like depth and it occludes itself. That's where the parallax occlusion mapping name comes from, right? A lot of games utilize this technique. Even brand new modern games like Arc Raiders, for example, it uses um all parallax occlusion mapping for any of the depth effects that you see. If you get up close to the surface, you can see some of the telltale signs of that. Red Dead Redemption 2 is a really good example of a game that uses a lot of parallax occlusion mapping.

**[33:19]:** Um, and yeah, it's just a it's a really good performant technique that gives you um everything that you need without the performance hit of uh something like nanite displacement or uh even tesla displacement from the past which is no longer supported in Unreal Engine 5. So the way parallax occlusion mapping works just as a quick note uh the best way to think about it is a height map where black is the lowest value, white is the highest value and then you're stacking shells along that height map depending on how far you set the height. And each one of those shells is masked out by wherever it intersects with the height information. And that gives you the illusion of depth when they cross over each other. So if I go down low enough, you can see the uh those layers being stacked, right? So you have to go very low to the surface to be able to see this uh normally.

**[34:03]:** So if you're like normal player height, you're standing, let's say, right about here, right? This is a 6ft uh reference, then you wouldn't notice that at all. Even if you're laying prone, let's say it's a, you know, a game where you have prone and you're laying down, you're not going to notice it too much. Even games like Battlefield 6 utilize this technique. And if you go to certain angles, you can see that. Um, another downside to parallax occlusion mapping is going to be the fact that it warps around curvature. Um, you can see it a little bit here. It's not as noticeable because it's a white surface, but it will actually warp because it doesn't really know what to do with the camera angle. There's some Fresnel techniques that I've developed that kind of mitigate that, but it's not you can't really get around it completely.

**[34:37]:** But if you use it properly, in most cases, it's not going to be that noticeable. But if you have like a sphere for example or maybe even this highly detailed mesh around the edges of it, it's going to uh warp if you utilize parallax occlusion mapping. But for landscape actors and things like this and these little small details, parallax occlusion mapping is extremely efficient. And one of the ways you can make it efficient is by um controlling the level of uh shells or layers based on camera distance. So where parallax occlusion mapping becomes expensive is when it's repeated um over a large area. So every time it repeats, it's basically rendering that those shells again. So for a landscape, for example, that can become extremely expensive if you're not mitigating it with camera distance. So if I zoom in here, and you can see off in the distance all that height information up there, kind of see where it transitions as I move forward, you can see that the height is raising and then

**[35:28]:** lowering as I pull back. Okay. So, what I'm doing is adjusting the height offset of the parallax exclusion mapping as well as the amount of layers or shells as the camera gets farther away. And if you do this with the the correct distance, so I have a a beginning and end fade radius. So, it's basically going to have like a gradient fade uh in a circle around the camera or a sphere around the camera, then it's not even going to be noticeable as you're traversing the environment. Um, you'll only notice that uh raised detail when you get close to it and farther away, you're not going to notice it. It's it's lowered down. And this can improve performance quite a bit. So my default shell count is I believe 64 when you're close up to it and then off the distance it goes down to one.

**[36:07]:** You don't want to set it to zero because that's basically no surface whereas one is just going to be a flat surface. Okay. So uh when it comes to landscape actors and trying to get depth and stuff like that, the most performant way to do that um would be to use parallax occlusion mapping rather than nanite displacement. And in most use cases going to be more than enough for what you're going to uh to need. So I do recommend uh doing that rather than using nanite displacement. Okay.

**[36:32]:** So uh staying on the point of nanite I want to go over foliage uh real quick. So in the past foliage was always uh built for real-time rendering using uh masks. Um so essentially you'd have a single card that represented a bunch of leaves. Uh there was a single uh texture atlas and you have that applied to cards on your mesh and they'd have normal maps and stuff like that with light transmitting through them and they kind of represent the geometry. the geometry wasn't physically there with nanite since it can do uh massive amounts of geometry that technique is now changed where individual uh components of the the foliage are actually modeled out. So if we get really close to this uh you can see that each little pine needle and everything is fully 3D modeled. There is no masking, there's no transparency, anything like that.

**[37:17]:** And it still has um emission uh or not emission uh transmission values. So, uh, subsurface scattering, stuff like that, as you'd expect. Now, this, um, basically fixes quite a few issues. The core issue being overdraw. So, when you have a bunch of transparent or masked objects over one another, so foliage like trees, bushes, stuff like that. Every one of those, it overlays over another one, it compounds the amount of rendering that it has to do. So, it has to figure out what's behind it and then what's behind what's behind it and stuff like that, right? So if you have a bunch of panels of glass, for example, over each other, it's got to figure out, okay, this piece of glass behind this piece of glass, and then this one's behind that one, and then each one has to figure that out. So it's the same thing with foliage, and it basically adds to your draw calls, overdraw, all that good stuff.

**[37:59]:** And it's just not a good thing to do. Um, but with Nanite geometry, since it's full geometry, you don't have to worry about it being masked or translucent. It's just geometry. And because Nanite can handle that, you can have massive amounts of um highly detailed foliage in your environment. Now, another technique that's been introduced um to help facilitate this is uh voxalization. So, in the past when you had those like masked uh foliage um setups, you would basically transfer over to what was called an impostor or a billboard. So, it basically be a um flat plane that had a projection of the tree on it. The impostor version of it would actually change that angle based on the angle of the camera at distance. So it would be really hard to tell what was even going on, but essentially just be rendering a uh flat masked surface off in the distance rather than the fully detailed tree.

**[38:50]:** So with Nanite and voxilization, you no longer have to do that. So I'm going to show you how to preview voxalization. So if you go down into your um uh command console or output log

**[39:09]:** and start typing in r.nite.view view mesh. You can see that there is a bias.offset. So if you hit this, you'll see the default is zero. I'm going to set this to three. And you're going to be able to see how this tree is being voxalized. Right? This is basically um uh magn uh multiplying the value by three. So off in the distance, it turns into these voxalized cubes which are still geometry and they'll still receive light, cast shadows, do everything you expect it to do off in the distance. It even keeps the color correlation. And you can see little bits of snow and all that stuff in that distance representation based on its pixel density in the scene, right? So it's it's uh screen space pixel density. So that's basically what's happening way off in the distance as I get farther back here. Um and because the way it's integrated, you're never going to notice it.

**[39:56]:** So you can have, you know, uh thousands or tens of thousands of pieces of foliage going off in the distance that are all physically uh represented with the lighting and everything like that. And with virtual shadow maps, you can see way off into the distance. And it just works really, really well. Another thing to keep in mind is that um nanite foliage, vegetation is no longer static. It is actually a skeletal mesh. And what this allows uh Unreal Engine to do is have all of its animation, everything driven by a skeleton, even off in the distance. And all of those voxalized cubes are still offset by that skeleton in the distance, even though it's going to be a down sampled version of the skeleton. And it's all instantiated. So you um basically can have, like I said, high amounts of geometric detail, foliage with wind animation, all that good stuff.

**[40:41]:** Uh going far off in the distance. A really good example of this was the Witcher 4 tech demo that they showed. They kind of break down how they did this. Now, another thing with these trees is each component is basically um an instanced piece. So like, you know, this branch with these pines on it, there may be four variations of that. Uh the individual branches, there may be a couple variations of that. the trunk itself, you know, there may be spline based variations of that and then they're all assembled in the vegetation system and then they create the tree. So instead of loading this entire piece of geometry as a a single piece of geometry, it's loading these instances and combining them all together. This drastically reduces file size on disk. And this is something I'm going to go over a little bit with the static meshes as well.

**[41:23]:** Okay. Now, one thing you will notice on this tree is there's no wind being applied to it. It's actually a bug that I didn't get to fix before the I started the video. It's just a deformer setting that you have to adjust, which I just didn't uh didn't go in and do, but that's the only reason there's no animation on that, but it is a static mesh. Now, very quickly, I'm going to show you how to enable and disable voxilization um on these meshes. So, I'm going to go into the uh skeletal mesh itself. It can be a static mesh as well. It doesn't really matter what kind of a mesh it is. You can use this on pretty much any type of static or skeletal mesh. So in the editor for that mesh, you go into the asset details and nanite settings. If you scroll down, you'll see something called shape preservation by default because this is already a nanite uh vegetation or foliage um asset.

**[42:09]:** It's going to be set to voxalize, which is what I just showed you. You also have preserve area, basically your standardized uh LOD system, and you can set it to none. So you can do this for static meshes as well. Um any asset that has nanite enabled on it can uh can have that. And one more note on nanite um is going to be in order to enable disable it uh you basically select your static mesh or load it in the mesh editor and go to nanite and enable disable it. But if you select the mesh itself or multiple meshes you can right click on it go to nanite and you can choose enable or disable from these uh settings here. Right? You don't want to check this box necessarily. It basically does the same thing but usually it's better to do enable or disable.

**[42:49]:** And then you can isolate which meshes you want to have nanite on. uh maybe you have two different versions of the mesh where there might be one where it's uh shown just once in your environment then in another part of the environment it's uh used multiple times. You may want to have one version that's nanite, one version that's not. Usually it's better just have uh every use of that mesh in the scene set to nanite if it appears many many times in your scene within an area where they're all being rendered. So like these twigs for example are perfect for nanite even though they're not the as high poly as high poly as something like this um rock wall back here.

**[43:21]:** So, continuing with static meshes, I want to go over where to draw the line with your quality. Now, one of the big things when Unreal Engine um you know, when Epic Games released the Unreal Engine 5 uh unveil video was they're talking about the massive amounts of geometry you can render with Nanite and all stuff, which is true. It doesn't mean that you should. One of the main reasons is not just for performance, but it's actually file size. these assets can become massive and there's not in most cases there's not going to be a big enough of a detailed difference for you to notice that visual difference compared to the amount of file size you're using. So that's why you might see quite a few games coming out um nowadays that are just massive in file size especially running Unreal Engine um because they're utilizing these ultra high-end meshes um and on disc those files are

**[44:06]:** absolutely huge. So I'm going to show you a comparison of that. So I'm going to use this rock in the background for example.

**[44:15]:** Okay. So you can see I have two versions of this rock. You'll see that there's underscore0 and underscore one. And just a quick tip like a side note, if you ever want to find a mesh, these are obviously mega scans assets. You can copy this alpha numeric serial that all these assets have before them. It's unique. If you go into fab,

**[44:34]:** all you have to do is paste that alpha numeric serial in and it'll take you straight to that asset. So this is the one that I'm using here, this large Nordic coastal cliff. So if you go in here, you'll see that under this uh quality dropown, you can select raw, high, medium, or low. Right? Raw is going to be the absolute highest quality. This is where you get multi-millions of polies, everything like that. High quality is going to be usually a high quality hero asset for game use. And medium and low quality are just that, right? I always recommend if you're building a game and you want it to be ext get the best performance and everything out of it using high quality. The visual uh fidelity of this other than the 8K texture um but the silhouette and everything like that is going to be almost incernible in most gaming use cases.

**[45:19]:** Right? If you scale this asset to be extremely massive, uh you may want to go with the raw quality. But I always recommend doing a side-by-side comparison if you're considering using the wall raw quality to see if it's actually giving you that visual benefit of the extra raw data. Usually, you'll only want to use these for visual effects and cinematics and stuff like that. But I always recommend using the high quality rather than raw for most use cases, especially for uh game development. So, I'm going to show you why I recommend that. So, I'm going to load both these assets. Keep in mind that underscore0 is raw and underscore one is high quality. Right? So I'm going put this over here. Okay. So the left is my raw. The right is my high quality. So if you look up here, you can see that the nanite triangles for my high quality are 27,000.

**[46:08]:** The nanite triangles for my raw asset are over 2 million. Right? So it's a massive jump. It's actually uh uh 2.09 million. So even this 90,000 is, you know, basically three or four time, you know, much higher than just this 27,000. But the main part of it is actually going to be file size, which I'll go to in a minute. So if you uh really want to see the quality difference, I'm using this asset as a reference, but it's going to kind of change based on the asset, but in most uh scenarios, it's going to be pretty much the same. Let's say I go close in uh right over here, for example, and I'm going to go into that same area on this side. So basically right here, right? Actually, it's a little farther back. Something like that. Okay. So that's pretty much the same area.

**[46:56]:** So you can see the level of detail, right? Visually, it's pretty much comparable. You notice like little things like this little ridge cut out and stuff like that or actual geometry here. And here it's basically using normal maps. But sideby-side comparison, you can see the small little differences in the level of detail. But in most use cases, unless someone sees the higher quality next to it, they're getting up close to it, you're not going to notice that difference in detail. And I'll show you what that looks like with a wireframe. So, I'm going to do lit wireframe and lit wireframe. So, you can see the purple here. This is how dense the higher mesh is. And this is how dense the uh raw mesh is. It almost looks like a solid purple until I get really close. Right? If I go into just a regular wireframe, you can see that density even better.

**[47:42]:** Okay? So you can see the density uh difference between the raw and the high. Right? So like I said, visual difference is not going to be massive between these two, at least in my experience, especially um when you're dealing with most of the scale meshes. Some of the larger meshes meshes like massive cliff faces and stuff like that might benefit from that extra detail and text resolution. But where this really comes into play is file size. So this is also something that goes into optimization. not just your performance level but how big are these assets that you're storing and what are you asking the user to install. So once again zero is raw, one is high quality. So I hover over the high quality. You can see that the uh fourth line item down is disk size. So that's 1.5 almost 1.6 megabytes, right? You can see that the estimated uh compressed total compressed size down in the middle of this uh menu is 677 kilobytes.

**[48:34]:** Right? So keep that in mind. Now, if I go over to the raw asset and you look at those same numbers, the disk size for this raw asset is 77 almost 78 megabytes. And the compressed size is 18 megabytes. So, we're basically going from a compressed 18 megabytes or a compressed uh 677 kilobytes under 1 megabyte to over 18 megabytes just for this one asset. And as you saw before, the visual quality does not really represent that uh discrepancy in file size. So, just keep that in mind when when setting up your assets. And obviously you kind of want to decide on a per asset basis as to what quality you actually need. Okay.

**[49:12]:** Um now one more thing I want to go over is LODs. So if you're using Nanite, you don't really have to set up LODs. Uh but um like I said, in most cases, you do want to just use the high quality if you're using Mega Scans assets. I'm using those as a reference because those are kind of like a standard nowadays. Um is you do want to set up your LODs, which you can do directly in Unreal Engine. You don't have to worry about creating them separately. So I'm going to double click this high mesh and show you how to do that. So we go in here, you'll see that you have uh different LOD settings. The most important one is LOD uh number of LODs and then your reduction values. So by default number of LODs is going to be set to one. When you change this value, hit enter and then hit apply changes.

**[49:50]:** It will automatically create a LOD1. So the default is LOD0. That's your hero. LOD 1 will be 50% of that uh poly count. And then LOD 2, which is your third LOD, will be 25% of that polyc count. Right. So, you can actually get uh automatic uh LED creation. I always recommend using between three and five LEDs. Anything more than five, you actually run the risk of it being more expensive to transition between those LEDs. Especially if you have a bunch of these assets in your scene, it's got to figure out, okay, it's at this distance. I need to swap over to this LED. And if you have a bunch of those happening simultaneously going back and forth and all that, it can actually uh be more performance overhead than just using less LODs. I think three is a good number. I wouldn't do more than five.

**[50:32]:** and but it'll automatically set those up for you. So, that being said, if you look at the top left here, you can see my nanite triangles, right?

**[50:43]:** Uh, this asset does have nanite enabled, which I just realized. So, I'm going to disable nanite just so you can see what this looks like.

**[50:53]:** Okay, so now this is a nonnanite mesh. So, if I get close to it, uh you can see over here my uh polyc count is 27,000. As I get farther away, you can see it drops to 13,000. And even farther away, it drops to just under 7,000. Right? Those are the automatic LODs taking place. And how it figures out the LEDs is based on screen space, right? So, it figures out how dense or how much pixel space is taken up and where you're actually going to notice that transition. So, if I pull out, you can see um those transitions happening. But to the user, it's going to be seamless because it figures out uh where the silhouette is adjusted and everything based on distance. Now, another thing to keep in mind is you can also um do your own reduction. So, we go up here to LOD picker and let's say I set this to zero.

**[51:35]:** That's my hero LOD. I've set this to one. You can see that the uh termination method is triangles and the percentage of triangles is 50. If I set this to the highest lowest LED, you can see it's 25%. Right? But what you can do is if you go to your hero LOD, you can change the percentage of triangles for this. So, right now, if I go to my uh let's say LOD 1, you can see that it's 13,000, just over 13,000 triangles. If I set it to LOD0, it's 27,000 triangles. At my LOD0, if I change this to let's say 80%. Hit enter and apply, it's going to gen uh basically uh decimate this down to 80% of those triangles. And now you can see my LOD0 is now 21,000 instead of 27,000. And my LOD1 since it's 50% of that is just uh under 11,000.

**[52:20]:** So it automatically reduces those other LODs for you, right? So just keep that in mind. And if you want to go back to the original, just type in 100%. You can also do a max triangle count if you want to. Okay. So um it's always good to utilize LODs um whenever you're not using uh nanite on an asset. Another thing that I also recommend, I'm going to reenable nanite on this. Save all that is setting up your cold distances. Even if it's a nanite mesh, having a cold distance on it is um always a good practice for efficiency. So, I'm going to use this rock for example. Once again, this is not utilizing lumen, as you can see, or nanite because it's red. So, in here, you can set your um oh, actually, it's a mesh under the um blueprint. So, I'm going to set this to value 500, right?

**[53:10]:** My end call distance. You can also do a start call distance. If you have mask uh if you have a mask material on this, it it will actually fade in and out. Um if it's just an opaque material, it won't do that. As I get close to it, you can see now within 500 units, it pops in. Out of 500 units, it pops out. You always want to set this call distance um for your assets. You can also do it in bulk if you want to by selecting multiple assets based on where you're not going to notice them disappear. So, for example, if I zoom in a little bit here, you can see these twigs. All of these are nanite, but I still have cold distance values on them. so they disappear in the distance. If you're just walking around normally as a player and all that stuff, it's still somewhat noticeable.

**[53:48]:** But if I had other assets in the scene, uh, like trees and rocks and all that, it wouldn't be as noticeable and would kind of hide some of that, right? Using volumetrics and particles, whatever. But you can adjust that distance to where it makes sense, where it doesn't pop in and out. Or if you have uh mask material on it, you can fade it in. It's just less uh less noticeable, right? So, just keep that in mind. It's always good to use um LEDs and call distance even though nanite is a thing. And one other quick note on that. Um, when you're using the LEDs and reduction and all that stuff, when you use the poly reduction, it's always good to reduce the polyc count as low as you can within the visual threshold for what you're trying to retain. Right? So, as you do those reductions, you'll actually see the normals and the surface change, the silhouette change, all stuff.

**[54:27]:** When it gets to that threshold of where you are happy with the quality and you have the lowest poly count, um, it's a good idea to to keep it there. And that's kind of how you want to uh go about approaching that.

**[54:38]:** Next thing I want to jump into is going to be lumen. So lumen is another um obviously core feature of Unreal Engine 5 and it is tremendously useful not having to to build lighting and all that good stuff, but it can also have its performance drawbacks. So with full rayraced lumen, you're getting the absolute best quality. There are alternatives such as Nvidia RTXGI which um Arc Raiders for example utilizes. It uses a uh Nvidia RTXGI branch of Unreal Engine 5. RTXGI is going to be more performant um but not quite as well integrated as Lumen in Unreal Engine 5, but for most intents and purposes, it will um actually work really really well if you want to deal with a country uh custom branch of Unreal Engine. Now, as of I believe it was 5.6, hardware ray tracing is the standard moving forward. So software Lumen isn't really being supported anymore.

**[55:33]:** It's still in there, but they're not really updating it for performance and all that good stuff. As of 5.6 and 5.7, hardware ray tracing on modern hardware and consoles and all stuff should be more performant than software ray tracing. Um, at least according to Epic Games, right? So, um, if you do use Lumen, there are different components to it, right? There's the real-time uh, lighting and shadowing. There's also the, uh, ambient occlusion, and then there's the global illumination, as well as the reflections. You can choose uh pick and choose which of those you want to use or not use and what the the quality levels of those are going to be. I'm not going to go over the specific settings for those. Uh you can adjust all almost all those in the post-processing volume by looking under the lumen uh global illumination reflection settings. Right?

**[56:20]:** But as of Unreal Engine uh 5.7, I think it was as early as 5.6, hardware ray tracing um is on by default and that is going to be the most performant way to utilize uh Lumen. Other alternatives would be using screen space reflections rather than lumin reflections. And then there is also screen space ambient occlusion which has been around in Unreal Engine since I think uh like 4.6 or 4.7 back in the Unreal Engine 4 days which is also a valid solution um and going to be more efficient than utilizing uh lumen and uh uh certain use cases. Okay. So overall not too much to talk about with Lumen. Um, if you're using uh, once again, if you're using Nani geometry, then you want to use a virtual shadow maps along with lumen for real-time lighting. Another thing with Nani geometry is obviously baked lighting isn't going to work very well because of the density of the geometry and all that.

**[57:07]:** All right, so the next thing I want to go over is going to be materials and textures. This is another important um, part of optimization that a lot of people don't spend enough time on. So, uh, the core component of that being how you utilize your materials. So I'm going to go into this uh material for example. So once again this is the parallax occlusion mapped um landscape material that I've created. With this material I'm utilizing a material function. So if I load up this material um this is actually a material instance. So this material instance is an instance based off of a master material that I've created. And then within that master material I'm using functions. So the breakdown is master material which utilizes functions and then creating an instance or instances off of that master material. What this does is it instantiates that material.

**[57:55]:** So let's say you have a uh master material that is utilized for all of your standard PBR assets. So every static mesh you have, right? So every rock, every tree, branch, all that good stuff. You would basically create an instance off of that for each one of these meshes. So, you know, I have uh one material instance that's used for this log, and then this log can be duplicated as many times I want throughout the environment using that material instance. This rock can use its own material instance for the core asset. And then I can duplicate the asset as many times I want to in my scene using that same instance. All of those instances are referencing the same single master material. Um, and then basically what's happening is it's loading that master material once and then figuring out what's different for each instance rather than uh basically figuring out for each asset uh what each different material is.

**[58:40]:** This is also another level of efficiency. So once again this is the material instance. If I go into general I can open its parent which is the master material and as of 5.6 maybe 5.7 substrate is the latest material system. It's going to be on by default and I'll touch on that in just a second. So this is the master material and then these are functions right each of these functions is basically a group uh it's it's its own material graph essentially its own uh master material setup very same similar to the master material itself that you can then reuse as nodes and other materials. So let's say uh rotation and tiling and all that stuff, you want to use that for multiple different master materials, you just create one function for it and repurpose it and it's basically its own um instance of that

**[59:25]:** uh function for each uh material, right? So let's say I have uh a material for landscapes and then I also have that has uh three layers and let's say I have another material for vertex painting that also has three layers. I can use that same tiling and rotation with the three different uh um sets of parameters for both of those materials, but it only loads at once. So, if I go into the tiling rotation, for example, right, it's just a normal material graph with these things set up. So, I have tiling for the and rotation um for the four different layers. And then that's its own uh material function, which you can see here, right? And I can just literally just drag that and drop it into any of my materials, plug in the pins, and use it like that, right? So, this makes things a lot more efficient.

**[1:00:07]:** You can reuse these functions over and over again. It also consolidates your nodes and it just uh as another level of instantiation.

**[1:00:16]:** Go ahead and save everything. Okay. So, those are the basics for optimization using materials. Like I said, I'm not going to deep dive into this stuff. It's more just uh basic knowledge on how to utilize these uh tools that are in Unreal Engine.

**[1:00:30]:** The next one is going to be textures. So, I'm going to go in and load up this material instance. And as you can see, I have all my textures in here. So, I've got uh my texture set uh three different textures for layer 1, 2, 3, and four. Now, you can see that these are very strategically named and organized. So, layer 1 uh albido and uh t m r ah and normal. These are the texture sets that make up the surface for my snow in this case, right? Um I don't name things by the actual layer that it is. So, I don't name it like snow, dirt, and all that stuff because it gives you a more uh neutral template. So you just know it's layer 1 2 3 and four and you can swap those textures out to whatever surface you want them to be.

**[1:01:08]:** Now another thing to notice is the naming here. So albido T is albido and transmittance. So the RGB or the um albido colors. The alpha channel is the transmittance value. So basically um masking out where subsurface scattering can happen and how much of it can happen. Mah is metallic roughness ambient occlusion and height. So metallic roughness and ambient occlusion are all in the red, green and blue channels. as you can see broken down here. And then height is in the alpha channel. Normal is its own texture. Usually you don't want to compress anything into a normal texture, but uh you can. And what this does is essentially taking 1 2 3 4 5 6 seven textures and compressing them into three. This reduces the amount of assets that you need to work with. It makes things more efficient. Plus, it also reduces the overall file size.

**[1:01:55]:** compressing these uh seven textures into these three gives me a file size of basically a third of what these seven textures would have been separately in my testing. That's kind of on average. It can fluctuate. Um but yeah, that it's just an extreme savings, especially when you're talking about you have, you know, hundreds or thousands of textures for whatever you're building. You want to reduce that overall file size substantially. Now, another way you can reduce file size. I'm going to click on this and find these textures. actually just going to go into one that has a bit more detail like this uh dirt for example. So this dirt is what I'm using over here. Okay. So you can see what it looks like and it's uh it's um default setting. If I hover over this, you can see all the details for this. So this is a 4K texture.

**[1:02:37]:** I'm going to load this up to by just double clicking on it. This is the texture editor. So the details over here are what are important that I want to go over. So you can see over here it says uh imported, displayed, and max in-game resolution is 4K, right? 4096 x 4096. The resource file size is 10 megabytes, almost 11 megabytes, right? Um, this is a 4K texture. Now, another thing you'll see is the number of MIP maps is 13. Submit maps, just to touch on very quickly, are essentially interlocking triangles. They get progressively larger the farther away they get from the screen and based on the camera angle and all stuff, they're essentially um LODs for the textures, right? And it also avoids things like morray effects and all that. This can only work if the texture is a power of two. So 4096, 2048, etc.

**[1:03:24]:** Um, it doesn't have to be squared necessarily, but it does have to be a power of two. If it's not, then it can't generate maps. Then you run into other issues with performance and visual quality and stuff like that. So the main thing to keep your eye on is this um 10 megabytes. So if I go under compression, I can choose a maximum texture size. So I'm going to drop this down to half. So 2048. Now look at this file size drop down to uh 2.7 megs. So, I dropped the resolution in half, but it basically went to a quarter of the file size. The reason being is even though I dropped the resolution to half of 4K, it's actually a quarter of the texture size because you have to remember it's 4K across and 4K vertically. So, when you drop it down from 4K 4K, it's actually going down to 2K by 2K.

**[1:04:07]:** So, um if I drop it from 4K to 2K, it's essentially going from uh here,

**[1:04:16]:** right? Or going down to here. So this would be 2K if the entire image was 4K. So it's a quarter of the image size. So that means a quarter of the actual file size. So you can import your textures at whatever resolution you like. Uh usually I don't recommend using more than 4K. And then you can down sample as needed, but it's always a good idea to go in and down sample your textures in Unreal Engine since it's a nonre uh destructive workflow to whatever resolution makes sense for how they're being utilized. So in this case, this is a repeating texture over a landscape actor and all that good stuff. So, I can get away with a, you know, pretty um low texture resolution. So, I'm put it side by side with this so you can see the visual quality difference. Oh, actually, because it's uh uh non, it's not going to render in unlit.

**[1:05:00]:** So, I'm going to go in and set the uh maximum texture size again to zero, which means it'll be at the original 4K. Then, I'm going to drop it down to 2K. Now, watch the uh details here, and you'll see what that uh does to the visual quality. Okay, so now it's at 4K, now it's at 2K, 1K, 512, right? So you can see that it degrades quite a bit from 512 compared to 4K. Um, if you're standing normal player height, which would be roughly right around here, and you look at that surface, let's say even if you're looking directly down, it's at 4K, 2048,

**[1:05:39]:** 1K, and 512. So you can see I could probably get away with a 1K and nobody would really notice the difference. Uh 2048 I could definitely get away with and that's saving me a tremendous amount in file size. So if I go back here and let's say I go back to 4K, you can see the resource size is just under 11 megs. I'm going to go down to 2048 again, 2.7 megs. Go down to 1024. It's under a megabyte, right, for this one texture. And if you're doing that for multiple textures, like hundreds or thousands of textures, and you're um you know, adjusting your texture size for what's actually needed, um you can save a lot of file size. And the file size also affects performance as well, like the resolution of the textures, right? So, it's always good to go in and adjust your textures as uh needed for their use case for performance and file size.

**[1:06:24]:** You can do this through multiple textures as well. So, I can select as many as I want. I'm just going to select this texture set for these three. Rightclick, asset actions, and edit selection property matrix. and then select one. Ctrl+ A to select everything. Compression and then texture size. And you can put that in here. Hit enter. It'll automatically uh reduce it all those for you. If you type anything that's not power of two, like 2,00 it'll automatically make it the next closest power of two. Zero will always be the original file size. Now once again in the actual editor the original resource is stored at its original imported resolution but how it's shown in the editor and in a build and all stuff will reflect the uh modified resolution. Right? So just keep that in mind for efficiency. That's it's a it's actually a very big one to um keep your uh text resolutions in check for what's actually needed.

**[1:07:14]:** Like I said I always recommend importing at the highest resolution you may ever use. Uh most cases going to be 4K. If you do have a use case for an 8K, like a very large monolithic mesh or something like that, then that's fine. But um usually 4K is going to be the maximum you want to use for like a game, for example.

**[1:07:29]:** And the very last thing I want to go over is another one that is a common uh issue with Unreal Engine 5 games, which is world partition. World partition is essentially an automated system for asset management, for loading and unloading them as you traverse an environment. And a lot of Unreal Engine games, actually a lot of modern games in general, have that shader pre-loading whenever you load the game up. So you think of like Battlefield 6, Blackmth, Wukong, Arc Raiders, things like that. Uh those all have like a pre-ompile for the shaders. When you get into the game itself, um it's actually loading assets on the fly based on uh their um uh your view fosterum, things like that. World Partition essentially automates a lot of that and a lot of people just rely on it to do what it's supposed to do, but it does have some issues and it can introduce massive uh hitching.

**[1:08:14]:** Hitching is, let's say, you know, you're traversing environment, everything's running smoothly, whether it's 30 frames, 60 frames, whatever, then all of a sudden it it spikes and you see the game kind of uh stutter for a second and then go back into normal smoothness. That's usually due to world partition loading and unloading assets. And it depends on which particular chunk it's loading at that time and and how detailed it is, how many it's loading at once and stuff like that that can cause those hitches. There are ways to go in and spend your time mitigating it and all that, but um world partition is only really designed to be used for large open worlds. If you don't have a large open world, um then you don't really need to utilize world partition. You can also set up your own uh manual methods of preloading and stuff like that.

**[1:08:55]:** What you want to do is mitigate the amount of load time there is between, you know, environments or when you go from the menu into the game, stuff like that. But if you're not using a large open world, uh you don't really have to use world partition. And I recommend not using it unless you absolutely have to. And essentially how world partition works is it separates the entire world into uh grids basically like a 3D grid. And it loads those uh uh sections of the grid of the environment uh dynamically as you're moving through environment. Kind of figures out automatically how to um how to load all those things. Right? So it's just another thing that uh I recommend trying to avoid. And then to close out this video, I'm going to go over a couple um console commands uh that I mentioned I would go over earlier.

**[1:09:40]:** So some of these are profiling uh commands. And once again, I recommend doing all of your profiling and performance testing and everything like that in an actual build uh not in the editor. Um and when you do that, you can bring up the these console commands as well. So uh one of them is going to be stat GPU. This will give you an overlay showing you what is being sent to the GPU, what's taking up your um your frame uh rendering, all that good stuff. And you'll see as I look around that changes. So that is one. And if you just type it again, it'll go away. The other one is stat unit. Okay. There's another one. This gives you a little bit more simplified uh thing showing your uh rendered resolution, right? So, it actually shows you here I'm at 100% and this the resolution of this window because it's not my full screen is 1616 by 902.

**[1:10:28]:** It shows you how many draws are being done, how many primitives uh the actual poly count on screen. Uh the frame time frame time you're usually good anywhere between 7 and 12 milliseconds is going to be like the average for uh good performance. And that directly correlates to um how many frames are being rendered, right? So, I go in and enable um viewport stats frame rate for example. You can see I'm getting uh about 96 uh frame rate uh frame uh 96 frames per second and that's correlated to 10 milliseconds. Right? As I look down you can see that drops a little bit goes over 100 frames. This is 110 frames per second it looks like which is around 9 milliseconds. Right? So just keep that in mind. I'm going to go back in and uh disable the um viewport stats for the frame rate.

**[1:11:17]:** And I'll go back into disable that stat unit. Another one is stat RHI. So once again, we're in the uh direct um directx uh 12. So this is stating our DX12 RHI. And this will give you more detail like how much texture memory is being used, uh index memory, buffer, all that good stuff, right? Or buffer memory. Um and this will give you another um uh idea of what's going on in your scene, right?

**[1:11:50]:** Now, another thing you can go and adjust um via console and you can also once again do this through your level blueprint if you want to automatically load it this way in the um game when you launch it. You can set this dynamically on the fly is going to be your viewport scalability, right? The scalability settings. So, in order to do that, you type in scalability.

**[1:12:11]:** If you just type it in on its own, it will actually just give you a uh hop popup there. So if you go in and type scalability 2 for example, this will change it down to a lower value. I believe this is high, right? So you see when I type that, it changed everything to high. Three should be epic, which is the default setting. Four is cinematic.

**[1:12:36]:** One is probably low. Uh medium. Okay. And if you go down to zero, that's going to be low. Right? So, if I go in here, and I'll just kind of show you what those differences look like. Okay. So, this is the lowest setting. This would be medium. This is high. This is epic. Not much of a difference between um epic and high, but there are some noticeable uh things there. And then cinematic, right? And then going back to uh epic from cinematic, you can see that the uh fog quality, some of the lighting, all stuff definitely looks better in cinematic. So, it's really up to you to figure out what your threshold is for how you want to test this and what maximum level of visual quality you actually want the user to be able to use based on your testing as to okay, I know that, you know, cinematic uh doesn't run well on the absolute highest in hardware, so I'm going to cap it at epic.

**[1:13:30]:** You know, whatever it is, it's really up to you. Or you can have that change when you go into a cut scene. and it'll automatically go to cinematic quality and you can change that in game as well as I mentioned or set it in your um level blueprint to automatically load that way. Uh there is one more nanite uh console command that I didn't go over before which is um

**[1:13:52]:** nanite max pixels per edge. So the default for that is going to be one right

**[1:14:01]:** and I'll kind of show you what this looks like. So, since this is a nanite mesh, this tree, I'm going to go in and set this to uh the default is um one. I'm going to set this to two and I'm going set this to three. Right? Usually values between one and three are going to be recommended. This basically affects the distant detail of nanite assets. Right? So, you can see when I get a little bit closer, it makes these, if you pay attention to this area here, this is the value of three. This is a value of one. So it's basically showing the edge representation of nanite geometry at distance. Um and with finer geometry it's going to be more noticeable. So this is at one and this is at three. Right? So it may be something where you can you know you don't mind reducing the silhouette detail a little bit for nanite geometry especially foliage where it has a lot of small little bits of details where it's going to

**[1:14:49]:** be most noticeable. And that can also give you a performance increase. In my testing, um, I noticed between three and four frame, uh, improvement by swapping it from one to three, but once again, I recommend doing your own testing. One more, uh, console command that I want to go over is max frame rate. So, um, as I mentioned, uh, my frame rate is currently just under 100 frames per second constant in this scene, right? And I'm set to epic quality and all that. The editor itself is obviously going to run uh, much slower than an actual build. So, even though I'm only getting, you know, under 100 frames here, I might get 120, 30, 40, 50 in an actual build. And the editor itself has a lot of other stuff going on and and it sort of frame locks. So, what you can do is type t.mmax fps and set this to a high value.

**[1:15:35]:** By default, it's zero, which means it's uh supposed to be uncapped, but in my experience, it actually does cap it. And you can set this to like a value of 200 or even, let's say, 30, right? And you can do that in game as well. Also, if you want to set your frame cap, you can.

**[1:15:59]:** And then one other one is going to be the screen percentage. So, you start typing in screen percentage. You'll see there is a dot. You want to make sure you find the main screen percentages. There are a lot of them.

**[1:16:23]:** just rscreen percentage and then you can type in a value right so I set this to let's say 25 or uh 100 right whatever it may be it's being overridden right now because I have this manually set here if this was not checked then I could manually set it down here but you can also do this uh once again in um in game as Well,

**[1:16:47]:** and once again, it's really up to you to figure out where your thresholds are for all this stuff. I'm just giving you the information and kind of key points so you have a better understanding of how to utilize Unreal Engine properly and all of its tools, get the most out of it to get the best performance while maintaining your visual quality. But with the things that I've shown you, if you combine all of them, like the uh the dicing rate, using nanite where it's supposed to be used, things like that, you can easily in most use cases probably get 15, 20, 30 frames per second more without really losing any visual quality and just making things a lot more efficient. All right, hopefully you all found this video useful and I will have more videos coming out soon. And if you have any requests specifically, please let me know in the comments.
