Commit Graph

19 Commits

Author SHA1 Message Date
ryan schmidt
c49fc562ad CombineMeshInstance: add support for combining simple collision and simple box-merging strategy to combine collision shapes.
GeometryCore: Make TAxisAlignedBox3::DistanceSquared const (should have been). Add TQuaternion * scalar and operator+ functions. Add TTransformSRT3::GetScale3D for API compatibility with engine FTransform
Add FSimpleShapeSet3d::Append() variant that takes a FTransformSequence3d
#rb rinat.abdrashitov
#preflight 63fe7971437ce3e7f3b51c8a

[CL 24454963 by ryan schmidt in ue5-main branch]
2023-02-28 19:00:45 -05:00
ryan schmidt
b2dee2db5f GeometryProcessing: incremental improvements to CombineMeshInstances implementation. Now generates multiple LODs of approximated meshes, can fit swept-hull and convex-hull, choose between approximations based on a geometric-error-per-triangle cost factor, and optionally remove hidden triangles (expensive).
#preflight 63fd0d4fae54ee4ce93ab1d7

[CL 24436831 by ryan schmidt in ue5-main branch]
2023-02-27 20:57:27 -05:00
ryan schmidt
cd615fdc43 Add initial version of new CombineMeshInstances geometry processing Modular Feature and initial implementation. This modular feature is used to construct a 'merged' mesh for a large number of input mesh instances, with the idea that simplifying or abstracting each instanced base mesh (ie unique "part") before appending will produce a better (ie more accurate + lower polycount) combined mesh than trying to combine first and then do standard simplification technqiues on the merged mesh. Currently only per-part simplification and fitting oriented boxes is supported. This is a functional checkpoint of work in progress.
#preflight 63fba7bedd78dd50f633a33a

[CL 24419571 by ryan schmidt in ue5-main branch]
2023-02-26 21:00:47 -05:00
semion piskarev
d965552bcf UVEditor: Cleanup having to do with the modeling tools button. Clarify comments, remove UV editor from IGeometryProcessingInterfacesModule interface since it shouldn't have multiple implementations and isn't a processing algorithm, rename classes that sound like they are asset editors in themselves.
#rb Nathan.Mitchell, Ryan.Schmidt
#jira none
#preflight 6377f29c2a05dabce9561a39

[CL 23206945 by semion piskarev in ue5-main branch]
2022-11-18 17:14:55 -05:00
nathan mitchell
7b4deab5ed UVEditor: Add support for new launcher button to appear in the Modeling Mode UV tools category. Introduces a new GeometryProcessingInterface to connect Modeling Mode to the UV Editor plugin while allowing the UV Editor plugin to be optional still.
#rb Ryan.Schmidt
#preflight 63052b2b0061f895d02a06f2

[CL 21518175 by nathan mitchell in ue5-main branch]
2022-08-23 16:01:30 -04:00
ryan schmidt
d292a2b82f GeometryCore: add min-triangle-count threshold to TMeshSimplification::FastCollapsePass()
ApproximateActors: add FMeshApproximationSettings::bEnableSimplifyPrePass option, default true, and implement in ApproximateActors impl. This does a fast-collapse down to a multiple of the target triangle count (or 1m tris in tolerance-mode). This reduces simplification time in HLOD builds for small city from 4-5m to 1m in some of the worst blocks.

ApproximateActors: add FMeshApproximationSettings::bEnableParallelBaking, default true, and implement in the ApproximateActors Impl. This allows the photocapture step to proceed at the same time as the mesh generation, which shaves 30-40s off every HLOD build, but increases memory requirements.

#rb sebastien.lussier
#jira UE-142582
#preflight 6214fd9e797dbbeb4723468e
#rnx

#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 19083146 in //UE5/Release-5.0/... via CL 19097574
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19141130 by ryan schmidt in ue5-main branch]
2022-02-24 23:46:55 -05:00
ryan schmidt
b4814d732d ApproximateActors: reduce memory footprint by using compressed or lower-resolution LOD0 meshes
- add FStaticMeshLODResourcesAdapter in MeshConversions module, wrapper that presents StaticMesh LODResources mesh (ie Section buffers) with an API compatible with GeometryCore mesh templates
- add TMeshWrapperAdapterd in GeometryCore, this is a shim for getting any template-API-compatible mesh into a FTriangleMeshAdapterd specifically (required to call some non-template mesh processing functions)

