Negative BlendWeight values skip the interpolation?

I wonder if setting the blend weight to a negative number (through the blend space) will lead to an unexpected result of skipping the interpolation and may stop the animation?

The code:

The blend weight value should be between 0 and 1, so it should be clamped internally I think when someone uses an out-of-range number. What do you think of the behavior here? I am currently writing the documentation for the BlendSpace and I would like to add some documentation for the blend weight value regarding its value behaviors.

I think we need to trace back to find the public facing methods and see if blend weight ever could be outside the range of 0…1

It’s weird when looking at methods like collectTransform() because I think these are never meant to be called by users.

1 Like

Last time, I remember the LinearBlendSpace (the only implementation of BlendSpace) restricts the blend weight in the range 0 … 1, but what if someone uses a trivial implementation of BlendSpace? I have made some custom blend spaces before to provide a variety of behaviors, but in general, I was sticking to 0 - 1 range, I haven’t tested negative values and I guess it will break something; because it is not handled in this code.

EDIT:
However, I did test values above 1, and it magnifies the behavior when performing interpolation, kinda extrapolation or so, it did work visually well with fractional increments, but larger and larger values distort the scene.

EDIT2:
The original drawing by Nehon, states that the values should be between 0 and 1, and so, I guess if this is not handled in code, it is an issue then.

It seems that the negative values are handled quite well!

However, values greater than 1 are not handled, and it will lead to extrapolation, I don’t know if this is intended by the design of the system?

I think the negative weight will behave like weight = 0 except that the below checks won’t get run:

and

I do not know how that might change the behavior.

I think the expected values for weight are in [0, 1] (it is a percentage) where 0 (0%) means only interpolating the first animation, and 1 (100%) means only interpolating the second animation and anything between will result in animation blending.

So a negative value has no sense here I believe and any value other than [0, 1] must be clamped or an exception must be thrown.

1 Like

Yes, that is the intention mathematically, but I want to ensure the code is fine; because I think it’s not so clear about this.

EDIT:
I mean the code is not clear about if the weight value gets clamped in the range [0, 1]; because it should either be so or a warning should be printed.

I created a PR yesterday and added some case scenarios to showcase different behaviors of a blend space:

Feel free to submit a review.

I opened an issue: