Commit Graph

75 Commits

Author SHA1 Message Date
Sebastien Lussier
06ccaf7c69 Optimized proxy mesh generation
* Added GroupIdenticalMeshesForBaking, which, when activated, will result in identical meshes (or mesh instances) being baked only once.

Other changes/fixes
* Always rely on the StaticMesh RenderData when retrieving mesh description for mesh merging/simplification (was the case when retrieving from a SMC, now also the case for a SM).
* For some reason, Material baking was rendering each triangle twice, but with opposite facing. Uneeded as we are rendering with backface culling disabled.

[CL 15669055 by Sebastien Lussier in ue5-main branch]
2021-03-10 15:46:29 -04:00
Sebastien Lussier
9c631eef97 Mesh merging - Added option to generate Nanite enabled meshes
#rb jeanfrancois.dube
#robomerge Release-5.0-EarlyAccess

[CL 15540751 by Sebastien Lussier in ue5-main branch]
2021-02-26 12:32:53 -04:00
julien lheureux
7a2733d861 - Adapted the MergeActors dialog to the new UX style.
- Refactored the MergeActors different panels to reuse the same code.
- Adapted quick merge actions (required some refactoring)
- Fixed some issues with the "replace source actors" feature vs. actual selection
- Fixed crash when using the instancing mode with "replace source actors" enabled.

#rb sebastien.lussier
#jira UETOOL-2808

[CL 15019677 by julien lheureux in ue5-main branch]
2021-01-08 11:22:39 -04:00
Sebastien Lussier
4628d9d8ae Output an error if calling FMeshMergeUtilities::CreateProxyMesh() without having the necessary plugin enabled
#rb julien.lheureux

[CL 15014354 by Sebastien Lussier in ue5-main branch]
2021-01-07 15:43:07 -04:00
Andrew Davidson
10bca5261b Double math ambiguity Engine fixes
#rb jeanfrancois.dube, trivial

[CL 14974758 by Andrew Davidson in ue5-main branch]
2021-01-04 07:59:22 -04:00
Marc Audy
ada7c144fa Merge //UE5/Release-Engine-Staging @14903491 to //UE5/Main
[CL 14906022 by Marc Audy in ue5-main branch]
2020-12-11 14:21:20 -04:00
Sebastien Lussier
e12e225fc9 Optimized HLOD merged mesh generation
* Avoid recreating render states for all primitives in the world
#rb jeanfrancois.dube

[CL 14776513 by Sebastien Lussier in ue5-main branch]
2020-11-18 11:41:34 -04:00
danny couture
0b151ec30f Deprecate some directly accessible fields in UStaticMesh
#rb Francis.Hurteau

[CL 14606505 by danny couture in ue5-main branch]
2020-10-28 22:08:44 -04:00
Marc Audy
4c1bb11c29 Merge UE5/Release-Engine-Staging to UE5/Main @ 14548662
This represents UE4/Main @ 14525125 + cherrypicked fixes
#skipundocheck

[CL 14551026 by Marc Audy in ue5-main branch]
2020-10-22 19:19:16 -04:00
Louise Rasmussen
909eb96ce6 Static Mesh Asset Editor Style Updates
#rb matt.kuhlenschmidt, lauren.barnes

[CL 14493821 by Louise Rasmussen in ue5-main branch]
2020-10-14 13:29:31 -04:00
Marcus Wassmer
3b81cf8201 Merging using //UE5/Main_to_//UE5/Release-Engine-Staging @14384769
autoresolved files
#rb none

[CL 14384911 by Marcus Wassmer in ue5-main branch]
2020-09-24 00:43:27 -04:00
Sebastien Lussier
9a3e1ebfba Added IMeshMergeUtilities::RetrieveMeshDescription
* General cleanup
* Removed ExtractImposterToRawMesh() which was overspecialized and not specifically handling Imposters
* Renamed remains of FRawMesh to MeshDescription

#rb patrick.enfedaque

[CL 14243261 by Sebastien Lussier in ue5-main branch]
2020-09-02 07:14:07 -04:00
Marc Audy
a7c9001a94 Merging //UE5/Release-Engine-Staging to Main (//UE5/Main) @ 14075166
#rb
#rnx

[CL 14075271 by Marc Audy in ue5-main branch]
2020-08-11 01:36:57 -04:00
Richard TalbotWatkin
51d4cb3f66 Fully deprecated old MeshDescription APIs.
Prepared direct attribute access for deprecation, preferring use of APIs to access static mesh attributes.
Fixed recently merged Enterprise code to comply with new APIs.
Changed all tools to use triangle-centric iteration where possible.
Added new MeshAttributeArray APIs for querying attribute flags, and added a new Mandatory flag.
Various bug fixes.
#rb Alexis.Matte