- add support for using StaticMesh LODResources meshes in FMeshSceneAdapter instead of source meshes, controlled by build options flag
- add FMeshSceneAdapter build options flags specifying whether UV/Normal queries are required (default true)
  - when not required, the loaded MeshDescriptions and created DynamicMeshes are packed into FColliderMesh which has a smaller memory footprint, allowing the larger meshes to be freed

- to support above, the SpatialWrappers in MeshSceneAdapter.cpp have been refactored extensively
  - added FCompressedMeshSpatialWrapper which Builds from a temporary FDynamicMesh3 into a FColliderMesh, supports all the same options as FDynamicMeshSpatialWrapper (so a drop-in replacement with less memory usage, but no UV/Normal queries)
  - added FBaseMeshSpatialWrapper, base class for existing FDynamicMeshSpatialWrapper and new FCompressedMeshSpatialWrapper that has shared config settings (can more more here in the future)
  - added FStaticMeshLODResourcesMeshSurfaceAdapter, similar toFMeshDescriptionTriangleMeshSurfaceAdapter, a mesh adapter that filters out any geo that doesn't have a Surface-domain material
  - refactored TStaticMeshSpatialWrapper into TStaticMeshSpatialWrapperBase and subclasses FStaticMeshSourceDataSpatialWrapper and FStaticMeshRenderDataSpatialWrapper, for source mesh vs render mesh
  - added FCompressedStaticMeshSpatialWrapper, variant of FStaticMeshSourceDataSpatialWrapper that stores to a FColliderMesh and releases the source MeshDescription
  - SpatialWrapperFactory() now has logic to build from render mesh vs source mesh vs compressed source mesh
  - moved initial SpatialWrapper construction from AddActors() phase to Build() phase, because now it depends on build settings

- add EMeshDataSourceLODPolicy to IGeometryProcessing::FOptions, with LOD0 Source and LOD0 RenderMesh options
- ApproximateActorsImpl now provides/handles this policy setting, and configures FMeshSceneAdapter to not need UV/Normal queries (not required in this context)
- add bUseRenderLODMeshes option in FMeshApproximationSettings to expose render vs source mesh control at user level

#rb sebastien.lussier, rinat.abdrashitov
#jira UE-141256
#preflight 6206db44054c2e38c473be5d
#rnx

#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18963126 in //UE5/Release-5.0/... via CL 18963829 via CL 18964587
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)

[CL 18964607 by ryan schmidt in ue5-main branch]
2022-02-11 18:11:49 -05:00
ryan schmidt
b47d66add3 ApproximateActors: add support for PatchBuilder AutoUV method
#rb jimmy.andrews
#rnx
#jira none
#preflight 61b8d5532e65a1df046a90c5

#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 18456333 in //UE5/Release-5.0/... via CL 18456340
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v898-18417669)

[CL 18456352 by ryan schmidt in ue5-release-engine-test branch]
2021-12-14 13:08:31 -05:00
michael balzer
82ab317af0 MeshModelingToolset: Split plugin into non-experimental and experimental
#jira UETOOL-3823
#rb ryan.schmidt
#preflight 6101fb4b2b002800014f7007

#ROBOMERGE-SOURCE: CL 17003092 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 17003151 by michael balzer in ue5-release-engine-test branch]
2021-07-29 20:08:48 -04:00
ryan schmidt
a9629b20c6 ApproximateActors Improvements
MeshSceneAdapter: handle mis-configured MeshDescription material slot names that reference ImportedMaterialSlotName instead of MaterialSlotName, and fall back to material 0 / default surfarce material in cases where material is not defined (which is normal engine behavior elsewhere). Add CVar to control multi-threading, to support debugging. Fix handling of nearly-thick-enough objects that were incorrectly being converted to very thin shells.
ApproximateActors: Expose options for ground plane clipping, UV generation method, tiny parts filtering, implement support for these options. Add optional base-plane occluder to allow occlusion filtering to remove "bottom" geometry. Implement fallback to Boxmap UVs if UV generation fails. Set default output material on generated Collision meshes.
Expose above options in FMeshApproximationSettings for MergeActors/etc UI

