Unpacking UE5 toolbox Part 1 – Nanite

Unreal Engine 5 has been making waves in the gaming industry with its stunning visuals and advanced features. However, it’s not uncommon for some projects to struggle with performance issues. This article aims to demystify the common misconceptions surrounding UE5 and provide practical tips on how to optimize your project since its conception.

While some games have faced criticism for being resource-intensive, we’re not here to point fingers or assign blame. Instead, we’ll focus on sharing best practices and strategies for developers to create performant and engaging experiences with UE5.

Let’s take a closer look at the most common comments we can find about the topic. Some critics have accused the engine of causing performance issues in games like Borderlands 4, Silent Hill 2 Remake, and Star Wars: Jedi Survivor. These games had some rough launches and took a huge backlash from players and reviewers.

Borderlands 4 | PC Gamer: “It’s a big, bold world of stutters and disappointing frame rates, even on the best PC hardware money can buy.” 

Silent Hill 2 Remake | Rock Paper Shotgun: “PC performance isn’t a total horror show, but low-end rigs will shudder”

Star Wars Jedi: Survivor | PC Gamer: “The only thing that threatened to ruin my good time were the constant performance issues with the PC version.”

Optimization is key

But what do these criticisms really tell us? That UE5 is inherently flawed? Not at all. In fact, Epic themselves released an official note mentioning the issues with shader stuttering and providing solutions to address them.

Even if this was unsolvable, optimization is still a crucial aspect of developing for UE5. As our CTO Manoel Neto pointed out in his Tech Talk, some things are ideally thought out from the start. Optimization is one of them. It’s important to establish a technical budget and set clear guidelines for optimization, taking into account factors like RAM, triangles, vertices and draw calls.

So how can you make the most out of UE5’s advanced features without sacrificing performance? Well, when it comes to consoles, consider the least performant device in mind. For PC development alone, understand what kind of game you’re making and what average PC Build is able to run it. The Steam Hardware & Software Survey is particularly handy in this scenario.

Also, the default configuration for graphical features is not one-size-fits-all. It’ll highly depend on various factors we’re about to discuss. In reality, the problem of poor performance is often due to misuse or misconfiguration rather than a flaw in the engine itself. [1]

Unreal Engine 5 focuses on high-graphical fidelity, which means that there are multiple systems in place to help developers achieve that. However, these systems are tools that need proper handling. It doesn’t make sense to blame them for poor performance. For example, blaming Nanite for poor performance is like blaming a hammer for falling on your foot. So let’s get started and explore how you can make the most out of UE5’s advanced features without sacrificing important aspects of your project.

Diving deeper into Nanite

Introduced in Unreal Engine 5, Nanite is a feature that virtualizes scene geometry by dynamically fragmenting it into clusters based on the screen space each polygon occupies. This allows for higher-quality meshes to be used without negatively impacting performance, simplifying the asset authoring process. Nanite combines multiple procedures executed at edit-time mesh importing and runtime processing of on-screen geometry.

Meshes are divided into 128-triangle clusters, generating a multi-level hierarchy for those clusters. These are checked before rendering, allowing dynamic removal via multiple culling techniques applied at the cluster level, and shading applied only to the remaining visible pixels. For very small triangles, Nanite uses a Software Rasterization Path parallelized by the GPU per triangle cluster, which is more efficient and precise at such sizes. 

While Nanite can speed up rendering geometry and materials, as well as provide a reduction to the number of draw calls, it’s essential to use it carefully in a project. It is not a panacea that magically solves rendering performance issues. Following a few key practices is important:

  • Avoid composing complex structures with multiple sub-meshes as separate static mesh actors. Instead, it is recommended to use groups, Hierarchical Instanced Meshes (when possible) or merging them into a single mesh, though there is a tradeoff with keeping complex meshes in memory.
  • Author vegetation meshes by fully modeling it instead of using flat masked polygons, to avoid overdraw of masked or transparent meshes,  which can cause performance issues for Nanite. This can benefit from procedural foliage generation features in Unreal, so that with a small number of pieces, a project can have effectively infinite variations of foliage types.
  • Be aware that there is some overhead associated with using Nanite, so consider whether your project needs it (e.g., low-poly games or small scenes that are not very detailed). Using Nanite in these scenarios could be detrimental to rendering performance. 
  • When enabling Nanite, its overhead is added even to non-Nanite meshes, which won’t benefit from the faster rendering. Because of this, make sure that most meshes are set to use Nanite.
  • Share material bases between different meshes whenever possible, as they are separated in raster bins based on rendering states. Projects that use multiple external assets (for example bought from Fab) tend to accidentally cause scenes to have more raster bins than needed. 
  • Enable Steaming Virtual Textures when using Nanite for improved performance, as recommended by Epic.
  • Avoid materials with deformation (WPO, PDO, Mask Textures, displacement) when possible.

To identify optimization issues, use profiling and scene visualizations to find the root causes. Unreal offers diagnostic tools that can assist, but it’s essential to know what you’re looking for.
Some indicators of unoptimized scenes and assets include a large number of Raster Bins, uneven cluster sizes, excessive overdraw, and too many polygons using the Hardware Raster Mode.

Ahead we can see some examples from two sample projects offered by Epic Games. They are shown through different optimization visualization modes. The first in each pair is from the Electric Dreams project, which is a showcase of Procedurally Generated Environments. The second in each pair is from the Valley of the Ancient project, which is a showcase of Nanite, Lumen and advanced particle effect features. Due to this difference in goals, Valley of the Ancient is much more optimized, and we can use that to get a comparative understanding of Nanite optimization.

High overdraw: The vegetation is not optimized for Nanite

Low overdraw: The only areas with overdraw are those where small irregularities in the terrain peek over one another

Unevenly-sized triangle clusters: The cluster sizes are all over the place, which contributes to overdraw and mask storage costs

Evenly-sized triangle clusters: Most of the clusters are within the same size-range.

Large number of Raster Bins: Each of those is processed separately, increasing overhead.

Single Raster Bin

In conclusion, we can see that developing with Unreal Engine 5 requires a balance between creative freedom and technical discipline. While it’s true that UE5 is capable of delivering stunning visuals and impressive performances, it’s equally important to remember that these capabilities are only realized when used wisely and efficiently.

By understanding the capabilities and limitations of features like Nanite, developers can unlock their full potential while avoiding common pitfalls. By setting a technical budget and establishing clear guidelines for optimization, you can ensure that your project runs smoothly on a wide range of devices.

Ultimately, the key to successful UE5 development is a combination of creative vision, technical expertise, and attention to detail. By keeping these principles in mind, you’ll be well-equipped to bring your ideas to life and create engaging experiences that captivate audiences worldwide.

References

[1] Unreal Engine Sucks? You’re doing it wrong

Doubling FPS in Unreal Engine 5: A Practical Scene Optimization Case Study | Medium

Myth-Busting “Best Practices” in Unreal Engine | Unreal Fest 2024
Nanite Virtualized Geometry in Unreal Engine
UE5 Optimization Made Easy: Fundamentals

Nanite :Epic’s Practical Implementation of Virtualized Geometry

Unreal Engine 5 Nanite Performance: Profiling & Optimization Tips for Pipelines | Medium