[CL 13873755 by Richard TalbotWatkin in ue5-main branch]
2020-07-16 08:23:15 -04:00
Marc Audy
11f5b21210 Merging //UE5/Release-Engine-Staging @ 13752110 to Main (//UE5/Main)
#rnx

[CL 13753156 by Marc Audy in ue5-main branch]
2020-06-23 18:40:00 -04:00
danny couture
ff158b6e95 Async Texture Compilation
- Feature can be activated in the Experimental section of the Editor Settings
 - Replace Texture2D/TextureCube resources by placeholders until their PlatformData is ready
 - Add a utility class allowing to encapsulate raw field pointers without breaking compatibility
 - Protect PlatformData from unsafe access through encapsulation.
 - Protect texture's resource from race conditions between game and render threads through encapsulation.
    - This allows to get rid of FlushRenderingCommands and long game-thread stutters when Updating a texture's resource.
    - UpdateResource was never safe to call without a FlushRenderingCommands and multiple call-site are doing exactly that, this will fix those cases.
    - Those were probably undetected due to their low occurence rate under normal conditions but can easily be reproed during async texture compilation on 32 cores.
 - Force wait on required texture compilations for MaterialBaking, ProxyMesh, Thumbnail generation for disk usage
 - Wait on all textures compilation whenever a wait for all shaders compilation is requested for safety (i.e. screenshot)
 - Compile UI and heightmap textures with higher priority to reduce visual artefacts
 - Increase priority of texture that have been rendered to improve time-to-usefulness of the editor under low core count
 - Async compilation is disabled for -game / non-editor mode as there is currently no support for async bulk data loading from external files
 - Properly cancel async tasks when UTexture is garbage collected before the compilation is finished
 - Show progress when explicitly waiting on compilation
 - Changing the mip settings in the texture editor (or any settings requiring the running platform data to be recomputed) will now be processed asynchronously.

DEBUGGING

 - Can be forcibly enabled/disabled through command-line via -asynctexturecompilation=[off, on, paused]
 - Can pause texture compilation using Editor.AsyncTextureCompilation = 2 or -asynctexturecompilation=paused
 - Can manually resume a specified amount of paused compilation using Editor.AsyncTextureCompilationResume [Num]
 - Can forcibly wait on all compilation using Editor.AsyncTextureCompilationFlushAll

BENCHMARKS

 - 3m15s to 1m20s when loading Apollo_Terrain with no textures in DDC (AMD TR 3970X)
 - 6m45s to 1m11s when loading Apollo_Terrain with no textures in DDC (-corelimit=8)
 - 3m10s to 1m54s when lauching PIE on Apollo_Terrain with no textures in DDC (AMD TR 3970X)
 - 7m43s to 1m36s when lauching PIE on Apollo_Terrain with no textures in DDC (-corelimit=8)
 - 0m57s to 0m42s when importing Attic_NVIDIA.usd with no textures in DDC (AMD TR 3970X)
 - 2m14s to 0m35s when importing Attic_NVIDIA.usd with no textures in DDC (-corelimit=4)

TESTS
 - Success on all material baking tests from EngineTests with -asynctexturecompilation=paused
 - Runned with -corelimit=1 all the way to unlimited
 - Cooking worked
 - Opening the texture editor/material editor will force the compilation to finish like expected.
 - Changing a setting in the texture editor will recompile async, even allowing to close the editor and continue doing other changes.
 - Unpausing the compilation will update the texture thumbnails properly.
 - Started with -asynctexturecompilation=paused, and then unpaused after a map loading, and then into a PIE session to stresstest UpdateResources.
 - Tested both dx11/dx12
 - Vulkan fails on Fortnite even with -asynctexturecompilation=off because of Landscape weigthmap, not this CL.
 - Compiled and tested FortniteGame / UE4 / ShooterGame projects

#rb Uriel.Doyon, Francis.Hurteau

