61 Commits

Author SHA1 Message Date
Balazs Toereki
f092cd8d46 NegativeScale automation test fixes (ApplyTransform/AppenMeshDescription fixes)
#jira UE-192416
#rb JeanLuc.Corenthin
#lockdown jeanmichel.dignard

[CL 27154237 by Balazs Toereki in 5.3 branch]
2023-08-16 16:54:41 -04:00
sebastien lussier
1e95527508 FStaticMeshOperations::GenerateUniqueUVsForStaticMesh() - Fallback to AutoUV if UVs are invalid or missing
#rb patrick.enfedaque

[CL 26039778 by sebastien lussier in 5.3 branch]
2023-06-16 03:31:53 -04:00
Balazs Toereki
93e707a911 FStaticMeshOperations::ApplyTransform fix for Normals and Tangents.
#jira UE-185575 UE-185659
#preflight 646c1b23656436839e44f135
#rb Richard.TalbotWatkin JeanLuc.Corenthin

[CL 25726708 by Balazs Toereki in ue5-main branch]
2023-06-01 10:46:45 -04:00
alexis matte
29b9ffe122 Fix crash when importing a nanite hi res that have unmatched material names
#rb richard.talbotwatkin
#preflight 64623407d1563ab43c49c4de
#rnx

[CL 25475797 by alexis matte in ue5-main branch]
2023-05-15 12:50:52 -04:00
Steve Robb
0f44db07d5 Replaced some container operator new usage.
#rb james.hopkin
#jira none
#preflight 6459670f28155a0f41565a34

[CL 25384456 by Steve Robb in ue5-main branch]
2023-05-09 05:17:49 -04:00
alexis matte
e43b81ce13 Ensure the nanite hires meshdescription materials are in the same order has the LOD 0 meshdescription materials. We use the imported material name to reorder them properly.
- If there is some material that do not find a match, those materials will stay in the imported order. The import will output a log message saying the material names do not match.
- If there is less material in the hires mesh description, the import will create empty section in the hires mesh to ensure the order of the materials. No log message will be output in that case.
-If there is more material in the hires mesh description, the import will transfer extra material section triangle to the first valid hires material section data (i.e. this should be matching the LOD 0 first material section)

We do this reorder when we import a hires nanite mesh and also if we have already a hires mesh description and we re-import the LOD 0 base mesh. This ensure we always have the hires meshdescription materials in the same order of the LOD 0.

#jira UE-179144
#rb jeanluc.corenthin
#rnx
#preflight 6426fd09c463fac9c8833dcd

[CL 24876565 by alexis matte in ue5-main branch]
2023-03-31 15:18:03 -04:00
graham wihlidal
1aec7d15e9 Significant DDC memory and perfomance optimizations to Nanite landscape mesh builds (and some general optimizations to all Nanite mesh builds). In some content cooks with extremely dense Nanite landscape mesh where the process memory well exceeded ~22gb, this brings it down to ~13gb, along with faster processing times.
Highlights:

 * Only allocate and use a wedge map for non-Nanite LODs, or if the mesh is sub 300kindices and it will be cache optimized
 * Only allocate and use a remap if there are no overlapping corners
 * When the Nanite landscape mesh is created, we now ensure the mesh description is fully compacted, computed, and optimized prior to committing it, along with making sure there are no overlapping corners.
 * Since Nanite landscape is checked to ensure no overlapping corners before the build, we can also now skip computing the overlapping corners, which was an intense number of tiny allocations.
 * When Nanite landscape is being built as a static mesh, we now avoid super expensive temporary copies of the mesh description, knowing that no actual mutation will occur.
 * The original code (after building) would release the memory from the mesh description copy, but it would not release the original immutable cached copy from memory (now that is released too)
 * Fixed NaniteLODIndex incorrectly creating a mesh description at a LOD other than the expected 0
 * Removed a full loop over all vertex positions by calculating the bounding box while we're building the vertex buffer (and already processing every vertex)
 * Added a NeedsCompact() helper to MeshDescription to avoid expensive and unnecessary Compact() calls that do lots of reallocs/copies even if the mesh description is already contiguous\packed in memory.
 * Skip building distance field and mesh card representations for the Nanite landscape mesh, which also avoids more cached mesh description deserialization and copies into memory.

