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, with a focus on Nanite. It also provides 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.

What critics say about UE5 performance

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 certain games. These include Borderlands 4, Silent Hill 2 Remake, and Star Wars: Jedi Survivor. All three 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 has inherent flaws? 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 an essential aspect of developing for UE5. As our CTO Manoel Neto pointed out in his Tech Talk, teams should ideally think some things through from the start. Optimization is one of them. It’s important to establish a technical budget and set clear guidelines for optimization. When you do, take into account factors like RAM, triangles, vertices and draw calls.

Know your target hardware

So how can you make the most out of UE5’s advanced features without sacrificing performance? Well, when it comes to consoles, keep the least performant device in mind. For PC development alone, understand what kind of game you’re making. Then find out what average PC Build can 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. That means it has 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 begin. We’ll explore how you can make the most out of UE5’s advanced features without sacrificing important aspects of your project.

Diving deeper into Nanite

Unreal Engine 5 introduced Nanite, a feature that virtualizes scene geometry. It dynamically fragments the geometry into clusters based on the screen space each polygon occupies. As a result, you can use higher-quality meshes without negatively impacting performance, and the asset authoring process becomes simpler. Nanite combines multiple procedures executed at edit-time mesh importing and runtime processing of on-screen geometry.

Nanite divides meshes into 128-triangle clusters and generates a multi-level hierarchy for those clusters. It checks these clusters before rendering. This allows dynamic removal via multiple culling techniques at the cluster level, while shading applies only to the remaining visible pixels. For very small triangles, Nanite uses a Software Rasterization Path, which the GPU parallelizes per triangle cluster. This path is more efficient and precise at such sizes. 

Best practices for using Nanite

Nanite can speed up rendering geometry and materials, and it can also reduce the number of draw calls. Still, 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, use groups or Hierarchical Instanced Meshes (when possible), or merge them into a single mesh. However, keeping complex meshes in memory comes with a tradeoff.
  • Author vegetation meshes by fully modeling them instead of using flat masked polygons. That way, you avoid overdraw of masked or transparent meshes, which can cause performance issues for Nanite. This approach can also benefit from procedural foliage generation features in Unreal. With a small number of pieces, a project can then have effectively infinite variations of foliage types.
  • Be aware that Nanite comes with some overhead. So consider whether your project needs it (e.g., low-poly games or small scenes without much detail). Using Nanite in these scenarios could be detrimental to rendering performance.
  • When you enable Nanite, its overhead applies even to non-Nanite meshes, which won’t benefit from the faster rendering. Because of this, make sure that most meshes use Nanite.
  • Share material bases between different meshes whenever possible, because Nanite separates them into raster bins based on rendering states. Projects with multiple external assets (for example bought from Fab) tend to accidentally give scenes more raster bins than needed.
  • Enable Streaming Virtual Textures when using Nanite for improved performance, as Epic recommends.
  • Avoid materials with deformation (WPO, PDO, Mask Textures, displacement) when possible.

Finding Nanite optimization issues

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 and uneven cluster sizes. Others are 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 appear through different optimization visualization modes. The first in each pair comes from the Electric Dreams project, a showcase of Procedurally Generated Environments. The second comes from the Valley of the Ancient project, a showcase of Nanite, Lumen and advanced particle effect features. Due to this difference in goals, Valley of the Ancient has much better optimization. So we can use it to get a comparative understanding of Nanite optimization.

High overdraw: The vegetation lacks optimization 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: Nanite processes each of those separately, increasing overhead.

Single Raster Bin

Creative freedom and technical discipline

In conclusion, we can see that developing with Unreal Engine 5 requires a balance between creative freedom and technical discipline. It’s true that UE5 can deliver stunning visuals and impressive performances. However, it’s equally important to remember that these capabilities only come through when you use them wisely and efficiently.

Developers who understand the capabilities and limitations of features like Nanite can use them to their full potential. They can also avoid common pitfalls. Set a technical budget and establish clear guidelines for optimization. That way, 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. With these principles in mind, you’ll be ready to bring your ideas to life. You can then 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