[CL 13694814 by danny couture in ue5-main branch]
2020-06-16 22:16:25 -04:00
Richard TalbotWatkin
4884bf9d9a First pass of MeshDescription API and format refactor.
- Removed hardcoded element type arrays (Vertices, Edges, Triangles etc.). Mesh element types can now be arbitrarily added, with any number of channels.
- Mesh element containers have a much leaner format; instead of sparse arrays, they are now represented by a simple bitarray, determining whether an index is used or not. Consequently, mesh topology is now entirely described with the attribute system, e.g. edge start and end vertices, triangle vertices, etc.
- Support added for attributes of arbitrary dimensions, e.g. float[4] or int[2].
- Support added for attributes which index into another mesh element container.
- Added FMeshElementIndexer: this is an efficient container for maintaining backward references from one element type to another; for example, edges have an attribute specifying which vertices are at each end (an attribute of type FVertexID[2]). With an indexer, it is possible to look up which edges contain a given vertex, even though this is not explicitly stored. Indexers are designed to do minimal allocations and update lazily and in batch when necessary.
- Added support for preserving UV topology in static meshes. UVs are now a first-class element type which may be indexed directly from triangles.
- Added the facility to access the underlying array in an attribute array directly.
- Triangles now directly reference their vertex, edge and UV IDs. Vertex instances are to be deprecated.
- Changed various systems to be triangle-centric rather than polygon-centric, as this is faster. Triangles are presumed to be the elementary face type in a MeshDescription, even if polygons are still supported. The concept of polygons will be somewhat shifted to mean a group of triangles which should be treated collectively for editing purposes.
- Optimised normal/tangent generation and FBX import.
- Deprecated EditableMesh, MeshEditor and StaticMeshEditorExtension plugins - these are to be removed, but they still have certain hooks in place which need removing.
#rb

[CL 13568702 by Richard TalbotWatkin in ue5-main branch]
2020-05-28 10:56:57 -04:00
sebastien lussier
dd3e8d03fd Fix multiple UV remapping issues for merged meshes
* Vertex color was not taken into account
* OnCreatedMergedRawMeshes() extensions could wiping out vertices colors (was the case for Fortnite)
** Only call extension for the final merged mesh result

Force an update of all HLODs by changing the proxy key
#rb patrick.enfedaque

#ROBOMERGE-OWNER: sebastien.lussier
#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 12671370 via CL 12671428 via CL 12671436 via CL 12671437
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v675-12543919)

[CL 12672166 by sebastien lussier in Main branch]
2020-04-08 10:13:22 -04:00
julien stjean
f324e13073 Fixed two issues in the proxy merge tools.
1- The FExportMaterialProxy didn't give the proper static parameters for the materials instance. It always used those from the parent/master material.
2- The mesh description extracted from the static mesh component was sometimes invalid. This occurred when the mesh had an empty section as it first section. This resulted in a mesh with all its polygons being part of the first section when rendered for the proxy mesh.

Also renamed a variable in the create proxy mesh function since its previous name didn't make sense with what it is.

#jira UE-90322
#rb Sebastien.Lussier

#ROBOMERGE-SOURCE: CL 12234869 in //UE4/Release-4.25/... via CL 12234887
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v664-12234175)

[CL 12237471 by julien stjean in Main branch]
2020-03-17 20:02:37 -04:00
danny couture
41ebad9f71 Fix crash during proxy lods generation if lightmap uvindex is -1
#rnx
#jira UE-90171
#rb JeanMichel.Dignard

#ROBOMERGE-SOURCE: CL 12104702 in //UE4/Release-4.25/... via CL 12104740
#ROBOMERGE-BOT: RELEASE (Release-4.25Plus -> Main) (v657-12064184)

[CL 12104779 by danny couture in Main branch]
2020-03-10 09:33:58 -04:00
Sebastien Lussier
055f5e2c31 CIS fix
#rb none
#jira none

[CL 11968903 by Sebastien Lussier in Main branch]
2020-03-05 18:24:55 -05:00
Sebastien Lussier
0d1f80b726 Fix build error in MeshMergeUtilities.cpp
#jira none
#rb none

[CL 11962945 by Sebastien Lussier in Main branch]
2020-03-05 16:13:57 -05:00
sebastien lussier
c51c310de7 Remove extra UV sets from HLOD meshes
* HLOD0 (merged) - Reliance on DoesUVChannelContainData() & the FMeshMergeSettings::OutputUVs[] array was lost during what looks like a bad code merge in ~2018
* HLOD1 (simplified) - Removed strange processing that added a second UV set, supposedly for lightmapping.  This isn't needed as it's handled in the static mesh build.

Bumped the HLOD proxy key to force a rebuild of all HLODs
#rb chris.bunner, jeanfrancois.dube


#ROBOMERGE-OWNER: sebastien.lussier
#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 11958420 via CL 11958431 via CL 11958469 via CL 11958487
#ROBOMERGE-BOT: (v656-11643781)

[CL 11961121 by sebastien lussier in Main branch]
2020-03-05 16:01:44 -05:00
JeanFrancois Dube
e7f37d8b09 Avoid memcopies in MergeFlattenedMaterials.
#rb danny.couture

[CL 11535927 by JeanFrancois Dube in Main branch]
2020-02-19 06:42:29 -05:00
JeanFrancois Dube
7d3d157816 Integrate 11534852 from 4.25: Add missing flattened material property enum that was missed when anisotropy was added.
#jira UE-89011, UE-89068, UE-89035
#fyi danny.couture
#rb none

[CL 11535904 by JeanFrancois Dube in Main branch]
2020-02-19 06:34:52 -05:00