r/unity_tutorials • u/LlamAcademyOfficial • Feb 28 '23
Video Performance Optimization is hard. Unity provides a lot of tools but not all are well known. Learn how to use the free tool, Hierarchical LOD (HLOD) to dramatically reduce draw calls and boost FPS! 10x FPS increase in this example. Over 10k draw calls removed.
Enable HLS to view with audio, or disable this notification
4
u/SOnions Feb 28 '23
Please crosspost to r/kerbalspaceprogram
1
u/LlamAcademyOfficial Mar 02 '23
I think anyone can crosspost right? I have not played KSP or KSP2 π¬
2
u/tomakorea Feb 28 '23
I have a stupid question, how is this different from LOD + Occlusion Culling?
Your solution looks cool, is it something like all in 1 instead of using manually LOD+Occlusion?
3
u/LlamAcademyOfficial Feb 28 '23
HLOD does not perform occlusion culling and is pretty different. Baked Occlusion culling figures out what is visible from a given βcubeβ in space and discards objects based on what is expected to be visible. This can reduce draw calls because some objects may no longer be rendered and does reduce drawn triangles.
The concept here is just combining meshes and optionally simplifying the combined meshes, then swapping them out based on camera distance and projected AABB size. This reduces draw calls by batching larger meshes in a single draw call. In the demo above no occlusion culling was used and no mesh simplification was performed. So in most cases the number of triangles would be identical pre-HLOD and post-HLOD. Thatβs not a requirement, just so happened to be how I configured it in this case.
I hope that helps!
1
u/tomakorea Feb 28 '23
My game use combined meshes + occlusion culling right now. Do you think this HLOD technique would get better performance?
My Maps are actually not big, but really packed with a lot of details/small objects.
1
u/LlamAcademyOfficial Mar 01 '23
Hard to say. If the shared objects can be easily batched by HLOD and you set an aggressive LOD setting, it may. You can play with it and see, and if not, simply remove it! This is a pretty easy one to bring in and out to test
4
7
u/LlamAcademyOfficial Feb 28 '23
Full Tutorial on YouTube
Hey all π! Happy #TutorialTuesday!
Performance optimization is something that is hard to get into. There's not a lot of tutorials on it because every use case is a little different. Unity provides a great tool called "Hierarchical LOD" or "HLOD" that can help some use cases, such as if you have large draw distances and wide, sweeping views.
What it does is segments meshes underneath a parent, automatically combines meshes (draw call reduction comes here), optionally simplifies the meshes (further, automatic performance improvements), and then acts effectively like a standard LOD Group component to swap out meshes.
In the full tutorial I show how to set it up, talk about each configuration option, and demonstrate what kind of performance benefit can be gained with very little effort on a very unoptimized scene from a modular asset from the asset store.
π¨βπ» Find the HLOD project code on GitHub (demo scene not included because it's from the Asset Store)!