When an embree call fails because it runs out of memory, we don't currently do much except locally return. As evidenced in UEFN cooks, this leaves the cook in an uncertain state that will fail later and isn't properly reported as a memory issue. We can instead invoke the existing codepath for reporting out-of-memory issues (which will also stop the process).
#rb Laura.Hermanns
[CL 33857109 by sebastian schoner in ue5-main branch]
BuildSkeletalMeshChunks is used during cooking when saving skeletal meshes (calls originate from USkeletalMesh::BuildLODModel, see linked jira ticket for full callstacks) and deduplicates overlapping vertices. In contrast to many other places in the engine, it is using a multimap instead of the FOverlappingCorners type. Using a multimap is technically more correct since "points overlap each other" is not an equivalence relation (it is not transitive, i.e. "A overlaps B" and "B overlaps C" but "A does not overlap C" is possible). FOverlappingCorners pretends that transitivity is given, because that is pretty much always true. Note also that there is another check later on for whether two vertices within the same cluster actually overlap.
In especially degenerate cases this can save a lot of memory because we only store each group of overlapping vertices once (instead of having a copy for every vertex in that group). With user content in UEFN, it is unfortunately very much possible to hit these degenerate cases, allocate gigabytes of memory, and have the cooking process terminate with an OOM error.
This CL changes this codepath to use FOverlappingCorners instead. The memory savings and time savings are significant, find a comparison here https://docs.google.com/document/d/1qHnY_6WXpcEmJL_61myQDczxG6XDZRuVUCE8yQ-FkDs/edit?usp=sharing
#rb alexis.matte, laura.hermanns
[CL 31119331 by sebastian schoner in ue5-main branch]
If hit lighting and refraction is not enabled, translucent meshes will be skipped, and translucent cards part of composed meshes won't be won't be dispatched.
#rb Krzysztof.Narkowicz
[CL 29507890 by sebastien hillaire in ue5-main branch]
- Adds an option to not merge skeletal mesh sections sharing the same material during FBX import. This allows you to control visibility at a per-section level without having to give each section a unique material. [Github Pull Request: 9587]
#jira UE-164863
#rb Alexis.Matte, JeanLuc.Corenthin
[CL 26757306 by Brice Criswell in ue5-main branch]
Only leaving CL 26157603 reverted since accessing GenerateSource in FDistanceFieldVolumeData::CacheDerivedData is not safe due to async mesh compilation.
#prelight 64948190a26e02126bc0a64f
#rb Krzysztof.Narkowicz
[CL 26206875 by tiago costa in ue5-main branch]
[FYI] tiago.costa
Original CL Desc
-----------------------------------------------------------------
Use FSignedDistanceFieldBuildSectionData when generating distance fields for Nanite meshes.
Context:
- Nanite meshes distance fields are generated using the original mesh data instead of the coarse representation generated by Nanite, however that code path was not checking section data such as blend mode, two sided, etc.
Fix:
- Modified FStaticMeshBuilder::BuildMeshVertexPositions(...) to also output a FStaticMeshSectionArray.
- Updated MeshRepresentation::SetupEmbreeScene(...) to check section flags when using SourceMeshData.IsValid() code path.
#prelight
#rb Krzysztof.Narkowicz
[CL 26174853 by bob tellez in ue5-main branch]
Context:
- Nanite meshes distance fields are generated using the original mesh data instead of the coarse representation generated by Nanite, however that code path was not checking section data such as blend mode, two sided, etc.
Fix:
- Modified FStaticMeshBuilder::BuildMeshVertexPositions(...) to also output a FStaticMeshSectionArray.
- Updated MeshRepresentation::SetupEmbreeScene(...) to check section flags when using SourceMeshData.IsValid() code path.
#prelight
#rb Krzysztof.Narkowicz
[CL 26160411 by tiago costa in ue5-main branch]
- Different mesh sections can point to the same material slot which was a problem since bAffectDistanceFieldLighting flag can be set per section but we were using an array with an entry per material slot instead of per section.
- To address this now we build array of FSignedDistanceFieldBuildSectionData (one entry per section) so section don't override each other.
#prelight 64921d9ab76bf403cda2f33f
#rb daniel.wright
[CL 26137888 by tiago costa in ue5-main branch]