Commit Graph

16 Commits

Author SHA1 Message Date
Ryan Schmidt
7393d0f0f5 ModelingTools: Fix various issues related to Tangents. FDynamicMeshEditor was using hardcoded 0 index instead of loop-variable NormalLayerIndex in several places. FDynamicMeshTangents did not handle invalid overlay triangles. UEditorModelingObjectsCreationAPI::CreateDynamicMeshActor() was not enabling Tangents on new DynamicMeshComponents. UDynamicMeshComponentToolTarget was not transferring tangents between FDynamicMesh3 and FMeshDescription when converting.
#rb none
#rnx
#jira none
preflight 60d25e9678c3b000012438cc

[CL 16751529 by Ryan Schmidt in ue5-main branch]
2021-06-22 19:34:47 -04:00
Ryan Schmidt
6497a53181 ModelingComponents: Add DynamicMeshActor
- ADynamicMeshActor type has a UDynamicMeshComponent subobject (similar to StaticMeshActor)
- Add IPersistentDynamicMeshSource, a ToolTarget Interface for accessing a UDynamicMesh
- Add UDynamicMeshComponentToolTarget, a UToolTarget implementing the above as well as various standard interfaces, to allow Tools to operate on an external DynamicMeshComponent
- Update UE::ToolTarget:: helper functions that get/commit via DynamicMesh to handle IPersistentDynamicMeshSource directly, instead of going via existing MeshDescription/DynamicMesh interfaces. Add UE::ToolTarget::SetSourceObjectVisible() helper function.
- Add support for creating DynamicMeshActors in UCreateMeshObjectTypeProperties and UEditorModelingObjectsCreationAPI
- register UDynamicMeshComponentToolTargetFactory in ModelingToolsEditorMode
- Rename existing internal ADynamicMeshActor to AOldDynamicMeshActor. Does not appear to be in use and will be removed in a future CL.

#rb lonnie.li
#rnx
#jira none
#preflight 60d0effc367e6700014c2e89

[CL 16735093 by Ryan Schmidt in ue5-main branch]
2021-06-21 18:08:56 -04:00
ryan schmidt
ba69f37e29 ApproxActors: expose hard-normals options. Change UProperty metatags to allow smaller min-dimensions to support smaller objects. Change default nanite proxy percent in CreateStaticMeshUtil to 0 (ie minimal 2000 triangles proxy).
#rb sebastien.lussier
#rnx


#ROBOMERGE-SOURCE: CL 16669495
#ROBOMERGE-BOT: (v834-16658389)

[CL 16669509 by ryan schmidt in ue5-main branch]
2021-06-15 00:28:54 -04:00
Ryan Schmidt
e196c256e4 GeometryProcessing: remove forwarding headers used in GeometryCore transition, and update all affected includes.
#rb none
#rnx
#jira none
#preflight 60c52c5db9446100014da02d

[CL 16653115 by Ryan Schmidt in ue5-main branch]
2021-06-13 00:35:22 -04:00
Ryan Schmidt
a8c13b57a9 ModelingComponents: make FMeshDescription returned by IMeshDescriptionProvider const, this pointer should not be modified
#rb none
#rnx
#jira none
#preflight 60c5024af7cffb0001d3fdfa
#fyi semion.piskarev, lonnie.li

[CL 16652350 by Ryan Schmidt in ue5-main branch]
2021-06-12 15:45:49 -04:00
Ryan Schmidt
fdf11b67d2 ModelingComponents: Clean up DynamicMeshComponent API. Update Component and Proxy handling of Tangents to use Attribute Overlay if available. Update affected Tools and also convert most of the affected Tools to use UE::ToolTarget helper functions.
- Add UE::ToolTarget::CommitMaterialSetUpdate() and ::CommitDynamicMeshUpdate(). ::GetDynamicMeshCopy() can now return tangents if requested.
- Add IMeshDescriptionProvider::CalculateAutoGeneratedAttributes(). Default implementation does nothing, UStaticMeshComponentToolTarget implementation initializes auto-generated MeshDescription attributes. Used in ::GetDynamicMeshCopy() to get tangents (but requires a MeshDescription copy).
- Clean up handling of Tangents in Simple/OctreeDynamicMeshComponent. Add local MakeTangentsFunc() to generate the Tangents lambda, handle different cases and no-tangents fallbacks consistently.
- UDynamicMesh: add optional info arguments to EditMesh() and ChangeInfo struct. Add support for deferring change events from Edit funcs.
- Remove UBaseDynamicMeshComponent::InitializeMesh(), ::Bake() APIs, and add ::SetMesh(). Implement in Simple/Octree implementations, update all Tools that used those APIs.
- Add USimpleDynamicMeshComponent::ProcessMesh(), EditMesh(). These are now the preferred ways to read/write mesh.
- Update USimpleDynamicMeshComponent tangents handling. Externally-computed tangents are now taken directly from the FDynamicMesh3 attribute set. Autogenerated tangents are still computed and stored in an internal FMeshTangentsf, but this is no longer exposed for external updates.
- Remove UPreviewMesh pass-through functions for Tangents access, InitializeMesh() and Bake(). Add ProcessMesh()
- Update all affected Tools. In most cases these Tools have also been converted to use ModelingToolTargetUtil functions, instead of direct ToolTarget interface casting.

#rb none
#rnx
#jira none
#preflight 60c3e71d3e1b3c00015668af

