Commit Graph

343 Commits

Author SHA1 Message Date
julien lheureux
3af7a02872 Added delegate for changes on landscape proxy.
Added some robustness/validation to the GetCompleteBounds call.

#rb jonathan.bard
#preflight 6294c4294c7bcac173ce31bd

[CL 20430596 by julien lheureux in ue5-main branch]
2022-05-30 09:34:41 -04:00
semion piskarev
d78f6490ed Submitting on behalf of Jonathan.Bard, see review 19835889
Landscape: added utility function to render the merged heightmap from anywhere in world space. This is done in 2 steps : render the heightmaps  of all landscape components overlapping with the requested region into an atlas texture (uncompressed) subsection by subsection, skipping the duplicated rows/columns. Then resample the atlas at the requested location.
If the render target is 8bits/channel, the resulting heightmap will be compressed on the R and G channels. If the target is 16 bits uint, the output will contain the uncompressed height value.
The function supports heightmaps with different minimum mip level and will use the best available mip level. However, currently the intermediate atlas render target is always allocated using the landscape's full resolution.
This is meant to be compatible with runtime but is not at the moment, because it relies on ULandscapeInfo members which are not editor-only but are not available at runtime (yet). This will be fixed later on.

#rb semion.piskarev
#preflight 629007c98c23e52ef0097189

#ROBOMERGE-AUTHOR: semion.piskarev
#ROBOMERGE-SOURCE: CL 20389454 via CL 20389469 via CL 20389478
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v949-20362246)

[CL 20390053 by semion piskarev in ue5-main branch]
2022-05-26 23:03:03 -04:00
patrick enfedaque
6e14bf225a Landscape:
- Allow changing bIsSpatiallyLoaded flag on ALandscapeStreamingProxy and ALandscapeSplineActor
- New flag in ALandscape used to set the bIsSpatiallyloaded flags on newly created AlandscapeStreamingProxy and ALandscapeSplineActor (bAreNewLandscapeActorsSpatiallyLoaded)

#rb richard.malo, jeanfrancois.dube
#preflight 628d1404b378b39d419041cf

#ROBOMERGE-AUTHOR: patrick.enfedaque
#ROBOMERGE-SOURCE: CL 20351658 via CL 20351677 via CL 20351695
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v948-20297126)

[CL 20353647 by patrick enfedaque in ue5-main branch]
2022-05-24 15:21:03 -04:00
JeanFrancois Dube
a2f7024803 Landscape: fix relative location mismatch detection.
#jira UE-153865
#rb patrick.enfedaque
#preflight none
#rnx

[CL 20351118 by JeanFrancois Dube in ue5-main branch]
2022-05-24 13:17:18 -04:00
jonathan bard
62f566009a Fixed random crash ocurring in HLOD builder commandlet, where we're hashing landscape texture source data while potentially asynchronously building textures. UTexture2D::GetSizeX() / UTexture2D::GetSizeY() should be prevented in those cases, since unlike in the landscape editor, nothing ensures that FinishCachePlatformData() is called on those textures and the returned sizes end up being wrong / thread-unsafe.
Also fixed a couple of places where we were not using the FTextureSource's data (even though those calls should be fine since they happen in a place where texture compilation is done)

#rb paul.chipchase
#jira UE-150653
#preflight 62829ff6216d06861f3b7ca9

[CL 20239776 by jonathan bard in ue5-main branch]
2022-05-17 05:21:54 -04:00
luc eygasier
8f5e6ffb66 Adds Landscape resolution restriction when in Restricted Mode (example: UEFN), preventing to create landscape if the wanted resolution exceed currently supported safe limits.
Applied to:
* New Landscapes, new imported landscape
* Import Landscape tool
* Add component tool

#jira UE-149015
#preflight 627e98d97c26e247735ca7d1
#rb Michael.Balzer, Jonathan.Bard

#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 20187875 via CL 20189504 via CL 20189506 via CL 20189507
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20191648 by luc eygasier in ue5-main branch]
2022-05-13 18:58:05 -04:00
Sebastien Lussier
c3f8b1ebf5 Corrected ALandscapeProxy::GetLODScreenSizeArray() which didn't handle MaxLODLevel == INDEX_NONE properly
* MaxLODLevel == INDEX_NONE means the max available
* Also fixed off-by-one error (Num LOD levels vs Max LOD level)
#jira UE-151563
#preflight 627ab701c42338be6528bc33

