Commit Graph

160 Commits

Author SHA1 Message Date
rune stubbe
45018186fd Fix for Nanite builder not handling empty submeshes correctly. It now outputs a single node with no children, instead of duplicating a cluster.
FResources::NumClusters now reflects the number of clusters after trim, not before.
#rb brian.karis
[FYI] graham.wihlidal, jamie.hayes

[CL 27830347 by rune stubbe in ue5-main branch]
2023-09-13 10:24:12 -04:00
Brian Karis
a622f52036 Added LerpUVs property to Nanite static mesh settings.
Enabled by default. When disabled UVs are not lerped in the simplifier. This is useful when data stored in UVs isn't valid to interpolate, for example indexes.

Fixed long standing bug where locked boundary verts still would get attributes recalculated when taking part in an edge collapse. This results in them not matching when later merged with their neighbor, causing attribute discontinuities where they previously weren't. That will degrade further simplification, bloat vertex work, bloat vertex storage, and generally look worse.

Can reduce rendered vertex count by 14% and disk size by 3%.

#rb rune.stubbe, graham.wihlidal
#lockdown marc.audy

[CL 27715715 by Brian Karis in ue5-main branch]
2023-09-08 12:38:58 -04:00
rune stubbe
bccf39e9bc Implemented support for Nanite streaming pool larger than 2GB when it is supported by the hardware.
Fixed NANITE_SANITY_CHECK_STREAMING_REQUESTS path so it compiles again and reduced size of Magic to make room for wider page indices.
Changed independent coding of PageIndex and ClusterIndex in FVisibleCluster to a smaller combined encoding.
Added more descriptive error messages when running out of pool space.
#rb graham.wihlidal
[FYI] brian.karis, jamie.hayes

[CL 27504613 by rune stubbe in ue5-main branch]
2023-08-30 18:17:10 -04:00
charles bloom
7f52be25d7 fix checkSlow in NaniteEncode
#rb none
#rnx

[CL 27155328 by charles bloom in ue5-main branch]
2023-08-16 17:14:22 -04:00
marc audy
a75b48030b More compressible Nanite disk format (typically ~10% smaller after compression)
-Delta code vertex attributes and cluster refs
-ZigZag code deltas
-Store them as whole bytes
-Split high/mid/low bytes into separate streams

Transcode
-Transcode is now split into an independent pass and a number of dependent passes
-Launch a group per cluster instead of launching a group per potential cluster in a page and have them early out

Got rid of unused vertex color mode: NANITE_VERTEX_COLOR_MODE_WHITE
#rb brian.karis
[FYI] graham.wihlidal, jamie.hayes
#jira

[CL 27132972 by marc audy in ue5-main branch]
2023-08-16 00:39:49 -04:00
rune stubbe
494a9aa930 Fixed builder crash when mesh vertex position coordinates become extremely large.
Clusters already have a max range for position. An additional exponent bit has been added to the position encoding to cover that range.
Added sanity check to make sure the largest possible cluster bound can always be encoded with the current position encoding parameters.
#rb jamie.hayes
[FYI] brian.karis, graham.wihlidal

[CL 26630917 by rune stubbe in ue5-main branch]
2023-07-26 21:23:48 -04:00
rune stubbe
42ce2d4c33 Added debug define to Nanite builder to strip all Nanite data
#rb trivial
[FYI] brian.karis, graham.wihlidal, jamie.hayes

[CL 26552944 by rune stubbe in ue5-main branch]
2023-07-24 15:40:08 -04:00
rune stubbe
7070422ce9 Refactor to remove assumption about page disk size being 2x the gpu page size.
Disk pages sizes can now have arbitrary sizes, but are assumed to rarely be more than ~1.5x when reserving memory or sizing the upload staging buffer.
#rb ola.olsson
[FYI] brian.karis, graham.wihlidal, jamie.hayes

[CL 26534981 by rune stubbe in ue5-main branch]
2023-07-22 06:33:46 -04:00
rune stubbe
cf5df32446 Nanite streamer performance optimizations:
-Replaced slow doubly-linked list LRU with array based LRU
-Replaced hash tables for mapping virtual pages to physical pages with direct lookups (+2 dwords per virtual page)
-Removed custom hash table for fast request deduplication (FRequestsHashTable)
-Trimmed one dword from FPageStreamingState  (-1 dword per virtual page)
-Made a direct mapping from RuntimeResourceID to root page / FResource to avoid more expensive hashmap lookups
-Cache array of virtual page dependencies for resident pages to accelerate parent traversal
-Improved locality of assignment of groups to pages. Reduces streaming pool memory requirements by ~3-4%

Added Magic word to FFixupChunk to make it easier to identify corrupt data
#rb graham.wihlidal
[FYI] brian.karis, jamie.hayes

[CL 26080397 by rune stubbe in ue5-main branch]
2023-06-17 01:33:52 -04:00
jamie hayes
9d7b7daebe Fail the Nanite build when the input mesh has zero triangles to prevent crashes during build.
#rb graham.wihlidal
#preflight 645010f5401d328ad9c393c9

[CL 25289599 by jamie hayes in ue5-main branch]
2023-05-01 15:28:25 -04:00
Rune Stubbe
737c77422f Nanite support for explicit tangents
#jira UE-166732
#rb brian.karis
#fyi graham.wihlidal, jamie.hayes
#preflight 644f9d045403400548450480