Note: In the near future the APIs around this wil be cleaned up further.

#rb richard.talbotwatkin, yuriy.odonnell
[FYI] zousar.shaker, brian.karis, rune.stubbe, juan.canada, danny.couture
#preflight 640b7390482188d710464d39

[CL 24601442 by graham wihlidal in ue5-main branch]
2023-03-10 20:03:17 -05:00
alexis matte
d4384565b8 Interchange: Fix importing multi uv channel that was importing only the first UV channel.
#jira UE-178100
#rb jeanluc.corenthin , richard.talbotwatkin
#preflight 63fe0fb8437ce3e7f38e1d86
#rnx

[CL 24444884 by alexis matte in ue5-main branch]
2023-02-28 12:13:16 -05:00
david lesage
edf8d3086f #jira UE-178104: Fix tangent calculation
Rollback cl 21484193.
In CL 21484193, DPosition1 and DPosition2 were normalized to avoid a null normal in case of very small triangle. This was done without taking care of the computation of the tangent and binormal.
Tangent and binormal have to be aligned on the UV map.
Normalizing DPosition1 and DPosition2 breaks the relationship between the dimensions and the UV of a triangle. The calculation of the tangent is therefore false.
The use of a square threshold is sufficient to avoid null normal (CL 21484193).
#preflight 63fd0c4c60163ed3c25261ce
#rb jeanluc.corenthin
[FYI] MarcAndre.Lalonde

[CL 24432682 by david lesage in ue5-main branch]
2023-02-27 16:41:38 -05:00
sebastien lussier
13a8673507 Merge Actor - Mesh merging: Fix incorrect handling of components with non uniform scaling in FMeshMergeHelpers::ExpandInstances()
* Use FMatrix as the conversion to FTransform can't handle non uniform scaling

#rb patrick.enfedaque
#preflight 63f7bb45dd78dd50f60568bb
#tests built HLOD for Asteria, no more floating pieces (a few neon signs were using ISMCs with non-uniform scaling)

[CL 24397797 by sebastien lussier in ue5-main branch]
2023-02-24 03:57:37 -05:00
dan thompson
ee896287b8 Warn when building a static mesh that has NaNs in it.
#rb charles.bloom
#preflight 63e6a891c23d1f29a3fbb411

[CL 24137697 by dan thompson in ue5-main branch]
2023-02-11 12:51:08 -05:00
danny couture
5133f8ab33 Add Insights scope on GetUniqueVertexCount
#rnx
#rb Alexis.Matte
#preflight skip

[CL 23810183 by danny couture in ue5-main branch]
2023-01-23 08:43:42 -05:00
alexis matte
c4765e5da4 Do not cache the MeshDescription triangles/vertices count when we load the mesh description. Setting the cache when building the renderdata is good enough and it can use the already computed "FOverlappingCorners".
#jira UE-172554
#rb danny.couture
#rnx
#preflight 639772422540a78d27c8813f

[CL 23499862 by alexis matte in ue5-main branch]
2022-12-13 18:17:40 -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
sebastien lussier
1e1c474aa2 Material Baking - General fix for degenerate UVs
* When packing UVs, avoid relying on the UV area to scale triangles in the UV map. Instead, use the edges length (perimeter)

[CL 23130087 by sebastien lussier in ue5-main branch]
2022-11-14 19:07:13 -05:00
sebastien lussier
da5c347828 World Partition - HLOD: Use lower threshold to detect degenerate triangles in order to avoid false positive (UE_SMALL_NUMBER vs UE_KINDA_SMALL_NUMBER)
#rb trivial

