Commit Graph

49 Commits

Author SHA1 Message Date
jason hoerner
61ec1be384 Animation Memory: 17.7 MB savings in array slack.
* 14.3 MB:  Reserve space in CurvePoseSourceIndices members in AnimNode_BoneMask and AnimNode_LayeredBoneBlend based on the exact amount used.  Many nodes don't use this feature, so the array ends up empty, but in other cases, less than 5% of the reserve is used.
* 3.4 MB:  Eliminate Reserve for QueuedTransitionEvents member in AnimNode_StateMachine.  Reserve is wasteful because it's deleted anyway by a Shrink call in FAnimNode_StateMachine::Update_AnyThread for active state machines, and only ends up sticking around for inactive state machines, where it's irrelevant, so it doesn't affect performance to take this out.

#rnx
#rb thomas.sarkanen jose.villarroel

[CL 29601012 by jason hoerner in ue5-main branch]
2023-11-09 12:34:49 -05:00
john vanderburg
a18729897b Crash fix in the layered bone blend node, basically undoing previous optimizations.
#trivial
#rb thomas.sarkanen
#swarm none

[CL 29041783 by john vanderburg in ue5-main branch]
2023-10-24 06:20:27 -04:00
thomas sarkanen
38c05e8619 Anim graph optimizations
Implemented ISPC versions of missing layered blend per bone hot paths.
Tweaked inlining and added ptr RESTRICT to various curve operations
Removed array copy in control rig node curve outputs
Increased inline alloc size of cached poses to reduce allocations
Removed refpose copies and allocations with linked anim graphs (these can be skipped now the bone containers are all centralized)

#rb Nicholas.Frechette,Jurre.deBaare
#tests Juno, NoMcp

[CL 28371404 by thomas sarkanen in ue5-main branch]
2023-10-02 05:23:05 -04:00
Thomas Sarkanen
502797ca50 Animation Curve Runtime & Editor Improvements
Runtime notes:
- Removes 'smart name' usage across the animation systems.
- Changed curve blending from a uniform array (sized per skeleton) to a sparse array of sorted named values. Blends and other combiners are performed using a dual iteration 'tape merge'.
- Skeleton curves are no longer guaranteed to cover all curve names that can be found at runtime.

Editor notes:
- Curve metadata (flags, bone links etc.) is still present on the skeleton, but can also now exist on a skeletal mesh
- Curve metadata (for morph targets) is still populated on import
- Curves can now be used arbitrarily at runtime

New features:
- New Find/Replace dialog that allows for batch-replacing curves and notifies across all of a project's assets
- New curve debugger tab in various Persona editors that allows for viewing curve values live. This also now allows viewing curves for specific pose watches.
- Pose watches now output curve tracks to the Rewind Debugger

#rb Jurre.deBaare,Nicholas.Frechette,Sara.Schvartzman,Helge.Mathee,Kiaran.Ritchie,Jaime.Cifuentes,Martin.Wilson,Keith.Yerex,Andrean.Franc (and more!)
#jira UE-167776
#jira UE-173716
#jira UE-110407
#preflight 63fc98c81206d91a2bc3ab90
#preflight 63f3ad4f81646f1f24c240c2

[CL 24421496 by Thomas Sarkanen in ue5-main branch]
2023-02-27 07:20:58 -05:00
jaime cifuentes
39bb9b978b Truncation fixes for AnimationGraphRuntime module
#rb @thomas.sarkanen
#jira UE-166634
#preflight 63591a0a764df4711e65c76e

[CL 22776099 by jaime cifuentes in ue5-main branch]
2022-10-26 07:34:18 -04:00
marc audy
311f7464bf Updated ../Engine/Source/Runtime/... to inline gen.cpp files
Before:
3648 unity files
Total CPU Time: 47886.140625 s
Total time in Parallel executor: 498.81 seconds

After:
3548 unity files
Total CPU Time: 46643.828125 s
Total time in Parallel executor: 486.06 seconds

#jira
#preflight

[CL 22173263 by marc audy in ue5-main branch]
2022-09-24 13:57:58 -04:00
thomas sarkanen
af32e124a1 Added the ability to specify blend profiles/masks to the layered blend per bone node
Enables use of layered blends in template animation blueprints

