< All Topics

Nanite Tips

Even when Nanite is enabled, the engine maintains a low-polygon, traditional copy of the object in the background known as the “Fallback Mesh.”

This fallback copy is used for:

  • Complex Collision calculations.
  • Devices that do not support Nanite (Older PCs, Mobile).
  • RAY TRACING! <– This is likely where your issue lies.

The Situation in Your Scene:

Because you are using Ray Tracing, your GPU renders the visual geometry of the buildings using Nanite (which is extremely fast). HOWEVER, when calculating shadows and reflections, the engine might be utilizing that background “Fallback Mesh” (or Proxy Mesh) instead of the Nanite data.

If the “Fallback Mesh” settings for your Nanite objects are too high (meaning even the backup mesh is high-poly), the Ray Tracing calculation time (the 7.6ms seen in the previous image) will bloat.

What Should You Do?

Instead of manually “creating LODs” for Nanite-enabled objects, you should adjust the Fallback Mesh settings:

  1. Open a Static Mesh that has Nanite enabled.
  2. Locate the Nanite Settings in the Details panel.
  3. Look for the setting called Fallback Relative Error.
  4. The default value is 1.0.
  5. If you increase this value (e.g., to 2.0 or 4.0), the “Fallback Mesh” generated by the engine will have a significantly lower polygon count.

Result: Your visual quality remains intact (thanks to Nanite), but because Ray Tracing is now calculating against a “simplified” fallback mesh, your performance will increase.


Summary

  • For Visuals: Nanite and LODs do not work together. Nanite takes full control and disregards traditional LODs.
  • For Ray Tracing: Nanite uses a simplified, “LOD-like” copy in the background for lighting calculations. Optimizing this specific copy is the key to better performance.

Position Precision

In Nanite settings, “Precision” refers to how accurately the engine stores the coordinates of the vertices on your model.

Let’s use a ruler analogy to explain:

  • Low Precision (e.g., 16-bit): You have a ruler that only shows centimeters. You can’t say a point is at 10.5 cm; it must be either 10 or 11. The engine rounds the vertex to the nearest integer.
  • High Precision (e.g., 32-bit Float): You have a microscopic digital caliper. You can record a point exactly at 10.43521 cm. The engine saves the position with millimetric accuracy.

Why is this important for your City Project?

Nanite uses Quantization (compression) to reduce the game’s file size (GB). This process usually “rounds off” vertex positions to save space.

1. “Cracks” (Light Leaks and Seams)
Your city buildings are likely made of modular parts (e.g., Wall A and Wall B placed side-by-side).

  • If Precision is low: The edge vertices of two adjacent walls are rounded differently, creating microscopic gaps between them.
  • Result: Sunlight leaks through these tiny cracks (Light Leaks), or you see flickering lines at the seams when viewing from a distance.

2. “Wobbly” (Distorted) Surfaces
Imagine a flat, razor-sharp metal surface or a glass skyscraper.

  • If Precision is low: While Nanite compresses the points, it slightly warps that perfectly flat surface.
  • Result: Reflections on the glass will look “wobbly” or distorted instead of perfectly straight.

Which Setting Should You Use?

In the Static Mesh Editor, under Nanite Settings -> Position Precision, you will find these options:

  • Auto (Default): Nanite decides based on the model’s size. This is sufficient for 90% of cases.
  • Int 16 / Int 24, etc.: These offer lower precision but take up less disk space.
    • Use Case: Rocks, tree trunks, ground debris. No one will notice if a rock’s surface shifts by 1mm.
  • Full Precision (Float): Does not apply quantization; it saves vertex positions exactly as they are.
    • Use Case: Buildings, cars, machinery. If you see tearing at the corners of your buildings or if modular pieces don’t “snap” perfectly, select this and click “Apply Changes.”

Summary

  • Precision = Coordinate Accuracy.
  • Keep it Low (Auto) for rocks and nature to save disk space.
  • Use High (Float) for sharp-edged buildings and modular walls to ensure visual perfection, even if it slightly increases file size.


