126 Commits

Author SHA1 Message Date
jamie hayes
16ce5d4a78 Add an option for Nanite meshes to consider edge length during simplification as a means of preventing oversimplification of meshes that are intended to be deformed (e.g. via WPO, Spline Mesh Component).
#rb brian.karis

[CL 28594884 by jamie hayes in ue5-main branch]
2023-10-09 15:40:27 -04:00
jamie hayes
bdeb6ed96b Add a check to the mesh simplifier to avoid collapsing an edge if it is shared by all triangles, thus causing all triangles in the cluster to be degenerate
This fixes asserts that have been seen in the wild.

NOTE: This is a resubmission, with an additional fix to an assert the original change inadvertently caused.

#rb brian.karis
#jira UE-193405

[CL 28391367 by jamie hayes in ue5-main branch]
2023-10-02 15:58:57 -04:00
jamie hayes
a05a20507c [Backout] - CL28327793
[FYI] jamie.hayes
Original CL Desc
-----------------------------------------------------------------
Add a check to the mesh simplifier to avoid collapsing an edge if it is shared by all triangles, thus causing all triangles in the cluster to be degenerate.
This fixes asserts that have been seen in the wild.

#rb brian.karis
#jira UE-193405

[CL 28359965 by jamie hayes in ue5-main branch]
2023-09-29 18:55:04 -04:00
jamie hayes
e967254bcf Add a check to the mesh simplifier to avoid collapsing an edge if it is shared by all triangles, thus causing all triangles in the cluster to be degenerate.
This fixes asserts that have been seen in the wild.

#rb brian.karis
#jira UE-193405

[CL 28327825 by jamie hayes in ue5-main branch]
2023-09-28 16:30:49 -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
brian karis
e634ee40dc Fix mesh reduction bugs due to replacing TSimpVert with FLerpVert.
#rb rune.stubbe

[CL 26720922 by brian karis in ue5-main branch]
2023-07-31 17:02:36 -04:00
Brian Karis
449bf07ce4 Fixed bug where single edge collapse removes all remaining triangles.
Deleted old simplifier

#rb graham.wihlidal
#preflight 647910245d23eca37db298ee

[CL 25745236 by Brian Karis in ue5-main branch]
2023-06-01 17:55:09 -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
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
henrik karlsson
ce587eb612 Added markups for headers that can't be compiled standalone.. this is needed for both Header units and IWYU
#preflight 63789b0c170bc34a93a869e5
#rb none

[CL 23552160 by henrik karlsson in ue5-main branch]
2022-12-21 02:46:50 -05:00
christopher waters
12eed6b032 Fixing CIS, PF somehow missed these files.
[CL 23421611 by christopher waters in ue5-main branch]
2022-12-06 19:45:00 -05:00
alexis matte
4897d11583 Add Absolute criterion to staticmesh FMeshReductionSettings.
#rb brian.karis , jeanluc.corenthin , richard.talbotwatkin
#rnx
#preflight 638e35291776b8c21c32026b

[CL 23399365 by alexis matte in ue5-main branch]
2022-12-05 16:24:30 -05:00
henrik karlsson
b5164ac775 Fixes to make modules compile with IWYU. We've added to IWYU toolchain so it compiles "orphaned" headers which does not have a owning cpp file. This identified lots of headers that couldn't be compiled by themselves (or if they were to included first)
Change consist of only forward declaration and additional includes

#preflight 63789c1de30d438849c48188
#rb none

[CL 23218412 by henrik karlsson in ue5-main branch]
2022-11-21 03:22:23 -05:00
Brian Karis
1b845f1def Remove doubles from mesh processing
#rb graham.wihlidal
#preflight 633b662e842f0d4c55e4b3d9

[CL 22319966 by Brian Karis in ue5-main branch]
2022-10-03 19:39:31 -04:00
rune stubbe
dd0456959b Added nullptr check for File in FMeshSimplifier::DumpOBJ to make PVS studio happy (Issue: 219027)
[FYI] brian.karis, graham.wihlidal