#rb none
#rnx
#preflight 60f9e207a6959a0001bfd867
[FYI] Sebastien.Lussier

#ROBOMERGE-SOURCE: CL 16932394 via CL 16932403
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v838-16927207)

[CL 16932405 by ryan schmidt in ue5-release-engine-test branch]
2021-07-22 18:56:41 -04:00
sebastien lussier
eac3ae2a6b World Partition HLODs - Added automatic texture size selection based on hints
Supports either:
* From texel density
* From expected mesh screen size
* From expected mesh draw distance

Compute best texture size, taking UV map waste into account.
Currently only supported by the Approximate Actors merge method, to be integrated in the ProxyLOD later.
#rb ryan.schmidt, luc.eygasier

#ROBOMERGE-SOURCE: CL 16635038 via CL 16635077
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v831-16623017)

[CL 16635084 by sebastien lussier in ue5-release-engine-test branch]
2021-06-10 21:50:21 -04:00
sebastien lussier
7bd11cdcac ApproximateActors - Ensure debug view modes are available when generating materials.
Use LogApproximateActors instead of LogTemp
#rb ryan.schmidt


#ROBOMERGE-SOURCE: CL 16559789
#ROBOMERGE-BOT: (v828-16531559)

[CL 16559817 by sebastien lussier in ue5-main branch]
2021-06-04 12:43:35 -04:00
sebastien lussier
4c88fc99af Approximate Actors HLOD
* Moved duplicated code that was constructing a IGeometryProcessing_ApproximateActors::FOptions from a FMeshApproximationSettings to FApproximateActorsImpl::ConstructOptions()
* Added mesh generation options
** bAllowDistanceField - on by default
** bSupportRayTracing - on by default
** bGenerateLightmapUVs - off by default

* Disable creation of physics body for HLOD

* Scale texture size based on grid promotion (higher z grid index -> higher area covered) - Only temporary, will probably switch to a texel density option instead

#rb ryan.schmidt, jeanfrancois.dube, luc.eygasier

#ROBOMERGE-SOURCE: CL 16538607 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v828-16531559)

[CL 16538620 by sebastien lussier in ue5-main branch]
2021-06-02 16:08:31 -04:00
ryan schmidt
2fab582c78 GeometryProcessing:
- extend FImageAdapter to support reading
ModelingComponents::
- Add AssetUtils::ForceVirtualTexturePrefetch(), ::SaveDebugImage() variants to Texture2DUtil
- Add support for debug image writing to WorldRenderCapture and SceneCapturePhotoSet
- FWorldRenderCapture now computes more accurate bounds (visible Components instead of Actors), and does an explicit VirtualTexture prefetch before doing render capture
- FStaticMeshAssetOptions now exposes Nanite settings to allow UStaticMeshes to be created with Nanite already enabled (currently NaniteSettings.PositionPrecision defaults to max)
ApproximateActors:
- IGeometryProcessing_ApproximateActors::FOptions now has settings for enabling Nanite on generated meshes
- ApproximateActorsImpl applies these settings, also enables VT on generated textures if necessary
- FMeshApproximationSettings/FMeshApproximationTool updated w/ new Nanite settings
#rb none
#rnx
#jira none
[FYI] sebastien.lussier
#preflight 60b08323f51cd90001775b98

#ROBOMERGE-OWNER: ryan.schmidt
#ROBOMERGE-AUTHOR: ryan.schmidt
#ROBOMERGE-SOURCE: CL 16499613 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v823-16466674)
#ROBOMERGE-CONFLICT from-shelf

[CL 16499647 by ryan schmidt in ue5-main branch]
2021-05-28 02:46:59 -04:00
ryan schmidt
4e09532b56 ApproximateActors: add support for combined Metallic/Roughness/Specular texture in ApproximateActors options and GeometryProcessingAdapters implementation. ApproximateActorsImpl now respects the baking enable/disable flags.
#rb none
#rnx
#jira none

#ROBOMERGE-SOURCE: CL 16465454 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v818-16446889)