[CL 23003735 by sebastien lussier in ue5-main branch]
2022-11-05 22:58:24 -04:00
sebastien lussier
b19a7d66de World Partition - HLOD: Improvements to FUniqueUVMeshDescriptionView
* Reduce artifacts from wrong input by filtering out degenerate triangles
#rb patrick.enfedaque

[CL 22977801 by sebastien lussier in ue5-main branch]
2022-11-04 00:01:58 -04:00
graeme thornton
e7986ac620 [Backout] - CL22808749
[FYI] Steve.Robb
Original CL Desc
-----------------------------------------------------------------
TMap and TSet can now be declared as members with forward-declared key and value parameters.
KeyFuncs::KeyInitType and KeyFuncs::ElementInitType typedefs are no longer used and user-defined KeyFuncs do not need to provide them.  Deprecated placeholders for these typedefs exist though they may not be defined exactly as they were before.  A new KeyType typedef needs to be provided by custom KeyFuncs which don't already inherit from BaseKeyFuncs or TDefaultMapKeyFuncs.
KeyConstPointerType, KeyInitType, ValueInitType and ElementInitType typedefs have been deprecated across TMap, TSet and TSortedMap.  Regular C++ parameter-passing semantics should be used instead (const T& Ref or T Value, depending on T).
Added missing FSetElementId::operator!=().

[FYI] steve.robb
#rb james.hopkin
[FYI] henrik.karlsson
#preflight 635a56c15d49a96f7b31938f

[CL 22850782 by graeme thornton in ue5-main branch]
2022-10-29 02:59:59 -04:00
steve robb
e980405a8f TMap and TSet can now be declared as members with forward-declared key and value parameters.
KeyFuncs::KeyInitType and KeyFuncs::ElementInitType typedefs are no longer used and user-defined KeyFuncs do not need to provide them.  Deprecated placeholders for these typedefs exist though they may not be defined exactly as they were before.  A new KeyType typedef needs to be provided by custom KeyFuncs which don't already inherit from BaseKeyFuncs or TDefaultMapKeyFuncs.
KeyConstPointerType, KeyInitType, ValueInitType and ElementInitType typedefs have been deprecated across TMap, TSet and TSortedMap.  Regular C++ parameter-passing semantics should be used instead (const T& Ref or T Value, depending on T).
Added missing FSetElementId::operator!=().

#rb james.hopkin
[FYI] henrik.karlsson
#preflight 635a56c15d49a96f7b31938f

[CL 22810695 by steve robb in ue5-main branch]
2022-10-27 11:20:32 -04:00
sebastien lussier
021d7f4530 World Partition - HLOD: Fix copy paste bug prevent the use of a lower resolution for UV packing in FStaticMeshOperations::GenerateUniqueUVsForStaticMesh()
#rb trivial
#preflight trivial

[CL 22505432 by sebastien lussier in ue5-main branch]
2022-10-13 11:33:48 -04: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
sebastien lussier
7741cc8b89 World Partition - HLOD: Prevent most common case of UV generation failure
#preflight 632856f9cb23fcbbd8d2c629
#rb jeanfrancois.dube

[CL 22084769 by sebastien lussier in ue5-main branch]
2022-09-19 19:53:44 -04:00
David Lesage
946193d09b StaticMeshOperation: Improve triangle normal computing in case of small triangle
#preflight 630397da33729407e88f7a5b

[CL 21484193 by David Lesage in ue5-main branch]
2022-08-22 11:16:01 -04:00
Zak Middleton
80627edb67 #ue5 - Move ConvertArrayType and ConvertArrayTypeClampMax to UE::LWC namespace.
#jira none
#rb none
#preflight 62fc03232265303c4ba38780

[CL 21414621 by Zak Middleton in ue5-main branch]
2022-08-16 17:11:27 -04:00
charles bloom
38b1d2e51f Mark up more ParallelFor scopes for Insights
#rb none
#preflight 6216cd82647bb7debf703367

[CL 19105606 by charles bloom in ue5-main branch]
2022-02-23 19:25:03 -05:00