- Home /
How is LOD implemented?
Hello,
So I have reached the point where I want to have lots of Zombies coming at the player, however I seem to get some frustrating lag. I have used Occlusion Culling as well, but it's having a bit of issues right now such as even when the zombie is still in the camera, it sometimes flickers.
So I read about 'LOD', Level Of Detail which got me interested. I basically wanted it to work like the system of SpeedTree as for when you are far from the Tree, the LOD is at the lowest, and as you get closer, it increases and eventually reaches max.
Will I need to do lots of scripting for this? If that's the case, don't write me up a whole script, just get me on the go to making this awesome system for my Zombies. :)
Answer by DimitriUK · Jul 15, 2015 at 06:34 PM
So I will be answering my own question with some knowledge from 'TutiBueno2' as well.
In order to work with an effective LOD system which will allow you to have many objects in your world, or if you are building a huge open world level, then using the LOD system is for you.
Here is a short tutorial:
First, you will need your model, but several of them each with lower poly meshes.
You will click on your Parent Object/ZombieAI >> Add Component >> Rendering >> LOD Group.
You will now have:
LOD 0 (Highest Polygon Model) - Click on the Green LOD0 100%, and you will see you can add Renderers. Drag your highest detailed mesh/model in to that Renderer.
LOD 1 (Medium Polygon Model) - Drag your lower poly model's render parts in to that as well.
LOD 2 (Lowest Polygon Model) - Drag the lowest poly of the model in to LOD 2.
Change your 'Fade Mode' to Crossfade and you can configure how far and close it should begin to render, etc.
BE AWARE, if you only have 1 model such as a model from Mixamo's 'Fuse', then you may have trouble unless you use there Decimator which lowers the polys of the model.
Since Mixamo have just joined Adobe, the decimator is currently not usable and all features should be restored within a few months according to Mixamo.
If you are NOT using a Third Party program to create your models and would like to use an LOD system, it is recommended that when you are creating your 3D models, you should start with making the lowest poly model up until the highest, or as I heard some sort of unwrapping method can help.
I really hope this helps for anyone else in the future wanting to know about how the LOD system works.
Answer by SkandYxyz · Jul 15, 2015 at 03:56 PM
Hi Dimitri,
you have multiple options. First, unity comes with an integrated LOD system. You can find this under Components->Rendering->LOD Group. Add this to your Game Object. Now you have to generate a 3D object file, e.g. an .fbx file with multiple meshes and name them ...LOD0 ...LOD1 ...LOD2. Generate a Mesh or Skinned Mesh Renderer and assign this 3D object and it should switch beteen the LOD's depending on distance. The problem with Unity's LOD system is, that it might be slow, because it has to calculate the distance between every LOD Group and the camera very often. A better choice is to make a 3D Grid, that holds each object and updates rarely. For this the best LOD system on the asset store is in my opinion QuickLod together with InstantOC. They are worth the money.
Sincerly,
Andre
Answer by TutiBueno2 · Jul 15, 2015 at 03:58 PM
No, no scripting needed. You just have to add the "LOD Group" component to your zombie model.
It would be nice if you have different versions of your zombies, one for each LOD level, like a super detailed one for close view, a medium detailed and a low detail (for far view).
More info here: http://docs.unity3d.com/Manual/class-LODGroup.html
Yeah, I kind of figured it out. I then realised, it wasn't working and then realised that I needed the same Zombie model but with less polygons for each the lower the LOD gets.
Since the Zombie model I have got doesn't have that, I might have to try out a third-party program such as QuickLOD as 'SkandYxyz' mentioned.
$$anonymous$$y levels will be having hundreds and hundreds of zombies. I literally lag hard if there is over 30 right now, hahaha.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Distant terrain level of detail question. 0 Answers
UNITY 3D: How to make the camera follow the player? Smoothly 2 Answers
How can I limit the rotation on the Y axis so the player cant spin the camera 360 in an FPS game? 0 Answers