[CL 16650666 by Ryan Schmidt in ue5-main branch]
2021-06-11 22:39:18 -04:00
semion piskarev
3cb0babc20 MeshModelingTools: Added tool targets that operate on static and skeletal mesh assets without an underlying component, and refactored to use the same code. Also changed the dynamic mesh shared pointers in the tool targets to be thread safe ones.
#rb Ryan.Schmidt
#jira none
#rnx

[CL 16615477 by semion piskarev in ue5-main branch]
2021-06-09 19:21:27 -04:00
Ryan Schmidt
c3c459d75d ModelingComponents: Move SubdividePoly to ModelingComponentsEditorOnly. Need this to be able to apply SubD in other contexts.
#rb tyson.brochu
#rnx
#jira none
#preflight 60be56c8883e7f00015ed9ad

[CL 16577012 by Ryan Schmidt in ue5-main branch]
2021-06-07 16:29:48 -04:00
Ryan Schmidt
9bf97eae1a nonunity fixes
#rb none
#rnx
#jira none

[CL 16566594 by Ryan Schmidt in ue5-main branch]
2021-06-06 19:26:11 -04:00
Ryan Schmidt
75a21c9bb9 ModelingTools: add support for creating Volumes directly from DrawPolygon, DrawRevolve, DrawPolyPath, and AddPrimitive, CombineMeshes, CutMeshWithMesh, PlaneCut, BaseCreateFromSelected Tools. Improve support for Editing volumes, eg handling mesh/volume interactions, and add configurable auto-simplification for volumes to avoid painful Editor hangs.
- Move ToolTarget implementations, DynamicMeshToVolume to ModelingComponentsEditorOnly module
- move VolumeToDynamicMesh, DynamicMeshProvider/Commiter interfaces to ModelingComponents module
- Add UCreateMeshObjectTypeProperties property set to expose mesh/volume options
- Add FCreateMeshObjectParams::TypeHintClass to allow AVolume type (or other UClass hints) to be passed to creation APIs
- Add UE::ToolTarget::ConfigureCreateMeshObjectParams() util function in ModelingToolTargetUtil, tries to determine output type in a FCreateMeshObjectParams based on input ToolTarget
- Add UEditorModelingObjectsCreationAPI::CreateVolume() implementation
- Add UEditorModelingObjectsCreationAPI::FilterMaterials() that strips out any internal materials and replaces with WorldGridMaterial. This occurs when (eg) subtracting a Volume from a StaticMesh, because the temporary volume mesh gets assigned internal materials, but the Tools don't know this. Use in EditorModelingObjectsCreationAPI when creating new objects. UStaticMeshComponentToolTarget also does this filtering in ::CommitMaterialSetUpdate().
- Add ::ComponentTypeSupportsCollision() function to ComponentCollisionUtil, use to avoid checks/ensures for Volume targets
- Add support for automatic mesh simplification in DynamicMeshToVolume. Add CVar to VolumeDynamicMeshToolTarget.h to control max triangle count (default 500). Apply auto-simplify when creating or updating an AVolume. This prevents the Editor from blocking for long periods on meshes that are too high-res for volumes (even 500 is quite high).
- DynamicMeshToVolume now emits polygroup-faces that contain holes (ie multiple boundary loops) as a set of triangles, rather than emitting separate overlapping faces for each boundary loop

#rb none
#rnx
#jira none
#preflight 60ba50632c42ea0001cb54c5

[CL 16561742 by Ryan Schmidt in ue5-main branch]
2021-06-04 16:04:03 -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
7b214c4a33 MeshModeling: add ModelingObjectsCreationAPI, replaces existing usage of IToolsContextAssetAPI in Modeling Tools/Mode
- add new UModelingObjectsCreationAPI and associated data structures, provides abstract API for creating mesh and texture objects from Tools that is not specifically tied to StaticMesh Actors/Assets
- new helper functions in UE::Modeling:: namespace to simplify usage of an implementation of this API registered in a ContextObjectStore
- add new UEditorModelingObjectsCreationAPI implementation of above, supports hooks for higher level to provide custom paths
- add ModelingModeAssetUtils.h, provides several functions in UE::Modeling:: namespace to be used to implement those hooks (various existing path-determination code is moved here)
- ModelingToolsEditorMode now registers an instance of UEditorModelingObjectsCreationAPI in ContextObjectStore and connects up callbacks to these path functions
- AssetGenerationUtil functions and ModelingModeAssetAPI deleted
- All Tools that previously used IToolsContextAssetAPI updated to use this new system

#rb jimmy.andrews
#rnx
#jira none
#preflight 60b7c2ddae46a1000162729b

[CL 16538450 by Ryan Schmidt in ue5-main branch]
2021-06-02 15:58:00 -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
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
5c88d78bf9 ModelingComponents:
Add Texture2DUtil::ConvertToSingleChannel(), converts TSF_BGRA8 and TSF_BGRE8 textures to TSF_G8 (based on cast-to-FColor Red channel) to reduce memory usage of a texture
Add CreateDerivedMaterialInstance(), makes a new MIC for input material (either by duplicating or using MIC asset factory)
#rb none
#rnx
#jira none

[CL 16335333 by Ryan Schmidt in ue5-main branch]
2021-05-14 16:28:31 -04:00
Ryan Schmidt
7a14a2b15e MeshModelingToolset: add new ModelingComponentsEditorOnly module, with utility functions for creating UStaticMesh/UTexture2D/UMaterial assets.
#rb none
#rnx
#jira none

[CL 16151628 by Ryan Schmidt in ue5-main branch]
2021-04-28 21:05:19 -04:00