Commit Graph

64 Commits

Author SHA1 Message Date
brett miller
8efa2a42b0 FractureTool
-- implemented HideUnselected mode

#jira UE-121963
#rb brice.criswell
#preflight 6123317d9db7df0001e5e4ff
#p4v-cherrypick 17309979

#ROBOMERGE-SOURCE: CL 17359069 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v865-17346139)

[CL 17359084 by brett miller in ue5-release-engine-test branch]
2021-08-30 17:11:38 -04:00
dmitriy dyomin
b0828d6beb Mobile specific implementation for auto-instancing. (disabled by default atm)
Run a compute job that packs most commonly used instance data (LocalToWorld matrix and some other bits - 80 bytes) into per-instance vertex buffer. Vertex shader does not have access to GPUScene and instead loads instance data from a per-instance vertex buffer. If it needs more primitive/instance data than available then it will load it from Primitive UB, binding unique uniform buffer and breaking auto-instancing. Pixel shader has a full access to a GPUScene
There are 3 ways how FSceneDataIntermediates gets populated
 1. PrimitiveId + GPUScene (Desktop)
 2. Per-Instance data + Primitive UB (Mobile)
 3. Primitive UB (auto-instancing disabled)
Details for GPUScene specific vertex inputs and access to FSceneDataIntermediates are hidden behind a macro:
VF_GPUSCENE_DECLARE_INPUT_BLOCK
VF_GPUSCENE_GET_INTERMEDIATES
FSceneDataIntermediates is now stored in FVertexFactoryIntermediates, FMaterialVertexParameters. Added a few GetPrimitiveData() overloads that allows you to access PrimitiveData depending on current context. Removed most of the cases where GetPrimitiveData() gets used with PrimitiveId.
#rb Ola.Ollson

#ROBOMERGE-SOURCE: CL 17093848 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v853-17066230)

[CL 17093856 by dmitriy dyomin in ue5-release-engine-test branch]
2021-08-07 07:20:52 -04:00
brett miller
83478abc70 GeometryCollectionSceneProxy
-- check for existence of PerBoneHitProxy before accessing it

#jira UE-112900
#rb none

#ROBOMERGE-SOURCE: CL 16778237 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v836-16769935)

[CL 16778242 by brett miller in ue5-release-engine-test branch]
2021-06-24 16:38:40 -04:00
graham wihlidal
860e7f89bb De-interleaved dynamic/material/uncommon data from FPrimitiveInstance into separate data streams to reduce CPU memory footprint, and an upcoming change will also de-interleave this data on the GPU, dramatically saving GPU memory/performance, and also optimizing GPU Scene uploads. This is a mid-refactor change with some crufty temporary code in places since the GPU memory is still interleaved, but it should be removed soon.
#rb brian.karis
[FYI] krzysztof.narkowicz, michal.valient, ola.olsson
#preflight 60ca8449634cd100013c3673

#ROBOMERGE-SOURCE: CL 16699435 via CL 16699447
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v835-16672529)

[CL 16699461 by graham wihlidal in ue5-release-engine-test branch]
2021-06-16 20:44:01 -04:00
graham wihlidal
f602dcf242 Big cleanup/refactor of InstanceData* (renamed to InstanceSceneData* to match many other places already calling it that, and to disambiguate upcoming changes that add another instance data buffer to GPU Scene for arbitrary data payloads). This change also removes the virtuals on FPrimitiveSceneProxy for the instance list along with lots of copy paste code for all the derived types, and instead makes it a built-in feature of the base proxy (since nearly everything supports GPU Scene instancing now).
#rb ola.olsson
[FYI] brian.karis
#preflight 60c4d5c586ce760001377f2a

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16660135 via CL 16660883
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v834-16658389)

[CL 16660909 by graham wihlidal in ue5-release-engine-test branch]
2021-06-14 13:43:26 -04:00
ola olsson
d19093164a Tracking GPU-Scene dirty state and specialize Primitive Id only updates to avoid redundant uploads.
- Added instance data validation
- Added general load balancer for instance processing on GPU (will move to own files later)
- Added initial GPU-side write access API for GPU scene.
- Addded specialized kernel to update primitive IDs in instances when that is the only change.

#rb graham.wihlidal
#jira UE-116671
#preflight 60c25d7b1264df0001aab80b

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