[CL 20127983 by Sebastien Lussier in ue5-main branch]
2022-05-10 15:19:25 -04:00
jonathan bard
e479ed3735 Fixed bHasLayersContent not being set properly for the main ALandscape actor in distributed landscape setups (One ALandscape, multiple ALandscapeStreamingProxy actors).
This meant that the test in ALandscapeProxy::PostRegisterAllComponents() to know whether data migration (from non-edit layers to edit layers) should occur, which relies on the cached value bHasLayersContent (which was always false in that case, since there's no landscape component in the ALandscape) and the result of virtual function HasLayersContent() (overridden in ALandscape::HasLayersContent to return true if there's at least one registered landscape edit layer) was always forcing data migration to occur, which would do nothing (no landscape component, hence, no data to migrate) but was still marking the level as dirty

#rb patrick.enfedaque
#preflight 627a67a610766ef8c1f3d590

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 20123696 via CL 20123706 via CL 20123718
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v943-19904690)

[CL 20125767 by jonathan bard in ue5-main branch]
2022-05-10 13:53:26 -04:00
Julien StJean
175d5f6ab4 Adding elements support for the marquee selection.
Added a new registry to let the objects provide how their elements should be selected when doing a selection by a volume such as a box or a frustum.
Added a some editor only functions for the marquee selection into the world interface.

#jira UETOOL-4797
#rb Brooke.Hubert
#preflight 624cb2dca64871f1a113bf2a

[CL 19727315 by Julien StJean in ue5-main branch]
2022-04-12 15:52:44 -04:00
jonathan bard
0660f91839 Added BP setters for ForcedLOD and LODBias on landscape components. SetLOD can now be called both at runtime and edit-time.
#rb luc.eygasier
[FYI] cody.haskell

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19720596 via CL 19720629 via CL 19720639 via CL 19720646
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)

[CL 19721952 by jonathan bard in ue5-main branch]
2022-04-12 11:31:39 -04:00
dmitriy dyomin
d5741f624b Added option to disable usage of a baked landscape mesh on mobile platforms (r.Mobile.LandscapeMesh)
#rb jack.porter

#ROBOMERGE-OWNER: dmitriy.dyomin
#ROBOMERGE-AUTHOR: dmitriy.dyomin
#ROBOMERGE-SOURCE: CL 19528072 via CL 19528235 via CL 19528695 via CL 19528703
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v937-19513599)

[CL 19532768 by dmitriy dyomin in ue5-main branch]
2022-03-28 16:28:57 -04:00
marc audy
a3275e4513 Move SystemGUIDs in to a cpp to avoid massive recompiles when changing
Convert landscape mobile cook version to system guid system
#jira
#rnx

#ROBOMERGE-OWNER: marc.audy
#ROBOMERGE-AUTHOR: marc.audy
#ROBOMERGE-SOURCE: CL 19346370 via CL 19352300 via CL 19352991 via CL 19355735
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19357735 by marc audy in ue5-main branch]
2022-03-11 13:08:58 -05:00
sebastien lussier
2ee1117eec #jira UE-144062
Fortnite Client Crash in FStreamingRenderAsset::UpdateStaticData when attempting to start a match on Android.

#preflight 6226e2b6671c913c0502a891
#rb patrick.enfedaque

#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 19302517 in //UE5/Release-5.0/... via CL 19303828
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v926-19321884)

[CL 19346847 by sebastien lussier in ue5-main branch]
2022-03-10 20:48:38 -05:00
luc eygasier
643ed6eea9 Undo //UE5/Main/Engine/Source/... changelist 19235312
Fixes uninitialized member in FLandscapePerLODMaterialOverride

#rb Jonathan.Bard
#jira UE-144566
#preflight 6220c3397e0217a606ee7545

Original CL Desc
* Removed incomplete per-platform per-LOD level material overrides for landscape. The code isn't meant to support that since material instances are built at edit-time. We would need to somewhat hack it at cook time in order to regenerate (and recompile) the list of material instances per-platform, which is not a recommended thing to to in the engine. Instead, we choose to simply make the per-LOD level material overrides constant across platforms since the recommended way is to customize the material for platforms using material expressions such as Quality Level switc, Shading Path Switc or Feature Level Switc.
* Deprecated/merged FLandscapeComponentMaterialOverride and FLandscapeProxyMaterialOverride into FLandscapePerLODMaterialOverride since they were identical
* Fixed UpdateLayersMaterialInstances which, unlike UpdateMaterialInstances, didn't take into account per-component material overrides

