Commit Graph

46 Commits

Author SHA1 Message Date
jimmy andrews
d7478591bb new combine mesh interfaces:
+ separate creation of per-part meshes, so per-part approximations can be shared across multiple combine mesh calls
+ split out per-LOD settings of combined meshes to allow more flexbile control of the meshes

#rb David.Hill, Shaun.Kime, benoit.deschenes

#ushell-cherrypick of 35728191 by Jimmy.Andrews

[CL 35934103 by jimmy andrews in ue5-main branch]
2024-08-30 15:13:20 -04:00
jimmy andrews
acdb77e3c3 [Backout] - CL35728191
[FYI] Jimmy.Andrews
will redo in other stream
Original CL Desc
-----------------------------------------------------------------
new combine mesh interfaces:
+ separate creation of per-part meshes, so per-part approximations can be shared across multiple combine mesh calls
+ split out per-LOD settings of combined meshes to allow more flexbile control of the meshes

#rb David.Hill, Shaun.Kime

[CL 35868104 by jimmy andrews in ue5-main branch]
2024-08-28 11:03:06 -04:00
jimmy andrews
94176c551b new combine mesh interfaces:
+ separate creation of per-part meshes, so per-part approximations can be shared across multiple combine mesh calls
+ split out per-LOD settings of combined meshes to allow more flexbile control of the meshes

#rb David.Hill, Shaun.Kime

[CL 35728199 by jimmy andrews in ue5-main branch]
2024-08-21 19:55:16 -04:00
sebastien lussier
266ea40bff World Partition - HLOD: Avoid the creation of reverse index buffers when building HLODs
* Reversed index buffers are used to handle negative scaling transforms. Since HLOD meshes will never be used with such transforms, we can get rid of these buffers and reduce memory usage.
#jira UE-216169
#rb JeanFrancois.Dube

[CL 34065502 by sebastien lussier in ue5-main branch]
2024-06-03 10:23:45 -04:00
sebastien lussier
1b5e4ed92f Approximate Actors - Properly handle custom textures sizes options
#rb JeanFrancois.Dube

[CL 30082126 by sebastien lussier in ue5-main branch]
2023-12-04 10:41:21 -05:00
benoit deschenes
a643c768a8 [Atom - GeometryProcessing] Adding a FilterLODLevel option to FBaseMeshInstance for completely culling meshes past a certain LOD level.
The FOptions::FilterDecorativePartsLODLevel is too broad and doesn't allow to only remove certain instances of meshes on a specific LOD i.e:. Some meshes can be optimized by replacing multiple mesh instances on lower LOD with a single custom mesh (Atom fake underside optimization).

#jira UE-200222
#rb Ryan.Schmidt

[CL 29689640 by benoit deschenes in ue5-main branch]
2023-11-13 13:43:56 -05:00
sebastien lussier
9ba039e68e Approximate Actors - Allow approximate actors to use an array of components as input, rather than only actors
#rb patrick.enfedaque

[CL 27597062 by sebastien lussier in ue5-main branch]
2023-09-05 11:04:59 -04:00
sebastien lussier
49a9a5e664 Merge Actor - Approximate Actors: Expose the FallbackRelativeError settings (Nanite option)
#rb patrick.enfedaque

[CL 27594476 by sebastien lussier in ue5-main branch]
2023-09-05 09:25:05 -04:00
ryan schmidt
709253e10a CombineMeshInstances: Add support for specifying constraints on allowed Approximation types for specific Parts
#rb none
#rnx

[CL 27094778 by ryan schmidt in ue5-main branch]
2023-08-14 21:03:36 -04:00
ryan schmidt
2922ccfab0 CombineMeshInstances: add more support for preserving UVs
#rb none
#rnx

[CL 26925415 by ryan schmidt in ue5-main branch]
2023-08-08 14:46:58 -04:00
ryan schmidt
6795c69533 CombineMeshInstances: add support for skipping face merging on specified Material IDs
#rb none

[CL 26328122 by ryan schmidt in ue5-main branch]
2023-06-29 16:52:02 -04:00
ryan schmidt
8ca73ec300 CombineMeshInstances: properly handle multiple materials on source/simplified parts. Add FBaseMeshInstance::bAllowApproximation, if set to false, only copied or simplified LODs should be used for that part instance, to support special downstream part processing after merging. Currently only partially supported, budget may replace simplified LOD with approximation before appending instances, this needs to be revisited.
#rb none