#jira UE-137671
#rb Jose Villarroel
#preflight 632c74aca4769ad714ac21c8

[CL 22145944 by thomas sarkanen in ue5-main branch]
2022-09-22 17:40:51 -04:00
Jurre deBaare
bf737517f7 AnimNode_LayeredBoneBlend BlendWeight bug when using LODThreshold
#jira UE-149026
#fix rely on bHasRelevantPoses=false to skip evaluating poses rather than zero-ing out the blendweight array - that way they are also 'cached' for when the node becomes relevant again given the LOD
#rb Thomas.Sarkanen
#preflight 6315e12c2b7fe03eb6286b1c

[CL 21790994 by Jurre deBaare in ue5-main branch]
2022-09-05 07:56:40 -04:00
jose villarroel
c511833e59 Fix for crash in FAnimNode_LayeredBlendPerBone::Update when weights array is empty
#jira UE-160976
#review-21458108 @Thomas.Sarkanen
#rnx
#preflight 63039378a45b007ea23e60a2

[CL 21483753 by jose villarroel in ue5-main branch]
2022-08-22 10:53:14 -04:00
thomas sarkanen
572b5fc0cd Fixed crash compiling a template animation blueprint with a layered blend per bone node in it
#jira UE-146422
#preflight 625ecdca3e0f6f80adb39d51
#rb Jurre.deBaare

#ROBOMERGE-AUTHOR: thomas.sarkanen
#ROBOMERGE-SOURCE: CL 19845750 in //UE5/Release-5.0/... via CL 19846121
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v940-19807014)

[CL 19846531 by thomas sarkanen in ue5-main branch]
2022-04-21 06:46:05 -04:00
samuele rigamonti
5c829b13df Fix for LayeredBoneBlend improper handling of invalid curve weight values
[REVIEW] [at]Jose Villarroel
#preflight 624df9c3334cad33ce031e73

#ROBOMERGE-AUTHOR: samuele.rigamonti
#ROBOMERGE-SOURCE: CL 19656522 via CL 19657139 via CL 19657278
#ROBOMERGE-BOT: UE5 (Release-Engine-Staging -> Main) (v938-19570697)

[CL 19665914 by samuele rigamonti in ue5-main branch]
2022-04-07 04:38:07 -04:00
Thomas Sarkanen
6adfe86822 Fix crashes, inconsistencies and performance issues with layered blend per bone node
Introduces a serial number to FBoneContainer that allows easier refreshing of bone-relative data. Eventually the overall CacheBones path could be superseded with lazy-update systems based on this serial number.

#jira UE-116464 - Layered blend per bone crash
#rb Jurre.deBaare

[CL 16466917 by Thomas Sarkanen in ue5-main branch]
2021-05-26 07:55:41 -04:00
Thomas Sarkanen
3f6391e553 Backing out CL 16112742
#jira UE-114336
#jira FROST-2388
#fyi Helge.Mathee

[CL 16122604 by Thomas Sarkanen in ue5-main branch]
2021-04-27 05:25:49 -04:00
Thomas Sarkanen
8d90aee030 Revert optimization for layered bone per blend
This can cause crashes in certain graph configurations (e.g. when within a state machine, Initialize can be called without a CacheBones call directly afterwards)

#rb Jurre.deBaare

[CL 16112742 by Thomas Sarkanen in ue5-main branch]
2021-04-26 06:34:27 -04:00
Jurre deBaare
2c933f4825 New Animation Attributes system, replacing Custom Attributes:
+ Attribute structures to UAnimDataModel
    * These are sampled/copied into AnimSequence whenever they change
+ Attribute related Notifies and Payloads
+ Controller API and Actions for Attribute related behaviour
+ Type traits (TAttributeTypeTraitsBase) to determine support functionality for user-defined attribute types
+ TAttributeContainer equivalent to TCustomAttributes, used for keeping track of attributes at runtime in a TMap similar fashion
    * Has two exported specializations FStack/Heap-AttributeContainer
+ IAttributeBlendOperator interface used for Attribute related operations in Anim graph
    * Allows for user-defined blending behaviour for their associated types