[CL 19242882 by luc eygasier in ue5-main branch]
2022-03-03 08:55:00 -05:00
eric mcdaniel
78d6c0d3f5 [Backout] - CL19230219
#rb none
#jira UE-144566
#preflight 62200fba943787f1d21ae8ae

#fyi luc.eygasier, Jonathan.Bard
Original CL Desc
-----------------------------------------------------------------
* Removed incomplete per-platform per-LOD level material overrides for landscape. The code isn't meant to support that since material instances are built at edit-time. We would need to somewhat hack it at cook time in order to regenerate (and recompile) the list of material instances per-platform, which is not a recommended thing to to in the engine. Instead, we choose to simply make the per-LOD level material overrides constant across platforms since the recommended way is to customize the material for platforms using material expressions such as Quality Level switc, Shading Path Switc or Feature Level Switc.
* Deprecated/merged FLandscapeComponentMaterialOverride and FLandscapeProxyMaterialOverride into FLandscapePerLODMaterialOverride since they were identical
* Fixed UpdateLayersMaterialInstances which, unlike UpdateMaterialInstances, didn't take into account per-component material overrides

From shelve 17931928 on behalf on Jonathan.Bard

#rb Jonathan.Bard
#jira UE-132031
#preflight 621cd5cd49723678579d9ec1

#ROBOMERGE-OWNER: luc.eygasier
#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 19221589 via CL 19223810 via CL 19223838 via CL 19226205
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19235312 by eric mcdaniel in ue5-main branch]
2022-03-02 20:08:32 -05:00
luc eygasier
e78d41114a * Removed incomplete per-platform per-LOD level material overrides for landscape. The code isn't meant to support that since material instances are built at edit-time. We would need to somewhat hack it at cook time in order to regenerate (and recompile) the list of material instances per-platform, which is not a recommended thing to to in the engine. Instead, we choose to simply make the per-LOD level material overrides constant across platforms since the recommended way is to customize the material for platforms using material expressions such as Quality Level switc, Shading Path Switc or Feature Level Switc.
* Deprecated/merged FLandscapeComponentMaterialOverride and FLandscapeProxyMaterialOverride into FLandscapePerLODMaterialOverride since they were identical
* Fixed UpdateLayersMaterialInstances which, unlike UpdateMaterialInstances, didn't take into account per-component material overrides

From shelve 17931928 on behalf on Jonathan.Bard

#rb Jonathan.Bard
#jira UE-132031
#preflight 621cd5cd49723678579d9ec1

#ROBOMERGE-OWNER: luc.eygasier
#ROBOMERGE-AUTHOR: luc.eygasier
#ROBOMERGE-SOURCE: CL 19221589 via CL 19223810 via CL 19223838 via CL 19226205
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19230219 by luc eygasier in ue5-main branch]
2022-03-02 16:51:01 -05:00
jonathan bard
dc0273093d Landscape edit layers local merge fixes :
* Fixed assert when updating heightmaps of different sizes
* Fixed crash when deleting components : the deleted components were still referenced in the shared weightmap texture usages

Misc:
* Properly delete edit layers heightmaps and weightmaps when deleting landscape components

#rb luc.eygasier
#jira UE-140551
#preflight 62164eea37178b0175ac9cf9

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19094154 via CL 19100022 via CL 19100646 via CL 19109891
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19147208 by jonathan bard in ue5-main branch]
2022-02-25 10:09:16 -05:00
jonathan bard
82943cf1f2 Fixed assert when cooking landscape components on mobile and creating materials
Cooking a ULandscapeComponent is updating a LandscapeMaterialInstanceConstant and the landscape MIC has already had BeginCacheForCookedPlatformData() called on it.

Here is what's happening:

UMaterialInstance::BeginCacheForCookedPlatformData is called for a Landscape MIC
This MIC's bHasStaticPermutationResource == false so no resources are cooked for the MIC.  The MIC's CachedMaterialResourcesForCooking is empty.
ULandscapeComponent::BeginCacheForCookedPlatformData is called on a Landscape component.
The Landscape component changes the MIC to have a static permutation and calls `CombinationMaterialInstance->UpdateStaticPermutation(StaticParameters, InMaterialUpdateContext);`
We then go to Save the MIC, which now has bHasStaticPermutationResource==true, but it doesn't have resources cached for cooking and triggers the assert.

The new code ensures we call `BeginCacheForCookedPlatformData` on any material instances created during landscape generation while cooking.

#rb jason.nadro
#preflight 620fb676be45100d32bccef9
#jira UE-142195

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 19081744 in //UE5/Release-5.0/... via CL 19096958
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v921-19075845)