[CL 26265762 by ryan schmidt in ue5-main branch]
2023-06-27 14:30:16 -04:00
ryan schmidt
fc0e5e3dc8 CombineMeshInstances: add support for collision shapes in FMeshLODSet path
#rb none

[CL 26208955 by ryan schmidt in ue5-main branch]
2023-06-23 09:32:51 -04:00
bryan sefcik
487304e75c Added the ability to set the base LOD index when copying from the original mesh.
#rb Ryan.Schmidt
#jira

[CL 26168496 by bryan sefcik in ue5-main branch]
2023-06-21 19:00:52 -04:00
ryan schmidt
14018f8e52 CombineMeshInstances: add concept of a 'Subset' of instances, which are processed separately for hidden removal and mesh-merging optimizations. Refactor internals to process things by-subset. Behavior is unchanged if Subset Indices are not initialized.
#rb none

[CL 26146588 by ryan schmidt in ue5-main branch]
2023-06-21 09:40:45 -04:00
sebastien lussier
320ff53c05 Added MeshAutoUV to GeometryProcessingInterface
* Required for future changes to improve the mesh merging capability to cope with missing/invalid UVs when trying to perform material baking.
#rb ryan.schmidt

[CL 26014245 by sebastien lussier in ue5-main branch]
2023-06-15 10:37:22 -04:00
ryan schmidt
d8dd1860d8 CombineMeshInstances: add support for passing unique mesh LOD chains as array of MeshDescriptions, as an alternative to passing UStaticMeshes.
#rb none

[CL 25971514 by ryan schmidt in ue5-main branch]
2023-06-13 23:13:47 -04:00
ryan schmidt
59da8a7c59 CombineMeshInstances: Add IntersectSweptPlanarProjections mode, intersects 3 polygon-sweeps, which can produce good approximations of L-shape parts w/ holes. Added bAutoGenerateMissingUVs and bAutoGenerateTangents flags to FOptions, supported in impl. Updated settings on internal usage.
#rb none

[CL 25963273 by ryan schmidt in ue5-main branch]
2023-06-13 16:54:37 -04:00
ryan schmidt
068c9d68a5 CombineMeshInstances: add support for alternative to Voxel LOD, based on planar sweep.
Add ECoarseApproximationStrategy to IGeometryProcessing_CombineMeshInstances, and FOptions.CoarseLODStrategy, as well as .CoarseApproximationDetailSize  (previously was hardcoded to 10 in impelmentation). Rename 'Voxel' to 'Coarse' in the Options struct.
Improve ComputeSweptSolidApproximation in CombineMeshInstancesImpl - 'Square' offset was a chamfer, but generally we want a Miter, with Miter cut threshold set to diagonal length.
Add ComputeBestFullProjectionMesh in CombineMeshInstancesImpl, computes swept-solid approximation along all 3 axes and selects the one w/ lowest geometric deviation
BuildCombinedMesh now supports using SweptPlanarProjection instead of Voxel approximation, or trying both and selecting the one w/ lower geometric deviation.
Disabled coplanar merging and planar retriangulation when doing hidden removal of voxel LODs (was unintentionally doing this)
Update internal usage

#rb none
#preflight 64791efee319748a836e1be5

[CL 25762477 by ryan schmidt in ue5-main branch]
2023-06-02 11:23:19 -04:00
ryan schmidt
c41af3c4c7 CombineMeshInstances: Add support for 2D retriangulation of planar areas, after coplanar face merging. This can further reduce triangle count as the planar-simplification applied after coplanar merging often cannot remove vertices on region borders, limiting it's effectiveness.
Also tweaked geometric tolerances recently added to RemoveHiddenFaces_ExteriorVisibilit() as they seem to be too aggressive (need to add real-world dimensions here).
Updated internal usage to enable this new capability
#rb none
#preflight 646cea301417daba1e6120a7
#rnx

