The Nanite Revolution
Traditional rendering treats every 3D object as a collection of triangles. For each triangle, it performs performance-heavy calculations to transform points (vertices) from the object's local space to what you see on your screen (rasterization). Finally, for each pixel covered by the triangle, it calculates lighting based on factors like light sources and material properties, leading to slowdowns with meshes that have a high triangle count.
Nanite employs a smarter approach. In preparation, it analyzes the entire mesh and creates a hierarchical structure with different levels of detail. Combined with very precise culling, Nanite represents complex objects efficiently, skipping the per-triangle calculations for most of the scene. During runtime, it prioritizes high-detail versions of the mesh only where needed (close to the camera), while utilizing lower-detail versions for distant objects.
Beyond geometry calculation, Nanite extends to the entire pipeline, especially when combined with Lumen and Virtual Shadow Maps.
Efficiency with a Trade-Off
Nanite's initial release supported only static meshes, but Epic has been progressively expanding its capabilities to include features commonly used in world creation workflows.
Solved Features:
- Masked Material Support:
Initially incompatible due to complexities with transparency, masked materials and pixel depth offset received significant improvements in Unreal Engine 5.1 and were fully integrated by version 5.3. These improvements include enhancements to the vertex cache, which boosted speeds by up to 20%. Nanite can now be used for masked materials such as foliage, with a reduced overdraw hit, thanks to more accurate visualization.
- Foliage Workflow:
Nanite's strength lies in detailed meshes and Geometry-based foliage is favored for performance, but can appear thin at distance. Unreal Engine 5.3's "Preserve Area" for foliage meshes (trees, grass) fixes this by redistributing lost area during simplification but results in a higher Nanite compression footprint on the disk.
PCG can help to distribute leaves on a tree which uses a very small disc footprint and leverage point data information to distribute leaves on Trees. Leveraging world partitioning to disable Nanite at certain distances and swapping instanced meshes with an HLoD billboard can effectively manage long-distance views of foliage.
- World Position Offset (WPO):
initially not supported vertex deformations like WPO, commonly used for dynamic effects such as wind or the wobble seen in Fortnite. Unreal Engine 5.1 introduced Evaluate World Position Offset alongside the optimization r.OptimizedWPO. This setting activates WPO only when needed, reducing unnecessary computations. Nevertheless, WPO comes with an additional cost for Virtual Shadow Maps and due to lack of Vertex Paint possibilities it has less importance.
- Epic has relied more on Vertex Animation Textures instead of WPO to optimize the wind effects of trees in Fortnite. VATs encode motion data into textures, decreasing the computational overhead with real-time vertex deformations and explicit tangents in the data format and runtime.
- Explicit Tangents:
With 5.3 Nanite supports explicit tangents. Previously, Nanite utilized an implicit tangent space derived from material properties, which was efficient but often imprecise for low-poly models. To improve accuracy, users can now store and use original model tangents on a per-asset basis. This update ensures better rendering quality for specific cases but results in a modest 10% increase in memory and disk footprint per asset.
- Landscape Support:
In 5.3 Nanite can now be enabled in Landscape Actors. Nanite Landscape does not improve Landscape resolution (experimental Tessellation) , but it allows to leverage GPU culling, automatic geometry streaming, and LODs, and it generally boosts runtime performance, especially for demanding features such as VSM.- With 5.4, the landscape rebuild operation for Nanite is automated and processed asynchronously, maintaining editor responsiveness; for larger and GPU-intensive landscapes, adjust the parallel build capacity using landscape.Nanite.MaxSimultaneousMultithreadBuilds VALUE.
Experimental & upcoming Features:
- Nanite Spline Meshes - r.Nanite.AllowSplineMeshes:
Spline Mesh experimental was added in and supports deformable Geometry along spline paths, useful for creating dynamic roads and set-dressing Tools . Enabling this feature currently comes with a performance cost that affects culling performance of all Nanite Meshes in the Scene. 5.4 Updates are adressing this Issue.
For now Spline Meshes can be baked to normal meshes for the final build.
- Nanite Tessellation & Displacement - r.naniteAllowTessellation:
5.4 Introduced Tessellation which enables dynamic mesh modification even at runtime using displacement maps, procedural & animated materials. Unlike World Position Offset, Nanite displacement adapts in real-time, tessellating the mesh to match the level of detail dictated by displacement maps. The resolution can be controlled with r.Nanite.DicingRate. This supports less complex initial meshes, animated displacements, and the creation of highly detailed landscapes with complex height details but comes with a cost of being not pre processed.
- Skeletal Mesh Integration - r.NaniteallowSkinnedMesh:
Currently, Nanite's integration with skeletal meshes is restricted to attaching static meshes to bone sockets, allowing armor and accessories to sync with skeletal animations but without full skinned/bendable capabilities.
However, the latest Branch update (5.5) introduces r.NaniteallowSkinnedMesh, which significantly increases frame rates from 15-30 FPS to 45-60 FPS with 500 skinned meshes in scenes showcased, highlighting the potential for future comprehensive integration of Nanite with fully skinned meshes.
- Compute-Based Shading:
Nanite Compute-Based Shading is a long-term project focused on moving Nanite materials from traditional raster shading to compute shaders for a number of optimization and new-feature opportunities. This transition aims to clean up a lot of complex code required for the raster approach, fully replace the pixel shader path, offer increased performance on both CPU and GPU, improve code maintainability, and enable the implementation of advanced Nanite material functionality that would not be otherwise possible.
The Missing Piece: Vertex Painting
Nanite significantly enhances rendering capabilities and brings back many traditional workflows, yet it still falls short in supporting a crucial technique: Vertex Painting. Traditionally, this method assigns color data to every vertex, offering three gradient maps (RGB) on the mesh data at no extra cost. Vertex Painting is widely used for various purposes, including stylized low-poly effects, baked shadowmaps, VFX, and material blending.
While vertex painting for VFX isn't problematic, as it's not intended for rendering in Nanite, the technique is crucial for blending material layers in environments to break up tiling and add weathering and damage effects.
To overcome this limitation, I've developed a new setup that offers an approach to achieving the effects of traditional environmental vertex painting, compatible with Nanite's architecture, which I will detail in my upcoming blog post.
Videos and Images ©Epic Games / JSFILMS / tharlevfx / Peyton Varney
Add comment
Comments