[CL 16628550 by ola olsson in ue5-release-engine-test branch]
2021-06-10 15:47:04 -04:00
graham wihlidal
0ee0bbe666 Removed LocalToWorld and PrevLocalToWorld from FPrimitiveInstance (instead the concatenating of instance and primitive transforms happens during SoA construction right before GPU Scene upload). In the future we'll also have a custom GPU Scene upload kernel that can do things like the concatentation (among other derivations) right on the GPU, but not affect the hot path of stuff like GetInstanceData(). This change also renames (Prev)InstanceToLocal to (Prev)LocalToPrimitive to make a lot more sense than the previous naming.
#rb ola.olsson, krzysztof.narkowicz, rune.stubbe
[FYI] brian.karis, jason.nadro

#ROBOMERGE-SOURCE: CL 16614552 via CL 16614986
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)

[CL 16615041 by graham wihlidal in ue5-release-engine-test branch]
2021-06-09 19:10:52 -04:00
graham wihlidal
70093e350c Instance data optimization - removed RenderBounds member, and refactored LocalBounds
#rb ola.olsson
[FYI] brian.karis, rune.stubbe, krzysztof.narkowicz

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16590738 via CL 16590845
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v828-16531559)

[CL 16590853 by graham wihlidal in ue5-release-engine-test branch]
2021-06-08 15:19:37 -04:00
graham wihlidal
67923137a7 More instance data memory and CPU optimizations, and general refactoring.
* Moved Nanite resource ID and hierarchy offset back to primitive data (indirection cost is largely noise these days, and memory savings is more important - GetInstanceData() fetches this data and stores in the pre-existing registers so all the callsites don't have to worry about it).
* Removed FNaniteInfo from FPrimitiveInfo (and the type itself) in favor of just having a 32bit per-instance hierarchy root offset. Hierarchy offset and runtime resource ID just sourced from primitive.
* Removed PrimitiveID from CPU instance data (GPU still needs it). This value was redundantly stored per-instance, and now the GPU Scene upload just blits it over from primitive when the instance data is uploaded.
* Added new virtual GetNaniteResourceInfo on FPrimitiveSceneProxy that retrieves the Nanite resource ID and hierarchy offset stored on a given primitive (needed now that FPrimitiveInstance doesn't cache a copy). The non-virtual FPrimitiveSceneProxy::IsNaniteMesh() helper is used to avoid this virtual function call for non-Nanite proxies.
* Removed deprecated and no longer referenced Nanite::FResources array on FNaniteGeometryCollectionSceneProxy
* Removed expensive per-instance checks() in a few spots
* Stubbed out upcoming per instance payload allocator offset
* Removed deprecated and never referenced non-GPUScene GetInstanceData uniform buffer path
* Significantly cleaned up and optimized a lot of ISM instance data retrieval, including avoiding unnecessary FRenderTransform <-> FMatrix conversions.
* Removed GetInstanceShaderValues API, it was inefficient and annoying to require retrieval of all parameters when often only one or two of them were ever used. In some cases even the origin was unused but .w was needed because of the per-instance random packing.
* Implemented explicit GetInstanceRandomID() accessor to fetch (under current packing) Origin.W without exposing this to the callsites
* Implemented public API for GetInstanceLightMapData(), since the internal version was only accessible by GetInstanceShaderValues()
* Renamed GetInstanceShaderCustomDataValues() -> GetInstanceCustomDataValues() for API consistency

#rb jason.nadro, krzysztof.narkowicz
[FYI] rune.stubbe, brian.karis


#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16583156
#ROBOMERGE-BOT: (v828-16531559)
#ROBOMERGE-CONFLICT from-shelf

[CL 16583193 by graham wihlidal in ue5-main branch]
2021-06-07 23:55:28 -04:00
graham wihlidal
c850a02c69 Implemented a new WIP type called FRenderTransform that (for now) represents instance transforms as a float 4x3 matrix - in the future we expect a much tighter per-instance encoding (for example: 12bytes for position, 4bytes for rotation, 6bytes for scale), so this type can be optimized in that direction. Other than saving hundreds of MB in *heavy* instance scenes, faster updates/uploads, etc.. this type could be used to represent a transform that stays 32bit w/ a rebase offset. Passing around ambiguous FVector and FMatrix data is bound to get us into trouble, whereas a concrete type we can reason about for transforms in render-only code makes a good deal of sense.
This change is another basis for more instance data and GPUScene improvements coming down the pipe.

#rb jason.nadro, krzysztof.narkowicz, zach.bethel, zak.middleton, rune.stubbe, ben.woodhouse
[FYI] brian.karis, ola.olsson
#preflight 60b9608d0249c300016598de


#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16555619
#ROBOMERGE-BOT: (v828-16531559)
#ROBOMERGE-CONFLICT from-shelf

[CL 16555914 by graham wihlidal in ue5-main branch]
2021-06-03 21:10:11 -04:00
jimmy andrews
8a78138782 Add option to use full precision UVs on geometry collection scene proxy
#rb brett.miller, tyson.brochu, david.hill
#preflight 60b6645c5719ca0001388544

#ROBOMERGE-SOURCE: CL 16518423 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v826-16501804)

[CL 16518431 by jimmy andrews in ue5-main branch]
2021-06-01 14:20:47 -04:00
brett miller
272e3f018e FGeometryCollectionSceneProxy
-- dtor releases DynamicData instead of deleting it.

#jira UE-115064
[FYI] benn.gallagher

#ROBOMERGE-SOURCE: CL 16511485 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v826-16501804)

[CL 16511488 by brett miller in ue5-main branch]
2021-05-31 22:01:58 -04:00
Ola Olsson
df492855e0 Removed GPUCULL_TODO define (fixed in on-state)
#preflight 60acc49b58f02e0001a0a996
#rb graham.wihlidal,Arciel.Rekman,Brandon.Schaefer,will.damon

[CL 16446355 by Ola Olsson in ue5-main branch]
2021-05-25 08:15:14 -04:00
brett miller
d603e260ae GeometryCollection
-- Fixed namespace collision

#jira none
#rb none

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

[CL 16370331 by brett miller in ue5-main branch]
2021-05-18 13:07:36 -04:00
peter knepley
e07885e125 GeometryCollection
-- Support for Nanite to GeometryCollection conversion
-- Support for multiple UV sets

#jira UE-114992
#rb jimmy.andrews
[FYI] brice.criswell

#ROBOMERGE-OWNER: peter.knepley
#ROBOMERGE-AUTHOR: brett.miller
#ROBOMERGE-SOURCE: CL 16363667 in //UE5/Private-Frosty/...
#ROBOMERGE-BOT: STARSHIP (Private-Frosty -> Main) (v804-16311228)
#ROBOMERGE-CONFLICT from-shelf

[CL 16370251 by peter knepley in ue5-main branch]
2021-05-18 13:03:42 -04:00
graham wihlidal
36beb84c0e - Added the ability to disallow falling back to proxy meshes if Nanite isn't supported by the platform (or if it is, but atomics are not supported). Default is proxy rendering, but some projects may not be built with proxy fallback in mind. Controlled with r.Nanite.ProxyRenderMode (0=fallback, 1=never render, 2=never render except SM editor toggle).
- Require 64bit atomic support for Nanite by default now (r.Nanite.RequireAtomic64Support=1)
- Cleaned up a bunch of cvar component reattach callbacks to use lambdas instead of redundant global functions
- Added UStaticMesh::HasValidNaniteData() as a helper to check if an asset has valid Nanite data
- Improved Nanite unsupported on screen error message so that we don't asks the user to update GPU drivers on a console :)

#rb nick.whiting
#jira UETOP-1646
[FYI] brian.karis, michal.valient

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16363554 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v804-16311228)
#ROBOMERGE-CONFLICT from-shelf

[CL 16363648 by graham wihlidal in ue5-main branch]
2021-05-17 22:54:18 -04:00
cedric caillaud
591b22bf99 Fix rendering of GeometryCollection with LWC on
- change matrix types for dynamic data to be explicitly using float
- wrapped update of vertex buffer to ensure type check
- When LWC mode is on, convert double based matrices to they float equivalent ( sub-optimal, but necessary for now until we have a better way )

#jira UE-115570
#fyi brice.criswell, brett.miller

[CL 16333456 by cedric caillaud in ue5-main branch]
2021-05-14 15:26:37 -04:00
graham wihlidal
32e893af72 Fix for race condition where GCs might reach the call to RequestGPUSceneUpdate() on initial proxy creation before the primitive scene info has a valid index (entry in GPU Scene bookkeeping), causing the updates to silently skip. Normally this problem doesn't affect the majority of GCs, since most GCs have identify transforms in rest pose, except some GCs authored in external DCC tools could use non-identify transforms that wouldn't be correctly uploaded to GPUScene until simulation would start. Also took the time to remove the virtual function calls on IsNaniteMesh() and IsAlwaysVisible() since these are called super heavily in frustum culling and init views on the CPU.
#rb brett.miller
[FYI] brice.criswell, nick.whiting, brian.karis
#jira UE-115088

#ROBOMERGE-SOURCE: CL 16261925 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v799-16237190)

[CL 16264515 by graham wihlidal in ue5-main branch]
2021-05-11 01:18:05 -04:00
brett miller
4e958929e7 GeometryCollectionSceneProxy - Properly initialized LocalToWorld transform on Nanite scene proxy.
#jira UE-115088
#rb brice.criswell
#lockdown nick.whiting

#ROBOMERGE-SOURCE: CL 16261304 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v799-16237190)

[CL 16264510 by brett miller in ue5-main branch]
2021-05-11 01:17:48 -04:00
brett miller
6395ede18b GeometryCollectionSceneProxy
-- OnMotionEnd now resets instance transforms as well as component transforms.

#jira UETOP-1546
#rb brice.criswell
#lockdown nick.whiting

#ROBOMERGE-SOURCE: CL 16198557 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v796-16191650)

[CL 16198575 by brett miller in ue5-main branch]
2021-05-04 16:15:19 -04:00
graham wihlidal
254c5dedc9 Corrected OnMotionBegin/OnMotionEnd to run on the render thread, and refactored the previous in motion logic to use the new events.
#jira UETOP-1595
#rb brett.miller
#lockdown nick.whiting
[FYI] brice.criswell

#ROBOMERGE-SOURCE: CL 16178780 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v792-16166999)

[CL 16178783 by graham wihlidal in ue5-main branch]
2021-05-01 21:33:36 -04:00
brett miller
3e4e8bd152 GeometryCollectionComponent
-- Added state machine logic and scene proxy callbacks for triggering when motion begins and ends.

#jira UETOP-1546
#rb graham.wihlidal
#lockdown nick.whiting

#ROBOMERGE-SOURCE: CL 16178376 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v792-16166999)

[CL 16178381 by brett miller in ue5-main branch]
2021-05-01 17:51:29 -04:00
graham wihlidal
efab24f960 Fix duplicate symbol unity build error
#rb trivial
#lockdown nick.whiting

#ROBOMERGE-SOURCE: CL 16151929 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)

[CL 16151940 by graham wihlidal in ue5-main branch]
2021-04-28 21:27:58 -04:00
graham wihlidal
28742c1787 Fixed locked previous GC transforms (locked motion blur) by detecting dynamic->static transition and resetting previous transforms to current.
#rb brice.criswell
[FYI] brett.miller
#lockdown nick.whiting

#ROBOMERGE-SOURCE: CL 16150932 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)

[CL 16150970 by graham wihlidal in ue5-main branch]
2021-04-28 19:53:28 -04:00
graham wihlidal
0fa361fa13 Fixed Nanite geometry collection velocity vectors, and optimizing transform updates for dummy GPU scene instance culling placeholders. Scene proxies can now fully own the concatenation of transform updates and avoid doing incorrect or redundant work during GPU Scene updates.
#jira UETOP-1352
#rb brandon.dawson
[FYI] ola.olsson, brian.karis, brice.criswell, brett.miller, michal.valient
#lockdown nick.whiting

#ROBOMERGE-OWNER: graham.wihlidal
#ROBOMERGE-AUTHOR: graham.wihlidal
#ROBOMERGE-SOURCE: CL 16141209 in //UE5/Release-5.0-EarlyAccess/...
#ROBOMERGE-BOT: STARSHIP (Release-5.0-EarlyAccess -> Main) (v789-15992632)
#ROBOMERGE-CONFLICT from-shelf

[CL 16141875 by graham wihlidal in ue5-main branch]
2021-04-28 05:36:47 -04:00