Commit Graph

21 Commits

Author SHA1 Message Date
Rune Stubbe
1539f7895a Improved Nanite partitioning heuristics to produce fewer multi-material clusters
Locality links are now only added between elements with the same material
#rb brian.karis
#preflight 6290cee5dd2be751aeda4a71

[CL 20392408 by Rune Stubbe in ue5-main branch]
2022-05-27 09:30:52 -04:00
rune stubbe
8292810479 Fixed potential streamer crash by fixing the non-determinism issues in the Nanite builder.
Because of assumptions in the DDC system about cooking being deterministic, we could under various circumstances end up in a situations where StaticMesh and the associated Nanite streaming data was coming from two different cooks.
This could easily cause a crash as the StaticMesh chunk contains explicit page and offset references into the streaming data.

Determinism fixes:
-Added sorting step during initial clustering in the case where an edge is shared by more than 2 triangles.
-Added sorting step to sort parent clusters after they have been generated.
-Changed cluster GUID from 32bit to 64bit. When cooking CitySample there was one case where two clusters that were compared ended up with the same GUID, resulting in undefined order.
-Initialized GUID in the cluster constructor that takes a list of clusters to merge. Before it would just be 0.
-Added missing initialization of vertex color on fallback meshes that don't use vertex color.

#jira UE-146347
#rb brian.karis, michal.valient
#preflight 6238817789625f06129f616f

#ushell-cherrypick of 19458684 by Rune.Stubbe
#lockdown Marc.Audy

#ROBOMERGE-AUTHOR: rune.stubbe
#ROBOMERGE-SOURCE: CL 19467008 in //UE5/Release-Engine-Staging/...
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v935-19464907)

[CL 19468567 by rune stubbe in ue5-main branch]
2022-03-22 13:10:29 -04:00
brian karis
61e191c87d Fix for Nanite trim being set lower than fallback. Fallback mesh now can no longer exceed the Nanite mesh triangle count due to being trimmed.
#jira UE-144019
#rb rune.stubbe
#preflight 62215e19c57f5f14ed1c52d3

#ROBOMERGE-AUTHOR: brian.karis
#ROBOMERGE-SOURCE: CL 19259537 in //UE5/Release-5.0/... via CL 19260246
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v924-19243027)

[CL 19264033 by brian karis in ue5-main branch]
2022-03-04 04:24:53 -05:00
Brian Karis
dba24ab6be FDynamicBVH now supports a forest with a spatial hash at the highest level to support LWC without the need for doubles for bounding boxes.
Switched FDynamicBVH to use greedy insertion because branch and bound perf significantly degrades with heavily overlapped leaves.

Added closest point queries using branch and bound.

FBounds is now templated as TBounds.

#rb graham.wihlidal
#robomerge FNNC
#preflight 6216dbf9104496cff8abfc36

[CL 19107993 by Brian Karis in ue5-main branch]
2022-02-23 21:17:53 -05:00
charles bloom
0000d1324d ClusterDAG make noisy log Verbose
#rb none
#preflight none

[CL 19019520 by charles bloom in ue5-main branch]
2022-02-16 14:35:24 -05:00
charles bloom
67ef10a399 mark up most of the ParallelFors used in cook with named scopes for Insights
#rb arne.schober
#preflight none

[CL 18966875 by charles bloom in ue5-main branch]
2022-02-11 19:32:06 -05:00
brian karis
de6db094d8 Added KeepTrianglePercent and TrimRelativeError properties to Nanite static mesh settings.
These both trim detail from the Nanite data that is stored to disk and can be used to optimize disk size after import. Should be a super useful tool late in production.

#rb rune.stubbe
#lockdown michal.valient
#preflight 61fb25e6033a864b77e11ed6

#ROBOMERGE-AUTHOR: brian.karis
#ROBOMERGE-SOURCE: CL 18838594 in //UE5/Release-5.0/... via CL 18838602 via CL 18838937
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18838962 by brian karis in ue5-main branch]
2022-02-02 21:14:51 -05:00
brian karis
a208fbc50b Changed name on Nanite Proxy mesh to Nanite Fallback mesh.
Changed fallback settings to be largely error based with new property FallbackRelativeError.

Nanite builder will now provide the LOD fallbacks for all autogenerated LOD levels which is far faster than generating them from scratch.

#rb graham.wihlidal
#preflight 61f9e1fe9e4d23cd93b8d556

#ROBOMERGE-AUTHOR: brian.karis
#ROBOMERGE-SOURCE: CL 18820056 in //UE5/Release-5.0/... via CL 18820070 via CL 18822916
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18825066 by brian karis in ue5-main branch]
2022-02-02 08:19:56 -05:00
graham wihlidal
bac2a2b090 Moved all Nanite defines shared between C++ and shaders into a common header file, removing all the "keep this define in sync with this file" cases all over the code, and make the code a lot more maintainable. Common definitions now have a NANITE_ prefix to disambiguate global symbols
#rb rune.stubbe
#preflight 61f94f9ea6632a34f372dc39
[FYI] brian.karis, ola.olsson, jamie.hayes, andrew.lauritzen

