Bake Lighting FASTER with GPU Lightmass - Unreal Engine 4.26

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone it's great to see you again this week's video is going to be about gpu light mass and lighting for interiors now i've already covered everything in this video in last week's live stream but i'm fully aware that not everyone wants to or has the time to sift through a two-hour livestream for the useful bits of information so this is going to be a very bare bones very to the point video on how to set up gpu light mass and how to fix any issues you may or may not have in your scene so with that being said let's jump right in so before we even get started with the fun stuff we need to go through the really boring part and that is ensuring that your project is set up correctly so there's a few things that you really need to be made aware of here things that you absolutely need to get gpu light master work and that is as of 4.26 you need an rtx capable graphics card next up you need to enable ray tracing in your project settings and third you need to enable virtual texturing as well now if that all sounds real scary don't worry i've included a link to the official epic documentation in the description below so go ahead and read through that there's an enabling gpu light mask section and they will guide you through the process of enabling ray tracing and virtual texturing okay so just to be clear if you don't have a graphics card that supports ray tracing you won't be able to use gpu light mask as a 4.26 so if you're not sure how to enable virtual texturing and that sort of thing we can go to the edit tab up top you're going to go to project settings and then you're going to click type virtual and down below you'll see virtual textures enable virtual texture support and enable virtual texture light maps okay very important that you enable this ad for ray tracing there's lots of documentation on a big website on how to enable ray tray thing there's a few steps but i'm going to assume that you already have raytracing enabled in your project because you need raytracing for this to work anyway so once you've enabled your ray tracing in your project you've enabled virtual texturing there's still one more thing you need to do and that's enabling the gpu light mask plugin so in order to do that we need to go to the settings bar up top click on that plugins and in the search bar we need to type gpu and make sure the gpu light mass up here is enabled once you click that you've restarted your engine you'll be ready to go so in the past baked lighting had always been a little bit scary uh it's been tedious there's lots of things that can go wrong don't worry i'm here to start this whole thing from scratch and hold your hand all the way to a result that looks pretty good so the first thing i like to do when it's creating a new blank scene is adding a new pro process volume this should always be your first step so we're going to go ahead and drag and post process volume in here so we're going to select our post process volume and in the details panel we're going to search for unbound and make sure that infinite extent unbound is checked the second thing we want to do is turn off auto exposure so we're going to type exp and right here in the exposure settings min and max we're going to set these both to 1. this effectively disables auto exposure because it's just the worst so once that's done we can go ahead and x this out and there's still one more thing we need to do before we get started epic recommends that we disable ray tracing effects in our viewport entirely when using base lighting so i know this is a bit confusing because they say that you need to enable ray tracing in your project but you need to disable the ray tracing effects in your viewport and we can disable all the ray tracing effects with the help of a simple console command okay so let's open the console command menu using tiltkey or whatever shortcut you have it bound to if you don't know how to open a console command menu you can go to window go to developer tools and open the output log the console command will appear at the bottom here okay so we're going to go ahead and type r dot ray tracing dot force all ray tracing effects zero make sure that you set it to zero this effectively disables all razor and effects in your scene again this is not my opinion this is coming from the source so once that's done now we're ready to start working on our scene so i'm going to go ahead and place a directional light so go to the lights tab up here directional light i'm going to rotate it and you'll see i already have a kind of boxy room in here right you'll see that we have a very simple room i got these shapes these meshes from the unreal starter content okay so you have you can see at the bottom here i have done like door frames and stuff and windows and just flat walls and ceilings the reason i'm using this is because it's a very simple geo it kind of gets the point across and they're already lightmap uv'd and now we're let's uh position our light so i can see it better and i want this light to kind of shine through the window and hit the wall so we get some nice big bounce light bouncing through the room like this so the reason why i'm using a small boxy boring unsexy scene like this instead of a really nice flashed out archviz apartment scene or something is because with a simple scene it's easier to iterate and really see what the difference in your settings is doing when you've got a nice big clean surface even more a it's going to bake faster b you're going to be able to see what each setting does much more clearly so because it's the tutorial a crash course i really wanted to eliminate all the crap and all the noisiness of having a bunch of objects in the scene i wanted to show you how gpu light match works in its simplest form so next up select your directional light and make sure that it is set to stationary right here don't set it to movable movable means it is completely dynamic and it won't bake anything so make sure it sets a static or stationary i'm going to leave it at stationary for now so now we're ready to go ahead and open our gpu light mask window so in order to find out you go to the build button up here click on the little arrow next to it and open gpu light mask you'll have a gpu light math window pop up here and by default the default settings are actually pretty good the only thing that i recommend you enabling is user radiance caching here and use first bounce ray guiding to turn these things on and to be honest we can just hit build lighting because the results from the get-go are pretty good so let's hit build lighting and see what that gets us you'll see slow mode shows up at the bottom hit control r to go into quote-unquote fast mode now you'll see uh we have something uh it's not great it's very splotchy and kind of not sharp and kind of smudgy that is because of our light map resolution so we need to increase that but before we get into it it is critically important to understand what lightmap uvs are okay so i'm going to select this wall here and i'm going to open double click and open up the static mesh editor right here so here i have my static mesh of my wall segment was the window and if we click on a uv button up here you'll see there's uv channel 0 and uv channel 1. when you come to baking lights you absolutely need to have two uv channels so channel 0 up here you'll see that's for your texturing those are the uv that you use for texturing your model uv channel 1 let's click this here these are the uvs that are used for the light baking so light maps are going to be baked on your second uv channel there's no way around this and so it is imperative it is critical that every single model in your scene has light map uvs a second uv channel for light maps it is also critically important to know that not a single uv shell can overlap it is super important that they don't overlap so it's fine if your zero one uv space is not as super efficiently packed it's more important that the uv shells don't overlap because then you're going to get really weird shadowing artifacts it's going to look all wrong every single uv shell needs to be unique okay so if you don't know how to set up lightmap uvs there's lots of documentation on this there's lots of videos on youtube on how to do this i don't have one myself yet but just so you know it's really important that your models have two uv channels okay and you can if you go scroll down here if you go to the build settings you'll see destination light map index right here okay it says one which means that the lightmap uv will be baked to uv channel one so if you're noticing that you do have u2 uv channels which they should show up here but your lighting still doesn't bake correctly make sure your destination light map index here is not set to the wrong uv channel pro tip so now that we've kind of covered light map uvs let's continue so in order to fix this kind of bad result we're going to select all our shapes here select all your wall segments and again once more in the details panel we're going to go ahead and search for res and you'll see overwritten light map res okay i'm going to set this to for this you know to get a nice clean result i'm going to set it to 1024. so once that's done we're going to have to go ahead and bake one more time so i'm going to go ahead and build lighting again slow mode shows up and it's going to take i'm going to hit control r to go into fast mode and you'll see it already takes way longer to bake and the reason for that is because of the light map resolution the larger the light map resolution the longer it's going to take to bake but the better your results will be and now moving this out of the way and now you'll see hey we're getting a much better result here right now we got our light hitting the ground the shadows are not splotchy and misshapen we're getting some bounce light but you'll see it things are still looking a little bit odd it's a little bit dark so what do we do i'm going to go ahead and increase the brightness of our directional light because by default it's only set to 10 lux and i don't think it's bright enough so i'm going to set this to 75. 75 is just an arbitrary number you can use the value that you feel is right so again i'm going to go bring this here and i'm going to hit build lighting one more time i'm going to cut this video so that you don't need to wait this whole duration just so you know see if you notice you can't seem to control r to escape slow mode down here you need to go to the little arrow here and click on disable real time override that should turn off the real-time mode and your build lighting will go back to full speed so to speak i'm not sure why this happened sometimes it's probably a shortcut that i'm unaware of but just so you know and now wow we have a much brighter room we got a lot more bounce coming in here but we still have some uh some weird things you'll notice like these edges seem very uh dark and that's because of ambient occlusion okay so by default ambient occlusion is turned on so we're going to select our post process volume and in the details panel we're going to search for ambient occlusion and you'll see let's set the intensity to zero when i'm baking light i usually turn off ambient occlusion and you'll see already we're looking getting a result that's a little bit better um by default is this and i don't i don't like how strong it is by default so i'm going to turn it off entirely so now we're getting some pretty a much much better result this is a very bright room now let's say for example i don't want to be that bright fortunately all indirect lighting is non-destructive so again in the post process volume we can search for indirect and we can control the intensity of it besides zero it turns off all under bait and direct lighting and i can accentuate like crazy too so i'm gonna leave it at let's say 0.5 or something you can set it to whatever you want you have full creative freedom here i just wanted to show you that indirect lighting is non-destructive you don't need to re-bake every single time now one thing you may notice is let's let's zoom in real close here and notice how this wall is very splotchy and not smooth we're not getting any smooth gradients here right uh this is no good especially right here where there's like nice soft bounce light the gradients are really harsh and aggressive and why is that that's because of light map compression and fortunately there's a way to turn this off so in order to do that we're going to go to window up here and we're going to open world settings and that should open up the world settings window here and what you need to do is in the light mass setting where it says compress light maps we're going to uncheck this okay so move this out of the way and we're going to go ahead and bake the lighting one more time and you'll see all the splotchiness you know right here is all going to be gone you're going to get a perfectly smooth gradient now one thing to keep in mind is when you uncheck compressed light maps it's going to reduce your artifact but it's going to increase the memory at this size by four times so if you're running low on memory you may want to keep this enabled but if you have the memory to spare man turn that off because let's take a look at how this looks now all the splotchiness is gone we get the much much smoother much better results much cleaner results and that's really the gist of it now how does this work with skylight what if i want hdri and that's shining through our window here what's the next thing we can do so in order to add a skylight or light outside of your scene we're going to go ahead and create an hdri backdrop okay so i find it right here in lights if you don't see hdri backdrop in your life you need to go ahead and enable the plug-in for it okay so i'm going to drag this into here i'm going to lower this like that and i'm going to leave it like that for now there's a few things you really need to be made aware of when using the hdri backdrop when baking specifically so what we're going to do is we're going to click on the hdr backdrop and in the details panel you'll see the skylight in the ad components section here okay you're going to want to make sure it's set to static i had issues getting it to work in stationary so for the sake of this video i'm going to leave it at static because i know it works next up in the source type i'm going to set this to sls specified cube map and set it to make sure it uses the same hdri as the backdrop itself so right now this is using approaching storm 4k this one will also use approaching storm 4k and now we should be ready to bake so we're just going to hit the build lighting button and just like that now we have base lighting that actually looks pretty good now just to demonstrate i'm going to go ahead and hide my directional light right here i'm going to click on it and uncheck effects world and i'm going to bake only my skylight i'm going to increase the brightness of my skylight here so the 5 maybe even 10. now before i bake however i want to show you guys one nifty little feature so she noticed in your gpu light math window we're going to see mode we have full bake if you click on it you'll see bake what you see as well now what this does is it it does what the name implies it's only going to bake with the camera seeing so let's demonstrate right here by clicking build lighting now did you notice how fast that baked what i've got to do now is i'm going to hit the save button all the way down here very important to hit save and i'm going to hit the stop button next now you'll see now it's been denoised but you'll notice how it it didn't bake anything else it only baked the area that we were looking at right so that's what bakewich you see does it's a super handy feature for really speeding up your lighting process especially when you don't want to have to bake your entire level if you want to you have the option to only bake what you're looking at super useful pro tip so but for now i just wanted to show you guys how that worked i'm going to set this back to full bake and build the lighting one more time and now we can see now we got a much better looking result now the interior lighting is a little bit dark and that's just because of my post process volume i need to set my indirect lighting back to something at one or maybe even two just to bump that up a little bit and just like that this gives me the result that i expected so now that we have our you know our skylight casting proper light on our scene the last thing we want to do is we're going to enable our directional light again and we're going to bake one last time and now we have our scene looking the way we expect we got some nice blue bounce light coming in from the sky and everything looked about the way that you would expect it to again if you go to the post-process volume you type indirect and we can totally art direct the brightness or the intensity of our indirect lighting as the way that you want to and now it's time for this week's bonus tip this is something that you should very much be aware of and that has to do with the brightness of your materials and how that contributes to the lighting of your scene okay so right now i have a material on my walls that has a brightness of 0.7 okay so you can see here it says a 0.7 in value it's just a flat constant color that's the brightness of my wall right now and here's what i'm going to do i'm going to i'm going to darken this color to something like 0.2 or 0.3 which is still not very dark but you'll see how drastically it affects the bounce lighting in your scene and it's really and you may actually get some artifacts that your materials are too dark so let's go ahead and i'm going to change this to let's say 0.2 and you'll see looking at 0.2 is not that dark right it's still a reasonable brightness and what i'm going to do now is i'm going to go go ahead and build lighting and that's the the color of the material is the only thing i've changed here okay just so you know let's build and we're going to notice that we're going to start running into some artifacts things that don't look very good shadows that look a little bit sploshy now now that our bake is done let's move this window out of the way now you'll notice oh ho everything's way too dark right now well that's not a problem right we can go ahead and change the inner process volume change the indirect lighting intensity to some you know revert it back to one well one doesn't really do much two three five ten and you'll see things just don't look nearly as good anymore right let's pay attention to corners it shouldn't be that black in there it should not be that dark so here's the thing when your materials are a little bit too dark this can actually negatively affect the quality of your lighting so sometimes if you're getting some weird shadows and stuff so what i recommend you to do is bump up the brightness of your of your materials a little bit bake and then reroute after you've baked you can bring the material coloring your material back down to a darker level so here let me demonstrate so now we can clearly see these shadows do not look good we're getting these really nasty lines here this does not look good at all especially in this corner this looks terrible so i'm going to go ahead i'm going to revert this material i'm going to revert this back to 0.7 to what it was before let's move it out of the way and you'll see brightening it up helped a little bit but we still get the the shadows just don't look as good as they did before so i'm going to go ahead and bake one more time again the only thing i've changed here is the color of our material so now of course after it's baked with the brighter material everything's way too bright let's bring this back the indirect lighting intensity back to one yeah even maybe even 0.5 and you'll see now our shadows are much are looking much better we're not getting these really nasty pitch black areas anymore but i still want to have my darker material but now that it's baked i can go ahead and change the color to this material without a problem so i'm going to bring this back down to point two and maybe bump up this indirect lighting a little bit more and voila now we have the darker material that we wanted but a much better quality bake than we had okay so just keep that in mind and that concludes the gpu mask crash course leave a comment down below if this helps you out or if you have any questions or you know if maybe you have some better alternatives better solutions to some of the issues that we noticed here in the video so i look forward to hearing from you and i'll see you guys next week
Info
Channel: William Faucher
Views: 114,301
Rating: undefined out of 5
Keywords: UE4, Unreal Engine 4, Unreal Engine, Cinematics, 4.26, UE4 4.26, UE5, Realtime, realtime rendering, rendering, CGI, 3D, 3D Artist, GPU Lightmass, lightmass, baked lighting, bake lights, gpu, interior lighting, interiors, lighting, HDRI, archviz
Id: hq1WFFF6iD0
Channel Id: undefined
Length: 21min 23sec (1283 seconds)
Published: Tue Mar 30 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.