I’ll keep this one brief for once!
I spent the past several days working on a solution to get high quality trees both looking and performing well. Aside from setting up the art assets themselves a big effort went into creating a high performance LOD system that could handle enormous amounts of objects without slowing things down. LOD means “Level of Detail” and is a common concept in game development. The idea is that objects that are closer to the camera are more detailed while those that are further away are more simplistic and less detailed. The goal is to improve rendering performance while still producing as seamless an experience for the player as possible. LOD in general should not be very noticeable by the player.
I started off working on the code and implementing a solution that was extremely fast. Here’s a video of the first iteration of development:
Blocks that appear in green represent the highest detail level, those in blue a level below green, those in yellow a level below blue and finally red representing the lowest detail level. Realistically not every object in the game will have the same number of detail levels. Some may have 2, others may have 4 or 5. The system had to be created in such a way that it would transition appropriately regardless of how many actual detail levels existed for any particular object. I also wanted it to be able to scale to hundreds of thousands of objects and have minimal impact on the CPU, garbage collection, memory use and other system resources that would slow the game down.
After a lot of work I was able to go from the block demo in the first video to a test with 250,000 high detail trees loaded at once and each randomly rotated. So far I’m pleased with the result. Note that there’s no editing in this video. Everything was recorded in real time to demonstrate the speed and performance of the new LOD system (which I’m calling RealmLOD internally — creative name right?).
We don’t plan on having any areas with hundreds of thousands of trees (or anything else for that matter) packed together at the same time but this stress test helped validate the performance of the system. It should easily handle what we have planned for realistic numbers of environment objects.
Hope you enjoyed this peak into the ongoing internal development of Realm Explorer. Share your thoughts in the comments!
EDIT:
After re-watching the video on youtube I noticed that unfortunately the video quality came out really bad. It may give at least a little idea of the performance (there’s no lag at all) but it definitely doesn’t give a good impression of the visual quality of the environment.
Here are a few screenshots from the same test: