Transcript for:
Understanding Lighting in Game Development

What's up guys, in this video I'll be introducing you to lighting and by the end of the video you should have a room which looks something like this. If you're new to my channel and you're just dropping in on this video I'm a game developer currently putting out Unreal Engine 4 and Blender content to help my viewers. If you have any tutorial requests or you see anything on this list of topics that I'm covering that you're interested in it would be so awesome if you drop this up, it really supports me putting out content. If you're just here for some quick knowledge on what I'm covering today, that's also cool. Regardless, I hope you enjoy the video. What's up guys, I'm really sorry but I screwed up. The mesh I gave you in the level design episode. Unfortunately, I made them so long ago and I didn't make them well enough that I was halfway through this video and I realised there was a few things wrong with them in terms of lighting, so we're going to have to scrap them. But what I have done is fixed them, I made a flaw for you guys because I felt so guilty, and I've wrapped it all up in a zip folder so you can download the whole project below. By screwing up though, it does mean I can now teach you about transferring files from one project to another. So go onto your particle system torch that you made, right click it, click asset actions and then migrate. And then migrate it to the new project that I've put in the description details. Please note that you only need to download the new project if you completed my episode on level building before I released this video. So if your meshes look like this, that means I've already updated them. Don't worry about downloading the new file, just... continue with your project. So welcome to episode 5. Today like I said we're doing lighting. What may seem like a very boring topic is actually extremely interesting and awesome. You can turn a really boring looking level like this into a shadowy masterpiece of a dungeon. So stay tuned till the very end we're going to make this look awesome. Sorry for all the messing around at the start but let's finally jump into this video. After you've downloaded the project you should you should have a map which looks something like this. And now for the second time today, I'm going to be describing all the lighting basics and then we're going to jump in and make this level look badass. Lighting number one is the directional light. You'll see it here at the top here and it is basically like the sun. Just like the sun you have outside, it will shine in, casting shadows on anything that is blocking it. And yeah, if you rotate it you can actually change the direction it's coming from. and you will see that the shadows follow it. We then have lights which you drag and drop into your level whenever you need them. So we've got the point light, this is basically just a light shining from a point. Then we have the spotlight which is a light which goes down on the spot. And then we have a rect light which comes down from a kind of square like a ceiling light. And then we have the skylight. The skylight will basically change the tone of your shadows. based on what your sky is looking like but you don't really need to worry about that right now just focus on these three lights and the directional light the Sun okay that's what each light does but what about the settings if you go to the directional light you have intensity which is how bright it is the light color which is obviously the color it gives off and then you can change if it casts shadows or not those are the only real three settings you need to worry about right now almost exactly the same for the point light spotlight and the Rex light Intensity, light colour, the only difference is we have a Tentuation radius, which is basically how far the light will shine. So if we ramp this up, it will shine different amounts of distance depending what we have the radius as. Pretty self-explanatory, let's move on. Okay, so you will probably notice that we've got a roof on our room, but it's still pretty well lit. And that is because of the build lighting function. Like I mentioned in a few videos ago, build lighting is kind of like a refresh of the level. So once you do lots of changes to the lighting, you then need to click build lighting for it to apply. When you add new lights to your level, you will see a change in the lighting without clicking the refresh. But that is basically just like a preview of what you'll get to actually see the final result. You need to click build lighting only. So just remember to do that every so often just so you get an idea of how everything's looking so now we're going to click build lighting only and the room shall darken so when you do that you'll notice our room is dark but it is still lit in certain areas and that is because the meshes are kind of glitching out of it because they're half in the light and half not in the light it means They don't really know how to handle the light. So if we just copy this roof, put a purple on top of it and then expand it over the area. Now if we build the lighting again. As it's all in the shade, it should be all dark. So once you rebuild it with a big roof cover, you should find that your room is completely pitch black. There's a chart that you might get an error about something. something to do with the light mass importance volume. So let me just quickly explain what that is. To find the light mass importance volume, if you just go into place actors and type in light, you can then drag it into your level. So all you really need to know about this volume is that it helps the light calculate its stuff and it will increase the number of bounces the light can do. So don't think about it too much, just put it over all the areas where you've got a lot of intensive light and that will be good enough for now. Okay. Now we're going to start lighting up our dungeon. So, look on the left, grab a point light and grab it, pull it into your level. It's looking a bit grey scale so we're going to go into light colour and give it an orangey-red tinge. And the reason we're doing this is because we're actually going to pair it with a torch and our particle system. So, drag in your particle system, drag in your torch, and then scale and move things around until you're happy with it. Once you're more or less pleased, just grab each component, the light, the particle system, and then move it over to one of the doorways. We're then going to replicate this for all the other doorways to light up the entire room. So I'm going to fast forward this bit, you can light up your room anywhere you want, or you can copy me, whatever you guys fancy. Once you've got them all set around the room you can then lower the intensity to what you guys feel is best. I think 3 or maybe 3.5 is probably as bright. is I'm gonna do it. So you may have noticed that some of these lights have red X's over them and that's because they're overlapping each other. To get rid of this we need to change the mobility. You can either have a static, stationary or movable. Light. Static is where you're not going to do anything to it, it is what it is. Stationary is when it's stationary but you might change the light intensity or the light colour in blueprints and movable is when you might move it around in blueprints. As you probably know, the more things that you put into your level, the harder it is on your PC and the CPU because it needs more power to load everything. The same is true for light. So each one of these settings has a different cost on the CPU. Static is the easiest, stationary a bit harder and movable a bit harder. Obviously sometimes you have to have movable lights but you want to avoid it if possible. So just take into consideration how many lights you're putting into your level and what mobility level they have. So to get rid of this red X we need to change the mobility. What you'd usually do is change it to static. As you can see it's got rid of the X's. But then when you build the level for some reason the lighting isn't building correctly. I'm not sure if this is a bug or what's going on but I've played around with it all day. I've been using it for a long time. I can't seem to figure it out, so for now we're going to put them on movable, but in the future, always put it on static. So it's starting to take shape, I'm just going to light up the start area a little bit more so players aren't spawned into complete darkness. So I'm just going to get one light, copy it across and maybe make it a little bit less orange, a little bit more white, not a lot though. And then I'm just going to move the player start forward a bit. how that looks. So yeah, pretty happy with that so far I think. So the room's looking cool, it's a bit boring though so what we're going to do is add some pillars in the corners of the room. You'll notice that I actually removed the pillar in the middle of the room, I actually did that when I was first recording and then I had to restart everything so instead of putting it in and then just removing it again I decided to remove it. So now we're going to add some pillars in the corners of the room, I'm going to fast forward it, you guys can do what you want as always. But if you want to copy me, that's cool one little shortcut guys I thought I'd mention is that you can actually hide things if they're in your way So if I click on the roof then press H you can hide it So then you can look at things from a different angle instead of deleting Then to show them again just press ctrl and H and then they will respawn for you. When you're finished, click on the build and then build lighting only. Now I'm going to introduce you to one of my favorite things about lighting. the post process volume this is basically like an effect you can put on anything so just think of this thing as a volume where you can apply different effects to your lighting and shadows and colors etc so go into your place actors type in post then drag in your post process volume the first thing we're going to do is go into details type in bound and actually make sure infinite extent is unchecked basically means that the effects will only happen inside the volume it won't affect the entire level. The next thing we're going to do is play around with the shadows a little bit so if you go into your post process type in shadow we can then change the saturation and contrast here so I'm going to put the saturation at 1.1 1.2, 1.1 and then I'm going to put the contrast to 1.1 as well just to get it a little bit more dark. So there's actually loads of things you can do in this. You can add lens flare, you can add bloom. You can increase or decrease the exposure, which makes it brighter or dimmer. But that's what we're going to do in the post-process for now. Let's do some final touches and then finish up. Okay, so in the mix of these pillars, I actually want a kind of blue shadowy. effect so I'm just going to put in a rect light. So put it in, tilt it downwards and then put it in the centre. Then we're going to go onto the light colour and just give it a kind of blue shadowy effect, that will probably be ok. And then we're just going to change the source width and source height so it covers the entire block. Then just turn the intensity down to 4. Uncheck cast shadows. And then just copy it to the rest of the pillars. So we're actually going to have to put these a little bit higher or lower because it doesn't look quite right with this ceiling. I think put them lower or just turn them down to 2, maybe 2.5. Okay, so that's pretty much everything the last thing I'm going to just do is turn down the radius of all these lights and Then I think we're pretty much done So the radius is how far each light reaches as you know 600 I think I'm happy with that. So guys I think that's everything for today. I think the room's looking pretty damn good now. We got the shading right. We got the lights looking cool. So I'm really happy with how it's turned out. Tomorrow we're going to do a little bit of a video on the room. going to be doing blueprints so we're going to open these doors with blueprints all three doors in different ways so stay tuned for that thank you so much for watching thank you so much for the support and I'll see you guys next time