[CL 19140598 by jonathan bard in ue5-main branch]
2022-02-24 23:20:47 -05:00
sebastien lussier
245f347384 #jira UE-132273
WorldPartition - Added Lanscape HLODs

Created a custom HLOD builder for ULandscapeComponent
* Landscape LOD used to generate the HLOD is autocomputed from the expected draw distance, same for the baked texture size

* Expose ALandscapeProxy::GetLODScreenSizeArray()
* Actually reverting changes done in CL 18794652 (moving proxy mesh creation back to ALandscapeProxy)
* ComputeLayerHash() now takes a bool to choose if we want to compute the hash for edition or runtime data
#preflight 620a60a1583261b0a6539c22
#rb Patrick.Enfedaque

#ROBOMERGE-AUTHOR: sebastien.lussier
#ROBOMERGE-SOURCE: CL 18980225 in //UE5/Release-5.0/... via CL 18980661 via CL 18981014
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v917-18934589)

[CL 18981050 by sebastien lussier in ue5-main branch]
2022-02-14 12:02:22 -05:00
robert manuszewski
97b5e82c0b Deprecating EInternalObjectFlags::PendingKill. Making sure iterators use the appropriate flags based on the current state of PendingKill being enabled or not.
#preflight 61f8f33d537702981c352c7a
#rb Steve.Robb

#ROBOMERGE-AUTHOR: robert.manuszewski
#ROBOMERGE-SOURCE: CL 18806353 in //UE5/Release-5.0/... via CL 18808526 via CL 18821789
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v908-18788545)

[CL 18822151 by robert manuszewski in ue5-main branch]
2022-02-02 02:21:12 -05:00
jonathan bard
2b57f2ff53 Local merge of landscape edit layers : complete refactor of the merge algorithm that doesn't require allocating several render targets the size of the entire loaded landscape components. Instead, each landscape component is merged individually and heightmaps/weightmaps are then resolved in several small batches. This allows working on large and/or partially loaded landscapes without overtaxing GPU memory.
* The new merge algorithm also speeds up the merging process by performing the merge operation in a single shader pass, which avoids intermediate clear/copies, even more so when dealing with several edit layers (O(n) -> O(1))
* Implemented via FRDGBuilder to benefit from transient memory allocation and optimal resource transitions.
* This is activated by a CVar (landscape.EditLayersLocalMerge.Enable, disabled by default) and disabled for landscapes containing BP brushes, since customers (similar to what the WaterBrushManager did) might have made the assumption that the merge is global and we don't want to break the existing landscapes.

For heightmaps:
* The algorithm is divided into several "component resolve batches" that render a list of neighboring components and merge all their edit layers into a single slice of a scratch texture array (first, copy all the edit layers texture subregions to a texture array then merge them in a single shader pass). Then those rendered components' borders are stitched (in order to mimic the behavior of global merge) so that there are no seams in between components even if they were not properly authored (i.e. one component authored while its neighbor was not loaded). Then normals are generated in another pass.
* In order to limit the amount of temporary copies of heightmaps, batches only render a max number of landscape components (including neighbor components), controlled by CVar landscape.EditLayersLocalMerge.MaxComponentsPerHeightmapResolveBatch. This means that a given component can effectively be rendered (i.e. merged) multiple times if it's needed for the computation of different batches but batches are built in a way to minimize this situation.
* Finally, mips are generated and the resulting heightmaps are copied to staging textures the same way they used to.

For weightmaps:
* The algorithm is divided into several "weightmap resolve batches" that render a list of components that participate to the output of a list of given weightmaps, processing each individual channel into a single slice of a scratch texture array (first, copy all the edit layers texture channels to a texture array then merge them in a single shader pass). Then, the weightmaps to resolve within the batch are finalized (i.e. individual, single-channel, weightmaps are packed into the final multi-channel weightmap), their mips are generated and the resulting weightmaps are copied to staging textures the same way they used to.
* In order to limit the amount of temporary copies of weightmaps, batches only render a max number of individual weightmaps, controlled by CVar landscape.EditLayersLocalMerge.MaxComponentsPerWeightmapResolveBatch. This means that a given weightmap can effectively be rendered (i.e. merged) multiple times if it's needed for the computation of different batches but batches are built in a way to minimize this situation.

