5 Minute 2D Lighting in Unity Tutorial 2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this five minute video you'll learn how to take your scene from this to this so when you're creating a new project in unity hub you can either choose a 2d project or you could choose the universal render pipeline which will pre-install a bunch of packages we're going to need but we'll assume that you just chose the regular 2d project and you've already started it so once you have your project open i just have this scene set up here we want to go up to window package manager and in the package manager we want to search for the universal render pipeline or universal rp so we can just select this and hit install it's going to take a minute but once it's done down in our assets folder we can now right click and go to create rendering universal render pipeline and create a pipeline asset you can name this whatever you want i'm just going to leave it as default we now want to create a 2d renderer so once again in our assets folder we right-click go to create rendering and by the way this rendering tab wouldn't show up unless you installed the universal render pipeline and then we just want to select 2d renderer again i'm just going to leave it as default you can name it whatever we can click on our universal render pipeline asset and we can drag in our new 2d renderer data into the renderer list and we should now have our pipeline asset ready to use in our project so we can go to edit project settings we'll go to graphics and you'll see right at the top we have this empty slot for a render pipeline asset so we can drag in our universal render pipeline asset and it should be ready to go so at this point you'll notice we're using now a 2d render pipeline but nothing's really changed our sprites still look the same nothing is visually different we actually have to upgrade our existing project if we already have a scene created like this to use the new 2d materials that will have our sprites react to lighting and to do that it's pretty simple you can go back up to the edit tab and go down to render pipeline which is now visible and go to universal render pipeline 2d renderer and we want to select upgrade scene to 2d renderer now it is worth noting that this is a one-way process so once you convert all your sprites to use the new 2d pipeline you can't go back so definitely make a copy of your project now if you're worried about this but we'll go ahead and do it because i'm not worried and we'll proceed and once it's finished you'll notice everything has been turned to black this is a good sign even though it looks terrifying you may think you just broke your project but this is exactly what it's supposed to do so if you wanted your project to go back to looking how it just was the simplest way is to right-click in your hierarchy and go down to light 2d global light 2d and you'll see that everything's back to how it looked before and like the name suggests this is global right so it impacts everything in your scene so if you wanted to this is a quick way to set it to like .5 and add like an overcast look to your scene but we can also experiment with the other lights that are now at our disposal i'm going to disable this for now we could go back down to light in 2d and add something like a point light 2d and scale up the outer radius and you could play around with some of the settings here but basically you could set a light around something like your player or around a flashlight or a torch or something and you can even change the color so if we wanted this to emit something like a yellow tint you could go ahead and change that you know or any of any color really and so if we create a point light like this and just leave it somewhere you know it looks kind of cool but it doesn't really emit shadows the way we would want it to right like this light's shining on this tree but it doesn't really show any shadows being emitted from the tree this is a really easy fix though first we can select on our tree object and we want to add a component we want to add a shadow caster 2d and when you edit you'll notice by default it has this big white box around the entire sprite which sometimes works but in this case it doesn't i want to shake it down so it's just on the trunk of the tree you can definitely play around to make it nice and clean maybe even click in and add the branches and stuff like that but just to show you i'll just do the trunk for now once you have the box set up to where you want it we can go back to our point light 2d and one of the options down here is shadow intensity it goes from 0 to 1 and if we were to add this to say something like 0.1 you'll notice a little shadow starts to be emitted behind the tree and if we were to crank this up to like one it'll be really bold and looks terrible but you'll see actually how that shapes being generated from the light and if we move this around you'll see how it impacts it and looks a little different so you could set this back to something light like 1.1 and at this stage you could go ahead and add more shadow caster 2ds to your different sprite objects so we could go ahead and add a point light to our main player we could add a few more shadow casters to some of our objects in the scene and we could re-enable the global light 2d right now it's super bright but if we change this down to something like point 1 instead of having the sprites be pitch black where there's no light we could have it show a little bit so set to like point 1 or point two and this way it just makes it more atmospheric but it's night time instead of it being pitch black but again this is more up to your game and your design but i think this looks pretty good we could also add post-processing to our game which is very simple we could simply right-click in our hierarchy and go to volume and add global volume where it says profile you can go ahead and create a new one if you want once it's created you can now add overrides and we can go into the post processing menu and add things like bloom we can enable intensity and set this to something like 0.5 the bloom just makes your lights look a little more apparent by adding a glow to them but with this you've basically imported the foundation to set up lights in your games so good luck and subscribe
Info
Channel: BMo
Views: 6,802
Rating: undefined out of 5
Keywords: bmo, unity, tutorial, unity tutorial, 2d light, 2d lighting, 2d lights, lights, lighting, 2d lighting tutorial, 2d lights tutorial, unity 2d lights tutorial, game development, game dev, unity3d, unity2d, unity 2d tutorial, universal render pipeline, URP, post-processing, bloom, vignette, unity 2d shadows, 2d shadow tutorial, 2d shadows tutorial, unity lighting tutorial, 5 minute unity tutorial, 5 minute lights, bmo tutorial
Id: n08EA3svNT8
Channel Id: undefined
Length: 5min 8sec (308 seconds)
Published: Sat Jun 26 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.