[CL 25282711 by Rune Stubbe in ue5-main branch]
2023-05-01 07:48:12 -04:00
matthew amar
d642e17510 Remove magic number from NaniteBuilder code.
#preflight

[CL 25132376 by matthew amar in ue5-main branch]
2023-04-20 14:19:52 -04:00
bryan sefcik
6f4112baac [NaniteBuilder] Updated set UnsafeTypeCastWarningLevel to WarningLevel.Error and not WarningLevel.Warning. The use of WarningLevel.Warning makes separate shared PCHs.
#preflight 643742990c4277fc0be06617

[CL 25019431 by bryan sefcik in ue5-main branch]
2023-04-12 20:08:42 -04:00
Rune Stubbe
00de05e0e7 Enabled the warning UnsafeTypeCast for NaniteBuilder and fixed all the issues
Removed unused experimental code: ConstrainClusterGeodesic()
#jira UE-166467
#rb brian.karis
#fyi graham.wihlidal, jamie.hayes
#preflight 64366f66eb6cd0e63a5c2840

[CL 25003991 by Rune Stubbe in ue5-main branch]
2023-04-12 05:04:51 -04:00
tiago costa
0ba721ddf1 Fix merge error in NaniteBuilder.cpp
#preflight 642767fd486e7cce7de9025d
#rb none

[CL 24884483 by tiago costa in ue5-main branch]
2023-04-01 02:40:35 -04:00
marc audy
08c0dfc0a2 Fix uninitialized VertexBounds in NaniteDisplacedMesh and GeometryCollection code paths causing incorrect Nanite Meshes.
- Modified Nanite::IBuilderModule::FInputMeshData to take FBounds3f instead of FBoxSphereBounds since NaniteBuilder doesn't require sphere bounds.
- Calculate VertexBounds in DisplaceNaniteMesh(...) and BuildMeshDataFromGeometryCollection(...)

#rb rune.stubbe
#preflight 64258edb973e609670eb2ef0
#lockdown marc.audy

[CL 24884479 by marc audy in ue5-main branch]
2023-04-01 02:40:07 -04:00
nick edwards
442653b187 Uses of ::Sort/::StableSort replaced with Algo versions.
#preflight 6422f8d3710ec8400fc7471c
#jira none
#rb steve.robb

[CL 24818983 by nick edwards in ue5-main branch]
2023-03-28 10:56:46 -04:00
julien stjean
1dfaef15c0 Fixing an compilation error due to an api change.
#rb none
[FYI] Graham.Wihlidal
#preflight 641bbc4961213d974fc9d8dc

[CL 24758143 by julien stjean in ue5-main branch]
2023-03-23 00:01:26 -04:00
graham wihlidal
87c43b5bbe Additional merge fix
#preflight skip

[CL 24602827 by graham wihlidal in ue5-main branch]
2023-03-10 22:23:14 -05:00
graham wihlidal
d865a1b50c Robomerge and unity fixes
#preflight trivial

[CL 24602825 by graham wihlidal in ue5-main branch]
2023-03-10 22:23:03 -05:00
graham wihlidal
f92a4f5137 Fully de-interleaved attribute data during static mesh, Nanite, and geometry collection builds to save ~50% (on average) CPU memory across the board during SM builds.
#rb brian.karis
[FYI] yuriy.odonnell, danny.couture, rune.stubbe, ola.olsson
#preflight 640bb519af3fc35292eff3e6

[CL 24602822 by graham wihlidal in ue5-main branch]
2023-03-10 22:22:45 -05:00
juan canada
8c548cec82 Add check when the build process goes OOM and print better log info (error code and Graph->Num when PartGraphRecursive fails)
[REVIEW] [at]graham.wihlidal
#rb graham.wihlidal

#localization none
#tests graham.wihlidal, yuriy.odonnell

[CL 24517028 by juan canada in ue5-main branch]
2023-03-04 20:19:55 -05:00
Rune Stubbe
f2ed6c495f Added tracking of max hierarchy depth to streamer and use it to limit number of passes for non-persistent culling
Don't round up lock region to po2
#fyi brian.karis, graham.wihlidal
#preflight 63fdeb8df43e53f6817231a4

[CL 24440617 by Rune Stubbe in ue5-main branch]
2023-02-28 07:28:03 -05:00
tiago costa
3d3741df2b Prevent crash when trying to build Nanite Data for mesh with unsupported number of sections.
#preflight 63fd4163dd78dd50f6bee3d0
#rb graham.wihlidal, michael.balzer

[CL 24439073 by tiago costa in ue5-main branch]
2023-02-28 00:39:57 -05:00
brian karis
d1901ae146 Added Nanite static mesh setting: Fallback target.
This is an enum to say which target to reduce to for the fallback. It makes the default "Auto" which gives us more ability to change the default heuristic without needing to change uproperty defaults.

Along with this added r.Nanite.Builder.FallbackTriangleThreshold. Any mesh with source triangle count less than this threshold uses the source triangles directly for the fallback.

#rb graham.wihlidal
#lockdown marc.audy

#preflight 63f0041b1d71bcd26225228c

[CL 24330590 by brian karis in ue5-main branch]
2023-02-20 18:59:18 -05:00