Commit Graph

68 Commits

Author SHA1 Message Date
halfdan ingvarsson
def40f8c58 Skeletal Mesh: When converting from import model to mesh description, don't ditch all normals/tangents even if some are broken. Instead, re-create the broken normals/tangents as needed.
#rb Alexis.Matte
#rnx

[CL 32009385 by halfdan ingvarsson in ue5-main branch]
2024-03-04 21:06:34 -05:00
steve robb
f029468598 Fixed up a lot of bool-taking container resize functions to take EAllowShrinking instead.
[CL 30729174 by steve robb in ue5-main branch]
2024-01-19 16:41:35 -05:00
jimmy andrews
9978bc0dc4 add option to StaticMeshOperations::TransformMesh to correctly transform the normals and tangents. Default to the current behavior, which instead matches UE renderer. Add comments explaining both paths.
#rb tyson.brochu

[CL 30044369 by jimmy andrews in ue5-main branch]
2023-12-01 12:15:31 -05:00
alexis matte
5005f43067 Interchange: Add the content base path to the ExecutePipeline API. We will need this data to be able to find existing material when we will implement the material workflow for asset import.
#jira UE-199573
#rb jeanluc.corenthin

[CL 29895499 by alexis matte in ue5-main branch]
2023-11-22 15:15:15 -05:00
sebastien lussier
0fdff1ee1f MergeActor - Improved UV generation of merged/simplified meshes
Currently controlled globally with the MeshMergeUtilities.UVGenerationMethod cvar
-> 0 - Engine default - (currently Patch Builder)
-> 1 - Legacy
-> 2 - UVAtlas
-> 3 - XAtlas
-> 4 - Patch Builder

#rb jeanfrancois.dube

[CL 29842440 by sebastien lussier in ue5-main branch]
2023-11-20 10:37:32 -05:00
alexis matte
0dec6f840f Downgrade NAN meshdescription log from Error to Display level.
#rnx

[CL 29535884 by alexis matte in ue5-main branch]
2023-11-07 17:26:02 -05:00
alexis matte
9bf35f960c Make sure importers do not allow nan or infinite float mesh data.
Also make sure the static mesh build fix those issue before building the mesh description.

#rb jeanluc.corenthin
#rnx

[CL 29314418 by alexis matte in ue5-main branch]
2023-11-01 09:26:52 -04:00
balazs toereki
ee7224490b NegativeScale automation test fixes (ApplyTransform/AppenMeshDescription fixes)
#jira UE-192416
#rb JeanLuc.Corenthin
#lockdown jeanmichel.dignard

[CL 27154712 by balazs toereki in ue5-main branch]
2023-08-16 17:03:55 -04:00
sebastien lussier
567b9098e9 FStaticMeshOperations::GenerateUniqueUVsForStaticMesh() - Fallback to AutoUV if UVs are invalid or missing
#rb patrick.enfedaque

[CL 26020789 by sebastien lussier in ue5-main branch]
2023-06-15 14:13: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