[CL 16465458 by ryan schmidt in ue5-main branch]
2021-05-26 03:37:14 -04:00
ryan schmidt
6191a7ce3c ApproximateActors updates:
- FMeshSceneAdapter updates
   - if bThickenThinMeshes is enabled, then all instance meshes are converted to DynamicMesh and decomposed to find non-closed regions. Those regions are uniqued into separate meshes. The remaining closed geometry is separated out and kept as instanced.
   - various utility functions added to support above
   - previous code to explicitly 'thicken' open meshes into solids is removed. Instead unsigned distance is used to determine inside/outside and generate a 1/0 winding number
   - instances are now sorted into an octree to speed up winding number evaluations
   - If all meshes are closed (or effectively closed via above, ie will return integer winding number) then winding number query can early-out as soon as it finds a non-zero value
- Add hard-normals options in IGeometryProcessing_ApproximateActors (not exposed in MergeActors tool options yet)
- Added hard-normal callucation to ApproximateActorsImpl, and additional profiling
- Allow specification of actual  ECollisionTraceFlag options in CreateStaticMeshUtil, instead of just a boolean
- Add FSparseDynamicOctree3::ContainmentQueryCancellable() variant that can early-exit

#rb none
#rnx
#jira none
#preflight 60a686274c320300018d3841

#ROBOMERGE-SOURCE: CL 16410125 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)

[CL 16412542 by ryan schmidt in ue5-main branch]
2021-05-20 19:35:43 -04:00
Ryan Schmidt
9defa23f46 GeometryProcessing:
- Add FImageAdapter, wraps TImageBuilder of different types and provides a consistent interface, so that other code doesn't need specializations for each image type
- FMeshSceneAdapter now supports the ability to detect and thicken "thin" meshes, by flattening the instances into unique mesh copies (generally necessary due to scaling). Can also now return statistics about the mesh scene, return a full flattened mesh (for debugging), and automatically generate a "closing mesh" that can help to cap off the base of mesh assemblies when trying to generate a solid/etc.

ModelingComponents:
- FWorldRenderCapture now writes via FImageAdapter instead of an Image4f
- FSceneCapturePhotoSet now stores less data for photo sets. BaseColor/Emissive/WorldNormal are 3f, Roughness/Specular/Metallic are 1f
- IApproximateActors and implementation now support optional base-capping, occluded mesh removal, geometric-tolerance simplification, thin mesh auth-thickening. Now creates MICs based on an input Material, instead of new Material. Added ability to emit a flattened debug mesh, and print debug info.

MergeActors:
- Expose above improvements to IApproximateActors

#rb none
#rnx
#jira none
#preflight 609ef005f6c6e3000144c5e2

[CL 16338550 by Ryan Schmidt in ue5-main branch]
2021-05-14 21:11:51 -04:00
Ryan Schmidt
e80d853a06 GeometryProcesing: add TImageBuilder::FastDownsample. Add AntiAliasMultiSampling parameter to ApproximateActors API and Impl. Expose WindingNumber parameter in ApproximateActors API. Modify FMeshSceneAdapter to compute winding number sum instead of max.
#rb none
#rnx
#jira none
#preflight 6091c88590631e000100c55b

[CL 16201057 by Ryan Schmidt in ue5-main branch]
2021-05-04 19:08:26 -04:00
Ryan Schmidt
946b918d4a Add GeometryProcessingInterfaces module in /Developer. This module exists to define abstract interfaces to high-level geometry operations, which the core Engine/Editor can see, but which can be implemented by plugins. Currently only ApproximateActors interface is defined, which will allow the ProxyLOD and HLOD systems to use implementations that depend on the MeshModelingToolset and GeometryProcessing plugins.
Add GeometryProcessingAdapters module to MeshModelingToolset, this is an Editor-only module that implements GeometryProcessingInterfaces APIs

Add ApproximateActors implementation in GeometryProcessingAdapters that uses GeometryProcessing (FastWindingNumber / MeshMorphology / Simplify / UVGen / Tangents) and a new material-baking process based on render captures to generate a new StaticMesh Asset / Material / Textures that approximate the input Actor set.

#rb none
#rnx
#jira none
#preflight 608b25ced4026b0001cbe9c4

[CL 16162961 by Ryan Schmidt in ue5-main branch]
2021-04-29 18:12:32 -04:00