+ TAttributeBlendOperator providing out-of-the-box blending behaviour for user-defined types
+ FAttributeBlendData helper structure, this encapsulates and abstracts the blend / attribute operations
    * Exposes two iterators, allowing BlendOperator to loop through (type) overlapping Attributes and unique attributes
+ Float/Integer/String Animation Attribute structures used to support legacy TVariant CustomAttribute data types
+ Transform animation attribute structure to add support for single-FTransform based attributes
+ FAnimationAttributeIdentifier identifier used to reference an attribute in a script-friendly manor
+ AttributeTypes static API for registering Attribute types
+ FAttributeCurve providing a curve-type with an Attribute type as its underlying key-value
+ TWrappedAttribute helper structure to wrap end template operate on raw memory (TArray buffer)
+ Added tests for
    * Attribute related controller functionality and actions
    * Attribute curve key reduction
    * Evaluating attributes from AnimSequence
    * Attribute operations (blend, accumulate etc)
    * Functional testing for blendspace attribute evaluation and blending

* Changed default attribute blend type to Blend vs Override
* Updated FBX import/export paths to handle and use new Attribute data structures
* Attribute data is now incorporated into animation source data DDC key
* Deprecated Custom Attributes stored on AnimSequence get converted into their equivalent Attribute structures
* Deprecated all previous CustomAttribute structures, APIs and files
* Corrected some comments in UAnimDataController.h
* Updated existing custom attribute tests to adhere to new blend expectations/behaviour
* Updated AnimSequence resize tests to also incorporate an attribute curve
* Changed layered bone blend to use .5 blend weight vs 1.0 to cover more behaviour
* Added transform attribute used to compare against bone transform during pre-existing functional testing (blended only)

- Deleted CustomAttributes details customization

#rb Thomas.Sarkanen
#fyi kiaran.ritchie, koray.hagen, timothy.daoust

[CL 15568420 by Jurre deBaare in ue5-main branch]
2021-03-02 09:04:09 -04:00
jose villarroel
3b7d2ea62e -Added Blend Profile mode selection to blend profile picker.
-Added option to blend profile picker for blend mask creation.
-Fixed issue w/ Blend profile picker sometimes showing in non-standalone mode outside of skeleton editor.
-Fixed issue w/ reset to default w/ blend profiles.
-Added blend mask mode to layered blend per bone node
#jira UE-101586
#review-14761881 @Aaron.Cox, @John.VanDerBurg, @Thomas.Sarkanen

[CL 14798723 by jose villarroel in ue5-main branch]
2020-11-20 15:02:56 -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
ryan durand
0f0464a30e Updating copyright for Engine Runtime.
#rnx
#rb none


#ROBOMERGE-OWNER: ryan.durand
#ROBOMERGE-AUTHOR: ryan.durand
#ROBOMERGE-SOURCE: CL 10869210 via CL 10869511 via CL 10869900
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870549 by ryan durand in Main branch]
2019-12-26 14:45:42 -05:00
Robert Manuszewski
7b6f840f7f Copying //UE4/Dev-Core @ 10708550 to Dev-Main (//UE4/Dev-Main)
#rb none

[CL 10708666 by Robert Manuszewski in Main branch]
2019-12-13 11:07:03 -05:00
thomas sarkanen
ef46502ca2 Spawning optimizations
A collection of major and minor optimizations to anim instance initialization.

Major:
- Added defered root node init. When an anim instance is set to init to refpose, this defers the first call to initialize the blend tree until just before the first Update() call, on a worker thread.
- Skip ConditionallyCacheBonesForState in state machines in the case where we would call CacheBones_AnyThread during first Initialize_AnyThread. This avoids duplicate work being done, as graph traversal counters will let through sychronization calls if they have yet to be updated (ie. their count is INDEX_NONE).
- Cache access to nodes that need pre-update, dynamic reset, one-time initialization, as well as state machines in the generated class to avoid iterating all anim nodes on initialization.

