Intro to Dynamic Lights in Unreal Engine [UE5]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello and welcome back to another prismatica Dev video today we're going to be talking about lighting uh we're going to be going over Dynamic lighting today so we're not going to be covering static lighting and we're also not going to be covering Lumen today we're going to do that in a follow-up video but all of this is applicable to both you know standard traditional rendery lighting stuff and the new Unreal Engine 5 Lumen you know hype whatever so first thing we're going to do we're just going to jump straight in to our scene let's imagine we are just starting a new scene what we need to do is find in the the place actors tab we're going to look for lights first thing to start with is a directional light so we drag this into the scene this is this is basically the sun of your scene it's like an orthographic projected light source so it's infinitely far away so a little cool tip that I found out by myself if you hold Ctrl L then you get this little widget and you can actually just move your light around without having to select it so this will be the the directional light that you can control now first thing that you'll notice is that the Shadows are infinitely dark they are they are completely pitch black and the way we're going to rectify this is with a skylight now what I usually start with with the Skylight is changing the source type to specified Tube map and this is kind of assuming that you know you might be going for like a stylized style or whatever and then in the cube map slot we want to just make sure that you click this button and go show engine content and then you'll be able to find the light gray texture Cube and this is just a really neutral you know color for your Skylight and you can also set the qmap resolution to like eight as low as it possibly goes and now you can see that we've done that the Shadows have a bit of a bit of fill behind them it's kind of simulating like bounce lighting so this is the most basic lighting setup that you can achieve in Unreal Engine so thanks for watching and with that we say no I'm just kidding and before we go any further it's worth noting that this video is very technical Centric we're really just going to be going into how the lights function on a technical level and how to make sure that they're impacting performance as little as possible so if you are looking to learn about lighting techniques then check out the sponsor of today's video skillshare skillshare is your One Stop Shop learning absolutely any skill that you'll ever need skillshare hosts tens of thousands of super high quality videos including videos from industry Professionals for example if you did want to learn about lighting you might want to check out cinematography Basics introduction to lighting techniques by Zach Mulligan who is the director of we the animals and in his video he goes over Direction shape color intensity quality texture movement the whole shebang and what all of them mean in Context of conveying something through a visual media so don't delay get your free one month trial of skillshare in the description below thank you once again to skillshare sponsoring today's video okay so now we're gonna have a little a little Gander through these two lights and what they're you know what their settings are what they do how we can you know be more performant with our lighting setups and all that kind of stuff and these are both going to be set to movable which means they are fully Dynamic we can move them at run time um there's no like baking Shadow maps and all that kind of stuff movable is the most costly lighting method but it's also the most flexible especially if you're making games with big open scenes and that kind of stuff because baking lighting for an entire kind of big open world is a bad idea so we are going to start with the Skylight so I'm going to actually disable the directional light and we're gonna go effects World turned off and we're gonna go back to our skylight and you can see that the Skylight is just the the bounce light right it's uh it just it lights everything evenly uh without any directionality okay so Skylight settings we already looked at the the cube map um that kind of stuff isn't super relevant now the most obvious one is the intensity scale this is literally just the brightness of this light you know how how bright is it um obviously this is just again you do it to taste there's no right or wrong number just until it looks good then we've got the light color which is a tint so this will be the intensity multiplied by whatever the color is this is useful if you want to do something like you know simulate night time then this could be a good way to do it without completely you know darkening the entire scene this is how games like breath of the Wild and the engine impact do their night times the next option we have is effects World which basically just turns it on and off now the next setting on the Skylight is the cast Shadows button what I'm gonna do right now is actually disable my screen space ambient occlusion uh we're gonna get ambient inclusion we're going to turn that to zero so this is only the Skylight Shadows now and you can see if we have this turned off uh everything looks super duper flat so what this casts Shadows is actually doing when it's set to movable is it is using distance fields to generate ambient occlusion so if we go to show visualize um mesh distance fields we can also go to show hold on I can do this Global distance field I think it uses a mixture of both basically a way of the GPU knowing how close something is to something else um without the cpu's knowledge basically and so if we look here for example the Skylight knows okay this is close to this and it's basically just gonna say hey you know make it darker now there are settings for this uh down a little further distance field ambient occlusion also known as dfao and in here you can actually adjust what are the you know the the distances that we kind of allow this effect to take place uh do we want it to like be contrasty what's the occlusion exponent basically the strength of it this goes for a lot of settings usually if if you like move your mouse around we can like you know choose the occlusion contrast blah blah blah all of these values can actually go above one and then there's the Min occlusion it's kind of just like a like the alpha of the the occlusion so this will like turn it down without changing the the shape of it the other cool thing you can do is you can change the tint of the occlusion maybe you want your shadows to be like a tiny bit Bluer just for the fun of it you know without using Color grading usually you want to keep this at black so then you can do your you know color grading post processing afterwards and then there is this setting here the occlusion combine mode so if you are also using screen space ambient occlusion which I'm going to turn back on this setting will just detail how do they get combined so is it just going to take you know the one that is darker and use it for each pixel or is it going to combine them together to make like a giga occlusion kind of dealio all right so going further down our Skylight settings we have a bunch of stuff to do with atmosphere and Cloud we're not going to look at that you know what that's it that's our Skylight now one detail is you may want to actually use a capture in that case we would go Source type capture scene it is getting anything from the actual sky and generating a uh what's it called a queue map from it and you can actually tell that is the case by the fact that this has like Lighting on one side and not the other even though we're using a skylight not a directional light then you can see that these are Bluer on this side and redder on this side and that's again because we're using the the captured scene rather than a specified Cube map now again this completely depends on your project I prefer just a gray neutral Skylight uh Cube map because I'm using you know a cell Shader you know I want everything to be just like really evenly lit so moving on to the directional light now if you remember this is like our our sun this is like the direct sunlight or Moonlight or a lightning flash we are gonna re-enable this let's just do what we did with the Skylight and we're just going to go through these settings bit by bit uh obviously first is the intensity this is pretty self-explanatory it's it's the intensity of the light we've got the light color again it's just uh you know multiply the intensity by the color that we've specified so here we've got the source angle and the source soft angle we are just going to ignore them they're not very relevant um use temperature is an interesting one so if you want to use realistic you know color temperature so you know you've got like your orange to your your blue and then white is in the middle this is really handy if you come from you know a cinematography background and you know all about lighting you know white balance and that kind of stuff and this is different than just saying okay this is orange and then lurping it towards White there is like some subtlety you know in the middle it might go from a kind of more yellowy orange and then like a full orange slash red at you know at zero now as with the Skylight we've got the effects world again that just turns it on and off we've got cast Shadows this just again disables Shadows being cast this doesn't stop the pixel lighting at all so if we compare not casting Shadows to not being on at all this is basically what happens this is how it would look at like minimum settings when you disable you know you put lighting at lowest quality in other games and it's like it looks like [ __ ] it looks kind of uncanny it looks like these things aren't existing in the world rendering settings we don't care about light Mass we also don't care about as we're using a dynamic movable uh directional light light shaft this is an interesting one so this light shaft settings um if we go light shaft bloom then you can get these these are like a screen space um effect this isn't like actual volumetric uh lighting it just kind of looks like it um there we go and this is based on just like screen space Bloom effects based on the direction of the the light source this is this is a nice effect there's no reason kind of not to do this but keep in mind as soon as we're not looking directly in to you know where the directional light would be the effect disappears so again it isn't volumetric lighting now next is a very important one and this is the cascaded shadow maps not to be confused with Cascade particles some people seem to get confused when you say Cascade Shadows and they're like oh no I use Niagara it's like no that's not what I was talking about so let's just clear that up straight away these settings here these are like the make or break settings so let's actually go through them and we'll figure out what the the best settings for your project are so the Cascade Shadow maps are done in real time uh basically what it's doing is it's doing like a depth capture from wherever the the directional light would be anything that is like visible gets gets lit uh anything that isn't gets shadowed shadowed and so basically we're rendering the scene two times from two different directions which means we have to set up a scene for rendering twice a lot of rendering cost just comes from setting up the scene to be you know to be rendered so that's that's like the the base cost of running a cascaded you know dynamic Shadows but what we can do is make it cheaper so if we doodle with this setting the dynamic Shadow distance movable light this will actually cut off Shadows closer or further from our camera and so again this can kind of look a bit weird let's say we have it set to 4000 for now you can see that like when we zoom out the Shadows disappear but then you can also reduce the cost by decreasing the number of dynamic Shadow Cascades this is a big performance saver so the lower this number can be whilst also you know looking good that's like that's like the goal that's the the Holy Grail so as we turn this down you'll actually see that our shadows get blurrier and blurrier until they are completely gone but one other thing you'll notice is that if we decrease the shadow distance then the Shadows get sharper even with you know one or two Cascades think of it like a like a texture right if we get this same resolution of texture and we make it cover a smaller area then it appears to be sharper so that's kind of what's going on here with the with the Cascades so this is this is really handy information to to know especially once we get into this lower bit here that the distance field Shadows so we've kind of explained The Balancing Act of Shadow quality which is distance render distance and sharpness or number of Cascades um extra settings that you will find useful are the distribution exponent this is basically just saying where do we want to focus the quality of the Shadows so as we take this closer down to one these ones get blurrier in the foreground but the ones in the background get sharper So Soft in the background sharper in the background but softer here so again that's just something that you will need to Doodle around with um it depends on what your you know priority is now the transition fraction is kind of the same thing it's more so if you've got multiple like many Cascades going um you can actually see an example of it right here one of the you know Cascades is right here in one of them's focused here and this basically just kind of blurs between them there is a cost associated with it so the lower this can go whilst looking good the better so again that's just another one to Doodle around with you'll be able to see what it does to your scene so next in the advanced settings we have the far Shadow Cascade count so you can see here I have a big stick that is casting a shadow and what a what a far Shadow is is a shadow that will persist after the regular Cascades have faded out so you can see here we're getting the shadow it's all good but as we move further away depending on our Cascade Shadow distance it will disappear however if we click on this mesh and we go bar shadow and have it ticked then when we go into our directional light and we go to our far Shadow Cascade count uh this will actually persist outside of the the regular SK Shadows so this is really handy for things like Landscapes and like mountains and that kind of stuff where you still want them to cast Shadows even if they're out of your you know your Shadow render distance um and there's also a a distance here that if we keep going out let's just say this was like 20 000 um eventually this would yeah disappear um and again this also you know the bigger this number is the the blurrier it will get again if you don't need the Shadows to be hundreds of thousands of units away um then you might only need one bar shadow Cascade count now keep in mind this is also another pass like another render pass but it's only going to be rendering things that have the far Shadow text which is different from the next thing that we're going to be talking about which is the distance field Shadows the distance field Shadow distance so let's just go to our Dynamic Shadow distance and we're gonna just put it at like 2000 for now um so you can see it is fading out pretty quickly but if we had distance Fields enabled on our trees effect distance for your lighting then you can see when we when we move out of range there are still some Shadows there now keep in mind that these Shadows are not moving these are like a kind of like a baked Shadow which just is from the the distance field that got generated or the mesh this is really handy if you want to lower your Cascade Shadow length distance and you also want to have you know kind of High Fidelity shadows and stuff because distance field Shadows are hella cheaper than like actual Cascades now while they are less expensive they aren't free so you may want to again cull them at a certain distance now if we go back to one of the earlier settings which is the transition fraction uh you can see here you know there's a very obvious point where the distance field Shadows taking over um if we put the transition fraction up then this will be kind of like a smoother Fade Out it's kind of less noticeable um especially you know if you are closer to the ground um you're not really going to notice the the transition you can also just disable distance field Shadows all together which I wouldn't recommend doing you kind of need shadows and then there are also the distance field Trace distance which is actually like the how far away something can be for it to cast a shadow so if this is yeah you can see here it's only casting from the bottom of the mesh so put it here and again the lower this number is then the cheaper the cost will be so by default it's ten thousand uh units you can probably get away with something as low as like three thousand again depending on kind of how big like if we wanted this to cast distance field Shadows you know we'd need a big number but again this is something that I would use the the far Shadow Plus for and and not rely on the distance fields and the last little setting here is the the race start off depth offset depth scale which basically just prevents self-shadowing um from these cast distance field Shadows so that's all of the settings that we're going to talk about in the directional light we've got these atmosphere and Cloud stuff we're not going to worry about them performance these don't really do anything we're not going to worry about them light function we will talk about in another video which just search up prismatica Dev light function and that is it for our Deep dive into the settings of the Skylight and the directional light so the takeaways are less Cascades equals better less distance equals better looking Cascades distance field Shadows are good uh they're more performant than a Cascade Shadow map our shadows are like a separate Shadow pass only for specific objects if you you know if you need it and then with the Skylight the Skylight is kind of like your your fill light um you can use distance field ambient occlusion which can you know kind of combine with screen space I mean occlusion and you get some nice kind of soft shadows and that kind of thing I hope that this kind of clarified a few things and hopefully you'll be able to save some juice once again thank you very much for watching if you do need help check out our Discord in the uh and if you do want to support monetarily you can do so for as little as one dollar per month through the patreon which is also linked in the the so with that We Say Goodbye bye [Music] foreign [Music]
Info
Channel: PrismaticaDev
Views: 16,907
Rating: undefined out of 5
Keywords: unreal engine lighting, unreal engine dynamic lighting, unreal engine 5 dynamic lighting, unreal engine day night cycle, unreal engine lighting needs to be rebuilt, unreal engine lighting interior, unreal engine, ue5, ue4, 5 minute materials, unreal engine sunset, unreal engine sunrise, unreal engine shadows, unreal engine distance field shadows, unreal engine 5 distance field shadows, unreal engine cascaded shadow maps, unreal beginner tutorial, unreal engine beginner guide
Id: IHboBOBMXKs
Channel Id: undefined
Length: 23min 34sec (1414 seconds)
Published: Sat Feb 25 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.