[Documentation]How to use Blend Depth in Layered blend per bone node?

67478-5827-layeredblendperbone_screengrab.jpg

Hello! In AnimGraph you can create Layered blend per bone node, within settings you can see “Blend Depth”.How to use this ‘Blend Depth’ properly? What if I type -3 or 2 or 0 value? In documentation about using Additive animation I see: " Under Bone Name enter spine_01, then set Blend Depth to 1…" Why exactly 1? Thanks!

I believe the blend amount increases by 1.f/(float)BlendDepth for each bone up to a max of 1.f, so using a value of 2 will give you 1 → 0.5, or 3 will be 1 → 0.6 → 0.3 etc.

Look at line 1111 in Engine/Source/Runtime/Engine/Private/Animation/AnimationRuntime.cpp - this is the only place it seems to actually be used apart from its declaration in the struct.

Yeah, so I don’t see this documented anywhere but TVinforest’s picture and your answer were helpful. I had thought the depth were how many bones after the chosen bone would be affected (was trying to affect spine->head without affecting arms).

Now I understand that the depth is for how the blend strength is distributed and you can use -1 to disable a bone and it’s children. Thanks.

Those answers seem wrong.

Think of a finger – in most rigs it has a bone depth of 3 bones from the knuckles (or 4 if you start at the wrist)
so if you put bone name “ringfinger”, with bone depth of 3, all the joints for that finger will be considered, assuming they are nested properly

Bone depth isn’t a control of weighting or distribution for the node’s various input poses. That’s what Blend Weights do. Depth is a numerical way to count down a rig’s joint nesting. For example, your palm bone may have several nested bones at depth1 (knuckles). It is included as an efficiency measure so you don’t have to create a larger array of per bone entries than you really need to.

Setting a bone depth of -1 might well disable a blend pose because you’re clamping what can be affected to nothing, but that’s a side effect.

If I’m wrong I’d like to know.

Yeah this deserves an answer from Epic. This answerhub page is first result in a google search for “Layered Blend Per Bone”, and the docs for this node Blend Nodes | Unreal Engine Documentation don’t even mention the blend layer setup parameters at all?

Reading the accepted answer and looking at the source, I have to agree with their interpretation. However the name of the field Blend Depth would make much more sense in your interpretation as a way of denoting how far down the hierarchy the blend applies. Confusing. A tooltip would certainly help.

yes, it would be nice for that page to get an update , and an official answer on this post from Epic please…

This looks correct. In UE4.20, same source file, line 1302-1317 it appears to be a scaling factor when not zero, setting IncreaseWeightPerDepth to 1/BlendDepth when BlendDepth !=0 or to 1.0 when BlendDepth == 0. Then looping over NumBones the BlendWeight + (IncreaseWeightPerDepth * Depth) is clamped to (0.0,1.0) effectively limiting the effect to abs(BlendDepth) bones from root. A negative value inverts the scaling away from the root bone, making it the least affected in the chain.

If you experiment with it, it seems to distribute the blend over the number of bones you specify.

A little bit of necromancy here: link to LiveStream - EpicGames Lead Animator explains this node in detail. Animation Blueprint Setup & Walkthrough | Live Training | Unreal Engine Livestream - YouTube

2 Likes

Just watched the video tvinfoforest posted which links to epic livetraining and So tomofnz was right … but its actually even more useful now knowing that the depth is for the bone structure so setting it to pelvis like he says and depth to 4 it will blend down the bone hierarchy to spine01, 02 03 will be 100% already and setting a bone to -1 like he does in the video will tell that bone to ignore it… thanks tvinfoforest!

I know this is an older thread but it still exists and can bring people to wrong conclusion.

The way described by tomofnz would be very intuitive, but doesn’t seem correct. Also woppin’s comment marked as answer might be informative for people who want to take an in-depth look at it, but didn’t really help me understand how to use it.

For any newcomers, I advise you to take a look at this post here where it is beautifully demonstrated by asmischney. (Y)

Thanks and cheers!

1 Like

Thank you, that was very helpful! I also recommend for people to read Gooseman1977’s answer in the same thread you linked too which explains setting bone depth to values greater than 1.