Becoming a “Nanite expert” means more than just checking the “Enable Nanite” box; it means understanding the underlying architecture and knowing where the bottlenecks occur.

Based on your massive city project, here is a step-by-step roadmap to Nanite expertise:

1. Mindset Shift: “Screen Real Estate, Not Poly Count”

In the past, we asked, “How many polygons is this model?” A Nanite expert asks, “How much screen space does this model occupy?”

  • The Rule: Nanite excels at tiny triangles (those that scale down to pixel size).
  • The Mistake: Enabling Nanite for a perfectly flat, simple box or a basic wall can actually decrease performance. Nanite has its own fixed overhead (startup cost).
  • Expertise: Use Nanite only for geometrically complex objects (statues, detailed architectural ornaments, rocks, tree trunks). Use Standard Meshes for simple floors or basic cubes.

2. Managing the Ray Tracing Relationship (Fallback Mesh)

This is the most critical point for your project.

  • The Fact: Nanite is incredibly fast during Rasterization (drawing to the screen), but the engine cannot use Nanite data directly for Ray Tracing (lighting calculations). Instead, it uses a simplified copy created in the background called the “Fallback Mesh.”
  • Expertise:
    • Open the Static Mesh Editor.
    • Find Details -> Nanite Settings -> Fallback Relative Error.
    • Value of 0: The fallback mesh becomes a 100% identical copy of the original (Ray Tracing will crash or FPS will tank).
    • Value of 2 or 4: The fallback mesh becomes highly simplified. Ray Tracing performance will soar, though shadows might lose some fine detail.
  • Pro Tactic: By increasing this value for city buildings, you can boost Ray Tracing performance by up to 50%.

3. Learning to Read Debug Modes

A Nanite expert doesn’t just work in “Lit” mode; they utilize visualization modes. Go to the Viewport top-left: Lit -> Nanite Visualization -> Overview.

The colors you see tell a story:

  • Masked (Green): No errors, everything is running smoothly.
  • Overdraw (Bright Colors): This is vital. Nanite dislikes overlapping pixels. If you have too many leaves or grass planes stacked on top of each other, Nanite will struggle.
  • Triangles: Zoom in and out. Watch how the triangles resize. If the triangles don’t get smaller as you move away, that object’s settings are likely incorrect.

4. Disk Space and Optimization (Trim Relative Error)

Because Nanite stores high-poly models, your project size (GB on disk) can bloat significantly.

  • The Issue: A 100MB rock model runs fast in-game but fills up your hard drive.
  • Expertise: Use the Keep Triangle Percent or Trim Relative Error settings in the Static Mesh editor.
  • If you don’t need microscopic details (like tiny screws that won’t be seen), pull the Keep Triangle Percent down from 100% to 20%.
  • Result: Visual quality remains virtually identical, but the file size drops from 100MB to 20MB.

5. Material and WPO (Wind) Management

It used to be said that Nanite doesn’t work with wind-blown trees (World Position Offset). As of UE 5.1+, it does—but it comes at a price.

  • The Issue: Nanite trees swaying in the wind put a heavy load on the Vertex Shader.
  • Expertise:
    • Enable the “Preserve Area” setting for Nanite trees. This prevents leaves from disappearing entirely at a distance, which keeps the tree from looking like a “toothpick.”
    • If possible, use a distance mask in your material to disable WPO (wind) for trees far in the distance.

6. Virtual Shadow Maps (VSM)

If you are using Nanite, you should use Virtual Shadow Maps (VSM) as your shadow system.

  • Old-school “Cascaded Shadow Maps” (CSM) do not pair well with Nanite.
  • Ensure VSM is enabled in Project Settings. VSM functions like Nanite for shadows; it only calculates high-resolution shadows exactly where they are needed.

Summary Roadmap:

  1. Optimize Ray Tracing performance by tweaking Fallback Mesh settings.
  2. Identify Overdraw (stacked geometry) using Visualization Modes.
  3. Use Trim/Keep Percent settings to keep your file size manageable.
  4. Never enable Nanite for simple objects like basic cubes.