Misc:
* Fixed RHI validation for GlobalMerge of weightmaps
* Moved landscape render resources to their own file to de-clutter LandscapeEditLayers.cpp a bit
* landscape.RenderCaptureLayersNextHeightmapDraws and landscape.RenderCaptureLayersNextWeightmapDraws now support capturing several draw calls
* Moved all intermediate containers (LandscapeComponentHeightmapsToRender/ToResolve, MapHelper, etc.) to a context object in order to centralize the local/global merge common structures. Note : the context is mutable and can be partially refreshed since weightmaps can be potentially added by the merge algorithms and therefore those structures were not up to date and we could miss reading back from newly-added weightmap textures
* Removed unused WeightmapLayersBlendSubstractive in global merge algorithm
* CVar commands landscape.Dirty and landscape.FixSplines now process all loaded game worlds

The next step is to re-work our internal brushes and provide a new API for them and user-implemented ones to work in the same fashion. Then the old BP brush API will be progressively phased out.

#rb sebastien.lussier, patrick.enfedaque
#tests full QA pass (UEENGQA-60460)
#preflight 61d8bc681f62d3ad4d728095

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18751747 via CL 18751748 via CL 18751754 via CL 18751906 via CL 18751983
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18751988 by jonathan bard in ue5-main branch]
2022-01-27 06:12:09 -05:00
jonathan bard
46bba37c7a Added Landscape Material to Edit asset context menus
#jira UETOOL-4891
#rb luc.eygasier
#preflight 61f14fee7266f4e79bcfb333

#ROBOMERGE-AUTHOR: jonathan.bard
#ROBOMERGE-SOURCE: CL 18734756 in //UE5/Release-5.0/... via CL 18734774 via CL 18734871
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18734881 by jonathan bard in ue5-main branch]
2022-01-26 09:06:50 -05:00
matt kuhlenschmidt
95b69ea1b5 Default landscape actor to collapse children in the world outliner
#rb jeanfrancois.dube
#preflight none

#ROBOMERGE-AUTHOR: matt.kuhlenschmidt
#ROBOMERGE-SOURCE: CL 18722966 in //UE5/Release-5.0/... via CL 18722975 via CL 18723178
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v903-18687472)

[CL 18723197 by matt kuhlenschmidt in ue5-main branch]
2022-01-25 11:06:30 -05:00
paul chipchase
62007de5f7 Removed USE_BULKDATA_STREAMING_TOKEN from the bulkdata API
#rb CarlMagnus.Nordin, pj.kack
#rnx
#jira UE-133429
#preflight 61e7c020b875abaf33179ccc

### Token Removal
- Now that we support the IoStore in the editor there is no reason to keep the bulkdata streaming token as both the editor and runtime systems can use the same code paths.
- Existing use of USE_BULKDATA_STREAMING_TOKEN will now give deprecation warnings however code should continue to work as long as STREAMINGTOKEN_PARAM was correctly used.
- ::CreateStreamingToken has been removed from the bulkdata api, but any calls to this should've been wrapped with #if USE_BULKDATA_STREAMING_TOKEN

### API Fixes
- We can remove all code that relied on USE_BULKDATA_STREAMING_TOKEN being == 1
- LANDSCAPE_LOD_STREAMING_USE_TOKEN required USE_BULKDATA_STREAMING_TOKEN to be enabled, so we can now assume that it is always 0 and remove the associated code paths.

#ROBOMERGE-AUTHOR: paul.chipchase
#ROBOMERGE-SOURCE: CL 18656055 in //UE5/Release-5.0/... via CL 18656061 via CL 18656063
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v900-18638592)

[CL 18656065 by paul chipchase in ue5-main branch]
2022-01-19 04:40:14 -05:00
JeanFrancois Dube
c9b42f60a3 Bring back CL 18595940 with support for changes done in Main:
World Partition Landscape Support
- Don't maintain a list of landscape proxy and spline handles from actor descriptors registration.
- Iterate through actor descriptors to gather landscape edges and load intersecting splines instead.

#rb patrick.enfedaque
#preflight 61e0619a250b9537f7792d3b

#ROBOMERGE-OWNER: JeanFrancois.Dube
#ROBOMERGE-AUTHOR: jeanfrancois.dube
#ROBOMERGE-SOURCE: CL 18600396 in //UE5/Release-5.0/... via CL 18600408 via CL 18600449
#ROBOMERGE-BOT: UE5 (Release-Engine-Test -> Main) (v899-18417669)
#ROBOMERGE-CONFLICT from-shelf

[CL 18601153 by JeanFrancois Dube in ue5-main branch]
2022-01-13 14:16:17 -05:00