Enhance a top-down game with URP 2D lights | Unity at GDC 2023

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right things got a little bit heated out there with overcooked two game on session but we're gonna bring things back down cool them off a little bit with our next speaker Matt darlinger as he discusses enhancing a top-down game with urp 2D lights take it away uh thank you so much I said my name is Matt and today I'm going to be talking about how to improve your 2D games using the universal render Pipeline and unity basically going over some like tips and tricks that the team put together to help everyone succeed at this uh so again I'll introduce myself to the team as you can see my name is Matt donnelinger I'm a developer advocate here and then we have Russ Guillaume and Eduardo they helped put the deck together put the demo that you're gonna see and put all this information together for you again here's sort of what we're going to go over we're going to talk about how to prepare your assets before you get them into the editor so what you need to do with the with them before they get in the editor what you can do in the editor and then we're going to sort of bring it all together to show you a day night cycle that they put together in a 2d game uh the main reason we've sort of put this demo and we're doing this presentation right now is that we wanted to uh promote this ebook so this ebook the team put together and it has so many tips and tricks for 2D art and animation it's available now online it's free I highly recommend checking this out if you have any interest in it it's going to go into way more detail and more topics than I will in this presentation but it'll be great source of information for everybody and so this is the sample farm game that we're putting together uh currently this is in development uh later this year we made available to everyone so you can you'll be able to download it off of the unity asset store but this is what we're sort of going to be using as the reference for all the stuff I'm gonna be talking about throughout the presentation and then yeah let's sort of talk about preparing your art so your pieces of art for your game and getting them in there uh first we want to start at the very beginning of your project so one thing we the team wants to call out is make sure when you're starting your project in unity that you select 2D urp this makes sure that the unity render pipeline is already good to go and it takes a lot of settings and make and sets them perfectly for a 2d game a lot of times teams will pick either 3D by accident or just 2D so they won't get the same value or they will have to go back in and change stuff later by selecting this from the start you save yourself a lot of time and trouble and headaches with it and then here a lot of what I'm talking about here is normal maps and mass Maps so this is an example of the our some of our assets and making sure that your normal maps and your math maps are set up as secondary textures so again this is examples of we have our animated character we have a tile map thing and then just an individual Sprite by itself so this is sort of how you want to have these set up as when you're getting ready to put them into the editor and then here is just sort of a breakdown for some of you may be unfamiliar this is what like these assets actually look like when you break them down into their individual pieces so the animated character isn't actually one whole thing it's each piece and part of the character separated out that has its own normal map and mass map and so that's what you use when you bring it into the game with the tile maps you can see sort of how the normal map was set up the mass Maps down here with the red uh using the red Channel and then for the barrel itself you can see the normal map and the mass Maps this is just to give you a sense of what your assets should sort of look like as you're getting ready to take them into the editor and then uh for normal map information normal maps in a 3D game and a 2d game function the exact same so there's no reason to worry about if you've done something in a 3D model like blender or something it still works the same in a 2d uh again you can get more information on normal Maps uh through the documentation on unity's website or again I'm gonna promote it the whole time the ebook it's got a lot of info useful information there for you um and here are again we're talking about normal Maps here are some examples there's a lot of different ways to get a normal map into or for your asset we they've listed a bunch out here obviously if you make it in a 3D space like blender you can bring it in and it will be a normal map that'll function correctly there are special generators like uh Sprite Eliminator that can help you generate a normal map on your own if you want to you can also manually paint them in so some of these again you need to look at what your team sort of skill set is what their strengths are and also what's your uh resources are so depending on what you need whatever depending on your resources and all that that'll dictate sort of which one of these you want to use some of them are more time consuming some of them are a little faster but again just look at what works best for your team again to get the best normal map possible and then here's an example they just wanted to show of doing sort of the color sampling method this is basically going in and to create your color map your sampling it from different sections of the image so getting the head on top and applying the normal map on the bottom there so again they're just showing some they're showing the team is trying to show different ways that you can generate your normal map and then here's an example of the Sprite Illuminator tool again this is a useful tool if you want to generate normal Maps this way and again this is just really quickly going through it I'd suggest if you're interested in this check out it check out their website get a lot of information on it and then here's one of the more time consuming but it can also this is one of the more time consuming methods so this is basically going in and hand painting each uh Channel and each part of the normal map and then putting it all together to create the final result this can lead to really good results but again sort of thinking about that resource and return on investment for this you may be able to do this but if it takes you three four months to generate one of these that may not be good for your Dev cycle so again all of these different ways think about them as you're going through to make sure they can work for your team and your game and then here's an example of us doing some hand painting uh normal maps that we use this is one of the pillars that holds the Torchlight in the game so again this is just showing quickly sort of what's involved with it and what they did again this if this works for your team it's a great way to do it um and one thing they wanted to call out is when you're uh bringing in your normal map textures uh are when you're bringing them in make sure it the texture type is set to normal map you want to do this for atlasing to make sure that again it's getting the best this setting sometimes is missed or not set properly again this will help with your Atlas scene for uh your Sprites and then Mass maps for those that don't know uh Mass Maps is basically a way to blend or for light to blend in a 2d space basically in the you have your 2D light on there uh on the left and then you come over in the red is the mat is the actual map itself and what's that saying is when light hits it at when it hits these areas do this type of blending for it and so this is a good way as you can see there's the barrel with the value but you can see with the character here this character has a nice Mass map and so as the lights moving around it gives it sort of that extra polish extra look that again the spread without the mass map that image looks really nice but when you add the max map to it it makes it pop and seem that much more like nicer and professional and then yeah here's an example of our hero character with his Mass map on again this is something and for this one this is sort of the calling out how to do what's called hero lighting so again this is using mass map to help your character sort of stand out in the game when you're thinking about it you want your playable character to be visible at all times and so a mass map again can help with that because if it has this nice glow and reaction with the light as players are moving around into the game world and doing other things they can at a glance tell where their character is and go from there so again this is something that's very good for readability and again going to that like high quality professional look and then yeah here we have sort of how it looks in the editor applying it uh excuse me and then just setting up the channels and all that and again it's just saying that this is what's gonna happen it's going to be additive you can change whether uh what type of what happens when the light hits the mass map but again see it's given you have the mass map around it and then you have your character looking very nice and having that glow to it and then here's an example of doing it with props again the different colors are just different channels would dictate what direction the light is coming from but yeah this is it's not just for your hero characters that you want to use Mass Maps you want to look at trying to do it everywhere that you can again to just make everything sort of stand out and have that better visibility for the players and then here yeah the texture type uh another sort of those settings that people Miss sometimes that the team wanted to call out make sure this is set to default uh just again to make sure that everything's working properly and it again helps with your Sprite atlasing a lot of the sort of tips and tricks here are to help you get it get the most like out of your game and not have any chugging behind the scenes from like processes or bad at listening or things like that and then here we have so on the left we have an example of normal maps for those that haven't seen normal maps in action before the pill the The Rock way there that is a flat image but with the normal map it gives it that effect of looking uh like it's got depth to it and again it makes it seem that much more nice and polished or realistic that players get a sense of it and here you can see the on the right you can see the mass map applied to the character as he moves back and forth from the Torchlight you can see where all those that yellow was painted in the previous slides you can see how it's reacting to the light there and giving again the player character stands out more and even like the barrels you can see as the light is moving around and then now that we've kind of gone over how you set up your assets before you get them in the game or into the editor rather let's sort of go over some of the things in the editor you can do um I've been sort of talking about this a little bit but I the team really wants to bring this up lighting and shadowing in a 2d Space is really important again for making it look really nice and stand out from the many many 2D games that are out there but also just to help with playability and performance uh like the image on the left you the way that's lit it gives a very nice somber feeling as you're like running through a forest and that gives you that nice sort of nice comfortable feeling you wouldn't want that type of lighting in the image on the right where there's a giant dragon shooting fire at you again you want to use the light and Shadow to sort of set the mood in this one it's a lot darker and sort of like scary sensation and you also have to be careful about not overusing light if the dragon's breath is too much or it's too big a light it'll wash out the screen and so when that happens all a player will see will be a blinding screen of fire that they can't do anything with again it's just looking at finding out what works best and what gives your game that sort of like nice aesthetic to it um one thing that the team has found some sometimes has missed is ambient lighting so in our farm simulator they've put in an Ambu an ambient light with a sort of low intensity and a certain color again to fit the mood of the game but even if you have a bunch of Lights in your game like a torch a spotlight things like that you still want some ambient light you're Nev there's never a time when something is completely dark and you don't want completely dark spaces in your game if you go outside even on a pitch black night there's some light so you can see some of what's around you and that's the same in the game you never want the player to stumble into a completely pitch black area because then it just seems like unfinished or like something's broken uh and one cool trick that they did for this demo was they basically simulated a sun and to do the day night cycle so in a 3D space you can just put a sun up and it's easy to go uh in a 2d space they had to be a little more creative so what they did was they created a spotlight at an angle and they basically use scripting to say okay it's it's the this is the Sun and it'll rotate around the 2D space and the light will hold the position and then it'll basically simulate that day night cycle so as it goes it basically changed from like noon to late late uh late afternoon dark and then morning um this is something that they another sort of setting they wanted to call out was to make sure to set uh normal maps on your lights to have basically to tell your lights to be to be affected by normal Maps the image on the left that is not set so you see how it just sort of has that washed out feel it doesn't look like there's any depth on the right there as the light moves around it gives the sense of the Bush this is another one of those little settings that sometimes can get missed that again just makes your product look a little unfinished so yeah another thing they wanted to call out um and then here was a trick that the team did for creating Shadows so using this Barn they're basically doing the sort of negative lighting by setting the blending style here to multiply uh it basically turns it into a shadow so instead of adding light as it is on the left there it's month the multiply causes it to create this basically fake Shadow and this is a great way to sort of in a 2d space fake that shadow and then later you're gonna see how they use this technique along with the fake sun to create that full day night cycle for everything in the farm simulator another type of shadowing is the blob Shadow it's a blob uh and again this is great for you can see on the pig there it's just like a little blob that goes under that creates a shadow this is a great way again if you don't have a lot of resources to do these crazy fake Suns things this is something you can do that again makes it look really nice like that pig right there without that shadow it just seems like a flat sticker but that shadow along with the normal maps and mass Maps gives it that extra pop and just makes it look that much nicer um and then here is for uh infinite Shadow projection so in the real world if we were standing outside the dark and I shined the light at you the shadow would go infinitely away from you and so with this you're able to simulate that so you apply this uh to your Barrel Game object and then now when light hits it and like it's already set on the character too you can see that the shadow is going infinitely back again this really fits with what people expect in in a night scenario if a light shines off of this it'll go infinitely behind you so again this is a great tool to again keep adding to that making everything look more professional high-end but the infinite Shadow is not perfect and so sometimes it won't work for everything the image on the left is with the trees using the infinite Shadow so as you can see some of the Shadow Behavior doesn't look 100 natural going through each other so the team found a technique of basically using a blob shadow on the trees to simulate what you would see in the forest without having the negative effects of the infinite Shadows and then so what they did with that was they then linked they created vectors for each of the blob shadows and linked it to the Sun so now as in the scripting language as the sun is rotating around in the space it's it's saying okay adjust the vectors based on that so if the sun's up here make sure the shadow Vector is over here basically away from it and again a great technique as the day night cycle is going to be like hey that looks like it's a day night cycle and then here they did a similar thing like I was saying with the negative Light Shadows so the team created four sort of variants of each of them to basically mimic the key points of the day so like middle of the night evening afternoon middle of the day and so they have these different shadows these different negative like freeform Shadows or pre-formed lights to create the Shadow and they use the vectors again to be able to follow the Sun and so here's just an example of them setting it up and basically linking those Shadows from the barn and from the house to the Sun to again follow in that and then here you can here it is in action and as you can see that like you have to make sure if you're doing this technique that you have enough transitions that it actually Blends together and it's not like super choppy where it goes from a huge Shadow little Shadow huge Shadow little Shadow so yeah with this you can see that it's going it looks and it looks again realistic and it makes the game feel more real as you're playing in the game oh it's getting dark it's becoming morning um another thing that it just wants to call it is always be thinking about adding more visual effects to your games so even with all these lighting and shadowings that's all great but there should be even more you can see the image on the left the Rays of light coming through the trees again that's just a little extra bit of polish that can make the game seem better in this one it's kind of hard to tell on the screen but you can see that there's clouds floating slowly there so basically doing fake clouds dust like if you're in a desert setting having a bit of dust sort of going through the air off to skating some of the lights that's a great thing and like if you're doing rain similar things just think about these effects like whatever you're seeing or whatever the level is look at it and be like if a player was standing there what would they expect to see would they think there should be some sort of extra effect here a little bit of dust there a little bit of extra lighting there just think about that as you're going through your process and then yeah we've been talking about all the separate pieces of the day night cycle and so again here's sort of all the collections of everything of the different vectors from the black shadows in the trees the negative Lighting on the barn and all the different assets and then the scripting to say okay follow the Sun as it goes around to mimic that date night cycle for everything and then yeah here it is in action and you can see that that really get this really gives a good sense even just standing here it feels like okay this seems like a real day night cycle and it sort of fits with what you would expect with how the trees look the lights kicking on as dust sitting there the Shadows getting a little bit smaller in certain places and this is and then yeah even with the lights kicking on it's really nice too so yeah like this is think about these with your game and you can make something that a farm game which when you think about is oh that's kind of a basic game but this makes it look really nice and stand out from many games at a convention like GDC and then here's just a few more ear thing is getting screwed uh a few more things at different types of like tips and for helps your performance one big thing to that the team wants everybody to think about is how your game performs like even if your game looks amazing and the most beautiful thing if it runs at 10 frames a second or it takes a behemoth of a machine to run it players aren't going to see it nobody like play it especially if it's on a mobile game or on a handheld or something like that players want to be able to get in and start playing and enjoy the visuals so you need to balance again what you're doing with your lighting with your shadowing with what your resources and your team budget will allow and then these so the demo that I showed and is a still work in progress and they're also adding new features to it as we're implementing new features so these are a few of the upcoming ones so like the soft lighting for infinite shadows and then like a debugger so the team this isn't just like okay the team has made this simulator and they're done it's like no they're constantly trying to improve add to it and uh make sure that this is valuable for all of users like you to get the most out of and learn the most from it and then yeah just a huge thank you to everybody uh this QR code should take you to the ebook I highly suggest checking out it's great for everybody it's a lot of useful tips the team is really excited about this as I said the farm simulator will be available in the asset store later this year uh if you want uh reach out to me or come grab me while I'm at the booth I'll be happy to talk to you answer any questions I can it's my Dev Advocate job to do that uh but yeah uh thank you all for taking the time to watch this and I hope you get a lot out of this for your 2D games cool
Info
Channel: Unity
Views: 18,405
Rating: undefined out of 5
Keywords: Unity3d, Unity, Unity Technologies, Games, Game Development, Game Dev, Game Engine, Game lighting, 2d Games, Universal Render Pipeline
Id: YhrwKF_i-BI
Channel Id: undefined
Length: 20min 28sec (1228 seconds)
Published: Fri May 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.