The Solution – Custom LOD Algorithmīefore explaining the solution I applied, it is important to mention that the most common and efficient solution to improve rendering time for a big amount of objects would be to use Instance Rendering. On the other hand, rendering is not only the problem, all these objects need to perform the occlusion test, which will also take some time (I am not sure how UE4 implements it, but is good to have that into account). Although the rail meshes are using LODs, the mesh used when the object is far away contains just 35 triangles, is not enough to make the game run over 60 FPS. The problem here is that we have a lot of objects to render in order to visualize the rails that the spline are representing.
![stonehearth multiplayer lag stonehearth multiplayer lag](https://i.ytimg.com/vi/bGmFcpGta1s/maxresdefault.jpg)
The longer the spline, the more objects we will need to represent it: Splines are represented using multiple meshes. This makes sense because every spline is rendered by using multiple small objects. I found out that the spline mesh rendering was taking a big percentage of the frame time. Once we had a “big” testing level built, the game started to run a bit laggy in some of the computers we where testing the game on. But, these components did not solve all our problems… The Problem – Spline Mesh Rendering Thanks to the Spline and Spline Mesh components provided by UE4, we could build the first prototype and start iterating in the fun part of the game early on the development.
![stonehearth multiplayer lag stonehearth multiplayer lag](https://i.ytimg.com/vi/X3ZW3xmEjZY/maxresdefault.jpg)
Since the game is based on fast rail movement, from the very beginning we had clear the rails were going to be one of the biggest technical challenges of the project.
![stonehearth multiplayer lag stonehearth multiplayer lag](https://i.ytimg.com/vi/j0w1sTFHR6o/maxresdefault.jpg)
In this post I will describe a simple, but different, Level Of Detail (LOD) algorithm I implemented for Fast Food, the project I am working on during my Senior year at DigiPen Bilbao.