Minor:
- Cache access to node properties when re-linking nodes to avoid duplicate memory round-trips.
- Cache access to LUT size in FBaseBlendedCurve::GetValidElementCount, avoiding duplicate memory round-trips.
- Prevent FName rehashing from string (intended to strip whitespace) when initializing FBoneReferences.
- Cache access to AnimCurveMapping smart name container on USkeleton, preventing a TMap lookup every time we access the smart name container.
- USkeleton::GetCurveMetaData now uses a 'fast path' when accessing using smart name UID. In this case we can avoid the TMap lookup as the UID is always a direct index to metadata at runtime (slow path still applies in editor builds).
- Avoid calling FAnimNode_LayeredBoneBlend::ReinitializeBoneBlendWeights in Initialize_AnyThread, as CacheBones_AnyThread will be called straight after anyways.
- Cache access to curve UID count and LinkedBones array in FAnimNode_LayeredBoneBlend::ReinitializeBoneBlendWeights, avoiding duplicate memory round-trips.

Upgrade notes:
- Breaking change! Custom anim nodes that implement OnInitializeAnimInstance now need to return true for the new accessor NeedsOnInitializeAnimInstance to be called at init time.
- The meaning of HasPreUpdate and NeedsDynamicReset has changed slightly. Previously these were called at init time, so if their results were mutable it was possible to re-init an anim instance with new settings. Now they are called at CDO load time this is no longer possible.

#rb Martin.Wilson


#ROBOMERGE-SOURCE: CL 8686415 via CL 8686419 via CL 8689513
#ROBOMERGE-BOT: (v422-8689730)

[CL 8695271 by thomas sarkanen in Main branch]
2019-09-16 13:01:26 -04:00
helge mathee
a6a2a333c0 Final copy-up for Control Rig Task Stream.
Merging using Fortnite_Main<->Fortnite_ControlRig

#rb none


#ROBOMERGE-OWNER: helge.mathee
#ROBOMERGE-AUTHOR: helge.mathee
#ROBOMERGE-SOURCE: CL 7321580 via CL 7323175
#ROBOMERGE-BOT: (v371-7306989)

[CL 7323351 by helge mathee in Main branch]
2019-07-16 11:49:59 -04:00
braeden shosa
eb090a4b0d Workaround for CurvePoseIndex out of bounds crash
[CODEREVIEW] Lina.Halper, Laurent.Delayen, Aaron.Cox
#rnx


#ROBOMERGE-SOURCE: CL 7014082 via CL 7016740 via CL 7016747 via CL 7016816 via CL 7020855
#ROBOMERGE-BOT: (v367-6836689)

[CL 7020952 by braeden shosa in Main branch]
2019-06-14 19:46:23 -04:00
braeden shosa
509549ad1d Minor tweaks for code style
[FYI] Lina.Halper


#ROBOMERGE-SOURCE: CL 6670532 via CL 6672178
#ROBOMERGE-BOT: (vundefined-6665479)

[CL 6673894 by braeden shosa in Main branch]
2019-05-29 23:50:45 -04:00
braeden shosa
a129a71c8b Layered blend per bone node now has an option "Mesh Space Scale Blend" which performs scale blending in mesh space instead of local space.
Useful for fixing scaling issues arising from "Layered blend per bone" node. For example, when blending lower body locomotion with upper body aiming and feathering the lower body weight up the spine, scaling on the spine can propogate through the skeleton to the hands causing them to drift from the weapon. This removes the need to manually fixup the spine's scale after blending the poses.

BlendMeshPosesPerBoneWeights and BlendLocalPosesPerBoneWeights are now folded into a single function: BlendPosesPerBoneFilter.

[CODEREVIEW] Lina.Halper, Laurent.Delayen, Aaron.Cox
#rns


#ROBOMERGE-SOURCE: CL 6661692 via CL 6661829
#ROBOMERGE-BOT: (vundefined-6654089)

[CL 6661835 by braeden shosa in Main branch]
2019-05-28 22:17:05 -04:00
lina halper
91e83082d0 Layer node initialization fix
#rb: Martin.Wilson
#jira: FORT-113893


#ROBOMERGE-SOURCE: CL 5768200 via CL 5768201 via CL 5768840 via CL 5770648

[CL 5770764 by lina halper in Main branch]
2019-04-05 19:59:44 -04:00