MAKE YOUR GAME RUN SMOOTH - Unity LOD Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Great video! I had no idea it was that easy! I’m in the middle of learning Blender and this will make the importing and optimization of assets in Unity so much easier! Keep it up!

πŸ‘οΈŽ︎ 5 πŸ‘€οΈŽ︎ u/Nielscorn πŸ“…οΈŽ︎ Mar 01 2018 πŸ—«︎ replies

Honestly, you have single-handedly helped me jump into game development with Unity. I'm a software dev by profession but game development always seemed like it was out of reach and in a completely different direction than traditional software development.

Keep up the awesome work and I look forward to seeing what content you make next!

πŸ‘οΈŽ︎ 3 πŸ‘€οΈŽ︎ u/butchly13 πŸ“…οΈŽ︎ Mar 01 2018 πŸ—«︎ replies

I really wish Unity would integrate a detail reduction tool right into the engine itself, like Unreal have.

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/sickre πŸ“…οΈŽ︎ Mar 02 2018 πŸ—«︎ replies
Captions
when making levels you of course want them to be as detailed as possible but just throwing a bunch of high quality models into a scene is not very performant especially if your scene is fairly large of course it makes sense for the models to be detailed when viewed up close but for objects far away this detail isn't very important this is where level of detail or LOD comes in here we basically create multiple versions of each model at varying quality and then swapping the right version depending on the view distance if done correctly this can be pretty much unnoticeable and make this scene a lot easier to render the cool thing about setting up lots in unity is that if you organize your assets in a certain way unity will pretty much do everything for you so first we'll go over how to create multiple levels of details for your assets in blender and that will bring everything into unity we go so as you can see I'm here in blender 2.78 and what we're going to be doing today is not particularly advanced but if this is the first time you're opening up blender I suggest you at least check out the first video in our blender basics course all right so first I want to select the camera then hold down shift and like the Sun and cube as well and hit X and press delete so now we have an empty scene of course you can go ahead and create whatever asset you want here but I'm just gonna go and create a monkey so let's say this is the game asset that we want to create multiple versions of well I think first of all we could create a level of detail that is even higher than this one so I'm gonna go to the modifiers and I'm gonna add a new modifier and I'm gonna choose subdivision surface so this adds a lot of subdivisions to our model I'm gonna go ahead and apply these and if we switch into edit mode by hitting tab we can see that there's quite a bit of detail on this model so this represents our base model our model in its highest quality we refer to this as lawd zero so I'm gonna go to the top here and find our model our monkey's name is Susanne that's right it's a girl so we can right-click on Susanne and go rename and we'll right underscore LOD for level of detail and then I'm gonna put a zero here and this is one of those unity specific things that we have to do this exact way judy is going to look for this underscore LOD and then an index and then recognize what it means so we can then go ahead and create alternate version offices and so I'm gonna duplicate her by hitting shift D and I don't want to move her around so I'm just gonna right click to snap her back to original position now this one I'm going to rename to LOD underscore one and I want to go and move this a SAN on to another layer to do that I'm gonna press M and I'm gonna select the second layer here and as you can see down here there are now two different dots on these two layers because there's an object on each one and we can switch between them of course we have the same model on each layer but we are now only viewing one of them at a time and we can always quick switch between layers by using the number keys so now we want to reduce the quality of this model of course the best way to do this is go in by hand and simply remove polygons but this is also very time-consuming often you can get away by simply adding a modifier so we're gonna go add modifier and we're gonna select decimate here we can adjust the ratio and right away you can see that we are slowly compressing our model I'm gonna set this to a value of 0.5 I think that's a fairly decent starting point and then I'm gonna hit shift key once more go to the top and renamed to LOD 2 and again I'm gonna hit em to move it on to another layer and I'm gonna select the third one then I'm gonna press 3 to move to that layer and I'm gonna reduce the ratio even more I think I'm gonna try a value of 0.2 again shift D to duplicate right-click go to the top and rename finally we'll call it LOD 3 again move it to the fourth layer hit forward to focus on that layer and this time I'll bump the ratio down to say point 1 so now we should be able to use our number keys in order to see the transition between our different levels of detail of course this level of detail doesn't look too good but remember we'll be viewing it from very very far away and on top of that our model currently uses flat shading if we selected and go to the left here we can hit smooth and that definitely helps hide the subdivisions so I'm gonna do that for each one of our models and I'm also going to go through and apply each one of the modifiers so hit apply on the modifier go to the 3rd layer apply 2nd layer apply and of course our first layer does not have a modifier and that is actually all of this set up that we need to do if you want to preview how many triangle makes up each level of detail step you can see that at the top here so the first one is about 4k the second one is about half of that the third one is under a thousand and the fourth one is just under 400 so now we're ready to export this into unity to do that we'll go file export and we'll select FBX here we can browse to our project folder go under assets and I'm gonna save mine as monkey and let's hit export FBX now when we open up our unity project we can see right away that we have an FBX in here and under it we have the four different levels of detail and this is where unity is just so awesome because if we simply take the parent object here and drag it into the hierarchy right away it sets up everything for us because unity recognizes that this object has multiple sub objects that are all marked with a certain level of detail and so it goes ahead and creates this LOD group now before I show you how cool this is let's go ahead and drag our object up here so we can actually see it let's also look under the object here we can see all of our different levels of detail if we select all of them we can create a material for them so we'll go right-click create material we'll call this material red will set the smoothness to zero I'm gonna set the color here to a nice red and once again I'm gonna select all the objects and drag in the red material and if we then select the parent object it will clearly indicate in the scene view what level of detail we're currently looking at and as I start zooming out you can see this camera here is moving towards the right that's because it's showing us how much space our object is taking up on the screen and as we zoom out it takes up less in there space and in fact if we zoom out just a tiny bit more it's going to switch to LOD one if we zoom out even further LOD two and even further LOD three now we can't actually see this happening and that's of course a good thing if you want to see this happening more clearly we can go and switch to wireframe and here we might be able to see the amount of wires change as the level of detail changes but still that might not be completely clear so just to demonstrate we can go and select each one of our level of details and we can add a separate material to each one so the first here's gonna be red I've gone ahead and prepared a yellow material as well a green material as well as a blue material and now as we zoom out you can see that our object changes color super super cool we can also go ahead and select any one of these Elodie's and the LOD is going to show up down here it's gonna display the amount of renderers and materials as well as the number of triangles so we can go through and see the number of triangles here as well and this is also where you can set up your own renderer so in case we didn't have the right renderer we would go in and remove the one that we have instead he'd add and now we can go ahead and select any object here but of course we want the first one so how does this look within the game view well it looks pretty much the same if I go ahead and take my scene view here and target on my secondary monitor I can try zooming out with the camera and you should be able to see the exact same thing happening awesome that's pretty much it for this video if you enjoyed it make sure to subscribe so don't miss a future one if you like these videos and want to support them you can do so over at patreon.com slash break ease patreon is a way for you to set up a monthly donation you choose the amount and when to cancel it and pretty much everything but it's a great and safe way for you to support us and the content that we're making on that thanks for watching and I will see you in the next video thanks to all the awesome patreon supporters who donated in January and a special thanks to Sean Carey Diego guy kudamon dime guy in Visio Infinity PPR yo Ryoma Sybok mami derek Eames Kirk Marissa Mayer fine Peter die John Ramirez double tap 45 James P Superman the great John Beauregard Jason de Tito Alex wakatsuki lΓ©on foucault SUNYAC obscene James Rogers Robert pond Rob Ferran and Erasmus
Info
Channel: Brackeys
Views: 248,290
Rating: undefined out of 5
Keywords: brackeys, unity, unity3d, asset, assets, model, texture, models, textures, material, materials, beginner, easy, how, to, howto, learn, course, series, tutorial, tutorials, fix, tip, game, development, develop, games, basic, basics, blender, level, of, detail, lod, triangle, triangles, tris, zoom, in, out, optimization, tricks, optimize, performance
Id: ifNyVS2_6f8
Channel Id: undefined
Length: 8min 18sec (498 seconds)
Published: Wed Feb 28 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.