[CL 22271649 by rune stubbe in ue5-main branch]
2022-09-30 11:32:18 -04:00
rune stubbe
698250487a Fixed compile errors in MeshSimplify.cpp
-Linux doesn't compile because fopen_s is not a standard function
-Missing include for Math/RandomStream.h

#preflight skip
[FYI] juan.canada, brian.karis, graham.wihlidal

[CL 22260785 by rune stubbe in ue5-main branch]
2022-09-29 20:32:27 -04:00
graham wihlidal
561e36e5c7 Nanite: Added "Preserve Area" checkbox to correct leaves disappearing on trees.
This aims to preserve the surface area during simplification. If area is lost, open boundary edges of the mesh are dilated to compensate. This is useful for foliage that tends to thin out in the distance if not enabled.

Also include misc fixes:
Collapses that completely remove disjoint triangles have an error of the area of what was removed.
Would not alias 0 and -0 verts due to binary comparison.

#rb graham.wihlidal
#preflight 63349e32141f314ed601978d

#ushell-cherrypick of 22229630 by Brian.Karis
#preflight 6334c401f418a1071a35b4a4

[CL 22260505 by graham wihlidal in ue5-main branch]
2022-09-29 20:24:18 -04:00
bryan sefcik
a3dddc6630 Pass 1 on Developer include fixes:
Removed redundant private include paths from build.cs files.
Fixed include paths to be relative to the private or public folders.
Hid or removed includes that reached into other private module folders.
Updated PublicInclude paths when necessary.

#jira
#preflight 631e281694758d0bf2ea1399

[CL 21960082 by bryan sefcik in ue5-main branch]
2022-09-11 18:32:18 -04:00
Richard TalbotWatkin
71be494d68 Fix for overflow error when simplifying large meshes.
#review-21293208 Brian.Karis
#preflight 6307897f37470da4bf38eb61

[CL 21564235 by Richard TalbotWatkin in ue5-main branch]
2022-08-25 10:46:43 -04:00
jian ru
cc6f857cb8 Re-enable the new static mesh simplifier
#rb brian.karis
#tests a/b tested on multiple platforms to make sure no perf or memory regression; sanity checked several static meshes to make sure auto calculated screensizes stayed similar

#ROBOMERGE-AUTHOR: jian.ru
#ROBOMERGE-SOURCE: CL 21045756 via CL 21045905 via CL 21045943
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v972-20964824)

[CL 21075377 by jian ru in ue5-main branch]
2022-07-13 13:53:24 -04:00
brian karis
0d8b010e12 Nanite displaced mesh. Added uniform tessellation and displacement.
#rb graham.wihlidal
#preflight 62901dcd74630984fd6763b1

#ROBOMERGE-AUTHOR: brian.karis
#ROBOMERGE-SOURCE: CL 20400905 via CL 20400917 via CL 20400925
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20402444 by brian karis in ue5-main branch]
2022-05-27 20:42:29 -04:00
Brian Karis
79bab683d3 Add spring quadrics
#rb none
#preflight

[CL 19841678 by Brian Karis in ue5-main branch]
2022-04-20 19:40:11 -04:00
brian karis
dc4771ff54 Allow auto screen size for LODs to be over 1. This is required for high poly meshes where simplifying causes only a small deviation.
Change mesh simplifier settings to match closer to what they used to be to prevent large changes in LOD distances from ue4 to ue5.

#rb michal.valient
#jira UE-144622
#preflight 622bf219902b7ca699eb7c53

#ROBOMERGE-AUTHOR: brian.karis
#ROBOMERGE-SOURCE: CL 19378057 in //UE5/Release-5.0/... via CL 19379381
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19379859 by brian karis in ue5-main branch]
2022-03-14 18:40:56 -04:00
fred kimberley
7fbfaf57c8 Require explicit constructors/casts when converting between FVector, FVector3d, and FVector3f.
#jira UE-122078
#rb Andrew.Davidson, Colin.McGinley
#preflight standard build

#ROBOMERGE-AUTHOR: fred.kimberley
#ROBOMERGE-SOURCE: CL 18817999 in //UE5/Release-5.0/... via CL 18818012 via CL 18822871
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v910-18824042)

[CL 18824721 by fred kimberley in ue5-main branch]
2022-02-02 07:59:31 -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