Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Optimization for smooth play is something that should be in the forefront of the game designer's mind. Now, we should be making beautiful art and putting it around a place that's new and exciting to play in, crafting an immersive environment. But, at the same time, it has to work well. A beautiful game that's buggy and plays slow doesn't do anybody any good. Conversely, there are some games that are looking decent but play wonderfully, and are immersive time and time again. We can do a lot on the back end to optimize how our game plays.
And actually we've been doing some of it already. Making pre-fabs and cloning them around. This is a terrific one, because it helps optimize how many objects we're actually using. We can also do a lot of optimization with things like limiting down lights to only hit certain layers. And culling down other objects so that we're being very picky about exactly what interactions are taking place. When you're ready to optimize on a more global level what the camera sees. You can use a clusion culling and what this does is to limit down how much we see if it's blocked by another object.
I'll go into my scene and turn on the overdraw so we can get a good idea of what's going on. I'm here in building b and I'm going to look out the windows towards the other buildings. I'll drop down where it says RGB and choose Overdraw. What we can see here is that objects are drawn at a transparent red, and as more and more and more objects are overlaid, we get a brighter color, showing we are overdrawing more and more things. Now here's where this really starts to kick in. When we turn back on the water, and turn on the terrain, we'll see a tremendous amount of over drawing going on.
terrain, we'll see a tremendous amount of over drawing going on. Finally, with the effects back on, we'll even see how bright those get. What this means then, is if we can limit down what the camera sees, we can get a smoother and faster game play. And so we'll use our occlusion color. I'll choose Window and Occlusion Culling from the top menu. The idea in Occlusion Culling is, we're going to mark things as static, anything that doesn't move. And then, bake out zones of Occlusion. I'll start out by marking things as static.
I'll pick all of my solid walls. Picking one, holding Shift, picking the last one and, over in the inspector, checking static. This way these objects we marked as not moving and can be called down, I'll scroll up and look at the other pieces. The waiting ammo's move so they may not call well, but some of the other things will. The master building really only has some movement on the doors. French doors four, six, 11, 13 and 20. So I'm going to pick this master building, and mark it as static, and then come back and choose those objects.
I'll change the children so they're all marked static, then I'll open them up and go look at those French doors. Here in the gallery, I'll scroll down, and there's my French doors. French doors four, six, 11, 13 and 20. And these five I will uncheck as being not static. I'm ready to try a bake. There might be some other objects I can catch, but I'll see how this behaves first. Actually, before I do, I'll look at the art. I know that the paintings don't move, so I can pick all of the art p for paintings.
And check them as static as well. I'll change the children, because that way, it'll catch the painting in the frame. And I'll go back to the occlusion window. What this says is, it's going to bake the things that are static, occluder and occludee. Meaning, it'll look at, is it static on it's own, and is it static being blocked? I'll click Bake with nothing selected and it will take a minute and bake out that exclusion. My occlusion is baked and I'm seeing that overdraw culled way down. Now I do have a message at the bottom. Some renderers use a transparent shader but are marked as acluderstatic.
What this means is I need to go through that scene and look at all the glass objects and uncheck them as static. This way I can see through the glass properly. But I'll take a look at it, and see how it plays. It definitely looks more optimized. There's not nearly as much of that giant white in the background where so many objects are clumping together. I'll switch back to RGB mode. And I'm here in my scene. I'll press Play and see how it looks. Here in my scene, I'm getting some varied results. What I'm seeing, is that in some places, things are winking in and out.
And what this means, is that my inclusion distance isn't quite set right. It's definitely helping. I'm watching my draw calls go way down. But I'm definitely seeing some flickering in the background, and things coming and going. Inside, I can still knock over the art, and that's working nicely. And the inside of the building looks good. But I do need to fine tune that occlusion. This may take some time. And it may take some time to go through and tag things, think through the Bake, and think about how it's working. What we can look at in that eclusion then, is in the Bake section.
How big are we dealing with? How big is the back-face threshold? What's going on in terms of, how far are we seeing? And how are our objects that are transparent reacting? What I should do is to go through this building. Opening up that gallery and selecting those glass objects. For example, here's one of those outside metal screens. This one probably shouldn't be a static because we should be able to see through slightly. I can pick all of the screen objects at once and uncheck them. It will take some judicious checking, but I can make sure that the inclusion is working correctly and not clicking out more of the surrounding and environment than it should.
of the surrounding and environment than it should. When you got it ready you can go back into the occlusion, clear off the initial bake and bake it again. This is a terrific way to save draw calls because it says don't draw if we can't see it. So make sure you work with the occlusion culling and really cull down how many things are actually showing up in your view.
Get unlimited access to all courses for just $25/month.Become a member
107 Video lessons · 32696 Viewers
94 Video lessons · 22651 Viewers
78 Video lessons · 8853 Viewers
83 Video lessons · 8228 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.