Commit Graph

16 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
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
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
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
Marc Audy
0c3be2b6ad Merge Release-Engine-Staging to Test @ CL# 18240298
[CL 18241953 by Marc Audy in ue5-release-engine-test branch]
2021-11-18 14:37:34 -05:00
krzysztof narkowicz
74eafb9f84 Replace Nanite coarse proxy mesh constant min number of vertices with a target simplification error and range. This allows it to allocate more triangles towards complex meshes and less towards simple ones, greatly improving complex proxy quality without changing memory budget.
p_construct_wp
Old memory:
410.136MB BLAS
351.786MB StaticMesh Index Memory
290.267MB - StaticMesh Vertex Memory

New memory:
391.319MB  BLAS
357.895MB  StaticMesh Index Memory
291.738MB  StaticMesh Vertex Memory

Coarse mesh build times ~0.19s vs ~0.26s

#rb Brian.Karis
[FYI] Kenzo.Terelst
#preflight 610deeb40ccb8400012b505c

#ROBOMERGE-SOURCE: CL 17094507 via CL 17095865
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230)

[CL 17095951 by krzysztof narkowicz in ue5-release-engine-test branch]
2021-08-07 15:49:52 -04:00
rune stubbe
c25049a041 Progress on Nanite compression. ~19% on AncientGame.
Pages can now refererence data from the parent page.
Page transcoding is now batched based on page dependencies.
Removed Nanite's LZ container for platforms that don't have hardware LZ. Rely on iostore compression instead. ~4% disk saving. 32mb system memory saving from temp buffer.
Better integer-based UV quantization code similar to new position quantization.
Got rid of remaining old position quantization code.
Reduced float4s per cluster from 8 to 6. ~2% memory density.
Added BitStreamReader support for reading from UAV. Needed to reference parent data.
#rb graham.wihlidal
[FYI] brian.karis

#ROBOMERGE-SOURCE: CL 16621364 via CL 16621388
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v830-16605563)

[CL 16621402 by rune stubbe in ue5-release-engine-test branch]
2021-06-10 08:09:50 -04:00
brian karis
12e43285f4 Changed UV error weights to be UV area normalized. This makes the most sense to me for how to see UV error as texel error in screen space. Although I feel it is theoretically better this doesn't appear to have any noticable impact, likely because UV error has so far been set vanishingly low.
UV mirror seams are now considered an attribute discontinuity. This is handled through a cheap trick of changing the tops bits of the material index per triangle.

This should not strictly be necessary because the QEM could account for the difference but to get it to properly catch issues in practice required increasing the UV error weight high enough that it impacts all meshes including ones that didn't have noticable issues. Targeting the mirror case specifically was better even though it shouldn't be special theoretically.

This fixes Nanite UV bugs in Frosty.
#jira UE-113150

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

[CL 16412628 by brian karis in ue5-main branch]
2021-05-20 19:38:09 -04: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
Andrew Davidson
3ddc3a4da3 Merge up from //UE5/Dev-LargeWorldCoordinates
#rb none

[CL 16211417 by Andrew Davidson in ue5-main branch]
2021-05-05 15:07:25 -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
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
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
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
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