[CL 25592274 by ryan schmidt in ue5-main branch]
2023-05-23 18:14:08 -04:00
ryan schmidt
4959c1f413 CombineMeshInstaces:
Renamed FInstanceSet to FSourceInstanceList in CombineMeshInstances API
Added FMeshInstanceGroupData.bPreserveUVs flag, defaults to false, in which case UVs are discarded on simplified and approximate meshes to encourage simplification
Added FOptions::MaxAllowableApproximationDeviation, prevents very large deviation in approximation of highly non-convex parts (may break some approximations, might need per-part overrides in future)
Added FOptions::bDoubleSidedHiddenRemoval, treating as single-sided improves hidden removal
FOptions::ApproximationSourceLOD can now be set to a generated simplified LOD, in addition to Source LODs. This helps avoid approximations being higher-quality than simplified parts

In CombineMeshInstancesImpl, renamed FMeshInstanceSet to FMeshPart, FMeshInstance to FMeshPartInstance, FMeshInstanceAssembly to FMeshPartsAssembly, to help clarify internal vs external data structures (many renaming changes as a result)
FPartApproxSelector now has MaxAllowableDeviation, set from new FOptions member, prevents major shape deviation (maybe too strict? might be good to count how many things deviate...)
tweaked AABB-override of approximations based on volume comparison
reduced InitialTriCost scaling for extra approximate LODs in ComputeMeshApproximations - this value is used as an exponent and so if it gets larger than ~5, for large deviations it will basically be infinity and stops being useful. This may need more work as it tends to go to box approximation very quickly now.
Various improvements to RemoveHiddenFaces_ExteriorVisibility. Now can backface-cull, does so by FOptions default. Improved filtering around "glancing angle" rays/hits. Changed from using fixed exterior point set as visibility locations, to direction set. Add slight downscaling of UV triangles, and of hit-triangle barycentric coords, to filter out hits very near to triangle edges, which can often be spurious.

updated internal usage for renaming, set plausible MaxAllowableApproximationDeviation, and using simplified LODs as ApproximationSourceLOD

#rb none
#preflight

[CL 25546006 by ryan schmidt in ue5-main branch]
2023-05-19 12:03:09 -04:00
ryan schmidt
19abdc7833 CombineMeshInstances improvements. Add support for externally-provided fixed LOD budgets for different LODs. Add 'Part Promotion' strategy in ComputeMeshApproximations() that incrementally "promotes" per-part LODs upwards so that combined mesh achieves triangle budget (see code comments for details).
Add explicit support for Axis-Aligned Box Approximation in addition to existing Oriented Box. Add explicit preference for AABB if it's volume is within 20% of OBB or best-shape approximation.
Other minor fixes.
#rb none
#preflight 64654aedd62884a78f5cbfa9

[CL 25519890 by ryan schmidt in ue5-main branch]
2023-05-17 20:29:18 -04:00
ryan schmidt
0c789b618b CombineMeshInstances: add FOptions::bRetriangulateSourceLODs and start LODIndex setting, to improve simplification of LOD1 geometry. When enabled this finds nearly-planar polygroups and then uses FPolygroupRemesh to retriangulate, this generally is more effective than relying on the SimplifyToMinimalPlanar done during face merging after hidden removal.
Also added FOptions::VertexColorMappingMode which currently only supports a mapping from tri count (relative to a box) to a white-to-red vertex color scale, basically intended for use as a debug visualization.

#rb none
#preflight 645c13e38e01daf0e5c115f0
#rnx

[CL 25420851 by ryan schmidt in ue5-main branch]
2023-05-10 21:25:29 -04:00
ryan schmidt
8310304eb5 CombineMeshInstances: add support for pinning corner vertices in simplification pass, based on detecting polygroups with a fixed opening angle (see comments). Expose configuration parameters in options struct. Set up with suitable values in UAtomModelBlueprintLibrary::CreateMergeMeshFromComponents_Optimized().
#rb none
#preflight 424d281b72410fc1773dfa3

[CL 24851402 by ryan schmidt in ue5-main branch]
2023-03-30 02:50:54 -04:00
ryan schmidt
e995540d36 CombineMeshInstances: Add support for merging faces after removing hidden faces. Provide a mechanism for external calling code to prevent this merging based on external "Grouping ID" (eg color index, etc). Add CVar geometry.CombineInstances.Verbose, when enabled, multi-threaded LOD generation is disabled and various log info is printed during the process.
#preflight 64077b295515f4f57b490fe0

[CL 24546957 by ryan schmidt in ue5-main branch]
2023-03-07 15:37:16 -05:00