#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 18808945 in //UE5/Release-5.0/... via CL 18809413 via CL 18822535
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18823295 by graham wihlidal in ue5-main branch]
2022-02-02 05:33:52 -05:00
brian karis
e838341c86 External edges now handle non-manifold meshes, ie multiple adjacency
Added Moore-Penrose pseudo inverse for solving singular quadrics. Disabled for now.

#rb rune.stubbe

#ROBOMERGE-AUTHOR: brian.karis
#ROBOMERGE-SOURCE: CL 18415437 in //UE5/Release-5.0/... via CL 18415438
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18415441 by brian karis in ue5-release-engine-test branch]
2021-12-08 20:32:07 -05:00
rune stubbe
8a9f900ed4 Converted most of Nanite back to float when running with LWC. Fixes various data corruption issues resulting in Nanite crashing with LWC.
#JIRA UE-115577
#rb ola.olsson
[FYI] graham.wihlidal, brian.karis

#ROBOMERGE-SOURCE: CL 16385988 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)

[CL 16386070 by rune stubbe in ue5-main branch]
2021-05-19 10:55:06 -04:00
Brian Karis
0fbcb3c544 Improved coarse mesh quality.
Now finds DAG cut with minimal error to hit target NumTris.

Fixed bad UVs affecting simplification. Not sure why this code was removed.

#rb rune.stubbe

[CL 15138015 by Brian Karis in ue5-main branch]
2021-01-19 14:46:57 -04:00
Rune Stubbe
2b3f001a3a Nanite culling performance improvements
Nanite builder:
-Parameterized hierarchy builder to support different fanouts
-Changed fanout from 64 to 8
-Removed old K-Means hierarchy builder and replaced it with a top-down splitting approach
-Changed hierarchy node bounds from spheres to AABBs
-Added some GraphViz debugging code to visualize the tree

Persistent culling shader:
-MPMC queue support for multiple inputs per wave
-Node culling now consumes multiple nodes
-Merged node culling and cluster culling shaders

Misc:
-Moved culling specific functions to Culling.ush
-Merged arrays for candidate clusters and nodes into one array to get under 8UAV limit. They already had same lifetime.

#rb brian.karis
#fyi graham.wihlidal

[CL 15032528 by Rune Stubbe in ue5-main branch]
2021-01-09 14:50:49 -04:00
Rune Stubbe
d833331db9 Compile fix for mac
#rb none

[CL 14828301 by Rune Stubbe in ue5-main branch]
2020-12-01 11:39:10 -04:00
Rune Stubbe
dc5e9cb018 Nanite support for geometry collection
The Nanite builder now accepts a set of meshes that will be built into a single resource with a hierarchy root for each input mesh.
Updated runtime code to use this feature for Geometry collection.
Each GC now takes up just a single root page.
Changed geometry collection serialization so Nanite data is now transient similar to how it is transient in RenderData for StaticMesh.
Added bogus serialization functions for parsing and throwing away the old Nanite data, so we don't crash when parsing old files.

#rb brian.karis, graham.wihlidal

[CL 14828108 by Rune Stubbe in ue5-main branch]
2020-12-01 11:18:19 -04:00
danny couture
6bfd85065f Make ParallelFor automatically pick the right scheduling priority to avoid low prio task interfering with the game and render threads causing huge stalls
- This dramatically improves editor framerate under high load
Cleanup all the hacks that are not needed anymore

#rb Andriy.Tylychko

[CL 14676999 by danny couture in ue5-main branch]
2020-11-06 11:20:53 -04:00
Brian Karis
4d5d61eb5a Imposters
Used for Nanite instances smaller than 6 pixels. Drawn directly from the instance culling pass. Significantly faster than sending down the normal cluster rasterization pipe.

#rb rune.stubbe
#fyi graham.wihlidal

[CL 14650618 by Brian Karis in ue5-main branch]
2020-11-04 02:02:36 -04:00
danny couture
024a5f6fea Preparation work for building multiple nanite mesh asynchronously
- Reduce game-thread stalls by scheduling worker thread's work on background threads to avoid interference.
   - Reduce peak memory usage duration when using coarse mesh representation by clearing the original mesh sooner.
   - Allow nanite mesh to be built from any thread

#rb Graham.Wihlidal, Brian.Karis

[CL 14608438 by danny couture in ue5-main branch]
2020-10-29 08:04:37 -04:00
Rune Stubbe
920ae1c8fe Added various serialization functions needed for intermediate Nanite DDC
#rb graham.wihlidal

[CL 14542721 by Rune Stubbe in ue5-main branch]
2020-10-22 03:30:32 -04:00
Rune Stubbe
d27d79bccc Cleanup related to two-sided LOD culling. Added comment about stuff we have to fix for it to work with streaming.
#rb none

[CL 14227100 by Rune Stubbe in ue5-main branch]
2020-09-01 08:50:48 -04:00
Brian Karis
66616e3693 Renamed Meshlet files to Cluster
#rb none

[CL 14223968 by Brian Karis in ue5-main branch]
2020-08-31 18:58:12 -04:00