How to Make Unreal Engine 4 Render Lighting Faster! - UE4 GPU Lightmass Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
if you use unreal engine this has probably happened to you you finally finish your environment everything is looking nice and you think it's time now to get some global illumination so you check your settings and you press build so we just got back an hour later and you see that you messed up maybe the light maps are off or you want to add some new objects so you just make your changes you press build and then you have to wait another hour this process i just showed you you will repeat multiple times so you bake and wait bake and wait and next you know half your day is gone because of how slow the bakes are well what if i tell you there's a way to make your bakes a hundred times faster so your bakes will go from taking about two hours for a high quality build all the way down to just one minute and this is all thanks to the gpu light mask which is taking our banks which was originally on the cpu onto the gpu which is a lot faster depending on your computer so in this tutorial we will go over how you can set up a gpu light mass now real quickly just in case if you don't know what baking is it's when unreal computes global illumination essentially what global illumination is it's when light bounces around and illuminates dark areas to better show what i mean here is a scene without global illumination and here's a scene after a bake which gives us a global illumination so obviously this scene looks a lot better it can be the difference between a good looking environment and a bad looking environment if you're confused of what light mass or global illumination is then i highly recommend you check out one of my unreal engine beginner tutorials there we go over in more depth light mass and the different settings and just lighting in general now it's important to note that as of january 2021 ray tracing and the gpu light mask only works on windows and nvidia cards specifically rtx and some layer generation gtx cards now i know unreal ray tracing is going to be coming to amd and max in the future so if you're in the future maybe this tutorial will work for you you should go and check that out so with all of this established let's jump into the tutorial okay so for the purpose of this tutorial i made this really small room as we can see it's just a basic architectural visualization room we have one window with some lights that are spraying into it and then we have some spotlights a sun that'll give us some nice lights right here and a lamp with a light in it and that's about it that's the lighting it's pretty simple if we scroll out here we can see that it's just a box now if you want this scene it's basically just a modified version of the arc viz interior so you get down the arc bus interior from learn and right here it's basically just a really good demonstration of unreal engines ray tracing capabilities now to activate gpu light maps we need to go into settings plugins and find it so let's just go gpu and click enable but do not click on restart since we need to also activate ray tracing since gpu litemas uses ray tracing so we're going to go back here to project settings and within product settings we need to go all the way down to platforms windows and change default rhi to directx 12. now we're going to go into rendering right here engine rendering and we're going to scroll down and this is optional but i like to click it if we want to see some progress bars and you'll see what i mean in a bit but i like to enable virtual texture support and scroll all the way down let's go ray tracing right here so now that all three of those have been activated we're going to click on restart now okay so now that the engine has restarted and all the shaders have compiled we notice that our frame rate immediately takes a massive dip and that's because unreal activated a bunch of ray tracing features automatically when we enabled ray tracing so let's go and turn off these ray tracing features real quickly eventually i'll make a video that goes over them but we don't need them for now so we need to find our post process volume and under ray trace global illumination we change final gather back to disabled reflections screen space and ambient occlusion ray tracing occlusion we could turn off okay so now we're back to where we were and our frame rates back so now that everything's here we have a new window right here if we click on it gpu light mass if you don't see this window you can activate it by going under build a little triangle and clicking on gpu light mass here is our gpu light mask to start all you have to click is build lighting so immediately we'll see that we get these really cool progress bars on each of these meshes we're able to see the progress of the lighting in real time which is just crazy cool so we just sit here and it's oddly satisfying just watching all the rays hit these objects and the texture is compiling one thing will notice that it says it's in slow mode right now so if we want it to be fast although this won't be as nice looking we can hold down control and r which will turn off real time and turn off just some of unreal's rendering features which will make the ray tracing a lot faster also if for some reason control r isn't working you can go down here to this little top left arrow and there should be a button that says to activate real time so just click that okay i just skipped ahead 30 seconds and this is the bake we get it took one minute and we already have a bake that would probably take an hour to two hours if we were picking on the cpu and this is the power of gpus especially modern gpus like the rtx cards which are specifically made for ray tracing which is what we are doing right now now let's go over some of the differences between the gpu light mask and the cpu light mask that you need to know number one is that under world settings all of our traditional light mass settings are specifically just for the cpu so this will not affect our gpu bake if you want to affect the gpu big you can play with the settings right here which we will go over in just a bit and number two if we go into our light map resolutions we'll see that the entire room is pretty red that's because with gpu bakes we want it to kind of be in the red zone or in between the yellow and red while in traditional bakes just leaving it at the green zone or the green yellow zone would be okay so just try to keep your light map resolutions pretty high okay so just for example's sake and to demonstrate my favorite feature besides the obvious speed benefit of the gpu light mask is let's say with this couch this light map res is 64 or even something lower like 12. and then we start to build lighting you know we watch the progress bars rise up we watch all the lights ray tracing everywhere and then we notice that this specific mesh is really low the light map is way too low or maybe there's just some other issue or you didn't like something else well instead of stopping the build and having to wait all over again for this progress to go up we can just click on that mesh and in real time change the light map resolution so we could change it from 12 to let's say back to 512 and it will start calcula recalculating only that object and the objects that surround it so if we have a really large scene this could be a huge time saver and we don't have to stop the gpu light mass every time we notice an issue likewise we can even move objects around and it will do the same thing and that will recalculate only the objects that are near it so this is just insanely cool and this is a huge time saver where we can even work in our environment while our light mass is baking and we couldn't do this beforehand okay so now it's finally on to what all these settings here mean so i'm gonna go pretty fast because these settings are bound to change in the future so first off we have the show progress bars this is obvious is whether or not we want to see those bars when we're baking but right below this we have another great feature which is full bake which is set by default to bake what you see now this is only going to bake the areas that our camera is looking at so it's great if you want to preview a specific location without having to bake the rest of the scene so i'm going to set the noise to during interactive preview and now for example let's say i just want to bake this small corner right here with the pot and see how that will look so i'm going to click on build lighting and it is only rendering this screen right here so this should take about 10 seconds and yeah so this is what the final scene will look like in this specific location and the rest of the scene was not rendered which is really cool so i'm going to stop and below that we have a gi sample so basically the amount of rays we want to use and right next to that we have stationary light shadow samples basically these are really self-explanatory if you want you can just raise them up to get better bakes now i've noticed that just leaving them as is is pretty good because of the denoiser which is really accurate but if you really want to get that high fidelity base then you can increase this as much as you want of course the payoff would be that if you would have a longer bake time by this point might as well just wait an extra 10 minutes if you're gonna do a final render and finally at the very bottom we have system which is where we can allegedly speed up our big times although i've played around with it and i haven't really noticed any difference so far so i hope you enjoyed the tutorial and you got something out of it if you want you can check out my other videos and it's just really good to finally get gpu-like mass officially on unreal engine a lot of us unreal users have been using it for some years now but it was an unofficial implementation and to see how smart epic games is they hired the person who made an unofficial gpu light mass and now he coded this gpu light mass so they bring in all the best in the community and they bring them into the epic games unreal engine and that's why i'm so excited for another five stay tuned for a video on that later goodbye
Info
Channel: Unreal Sensei
Views: 47,918
Rating: undefined out of 5
Keywords: ue4, lighting, fast, speed, unreal, engine, lightmass, 100x, ue5, architecture, rendering, 3d
Id: H3PEVnRGA4s
Channel Id: undefined
Length: 12min 2sec (722 seconds)
Published: Fri Jan 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.