Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter to Blend3 node. #27571

Closed
wants to merge 1 commit into from
Closed

Conversation

rcorre
Copy link
Contributor

@rcorre rcorre commented Apr 1, 2019

Fixes #22923.

@reduz
Copy link
Member

reduz commented Apr 4, 2019

This does not fix anything because filter is still ignored on the PROCESS function. What would the logic be for the filter in a Blend3 node? Filter is binary and here you have 3 input nodes, so I think the problem is more conceptual than technical.

@rcorre
Copy link
Contributor Author

rcorre commented Apr 4, 2019

I would expect that the +/- animations are blended into the in animation only for the selected bones, while leaving the other bones of the in animation untouched. It might be that I don't actually understand how filters work, or the difference between add and blend.

How do filters work on the Add3 node? I believe I'm currently using an Add3 filter to add a left/right lean to my character and have it filtered to only the upper body.

@reduz
Copy link
Member

reduz commented Apr 21, 2019

Hmm..

For Blend2 the filter code (check process function) is:

	float rem0 = blend_input(0, p_time, p_seek, 1.0 - amount, FILTER_BLEND, !sync);
	float rem1 = blend_input(1, p_time, p_seek, amount, FILTER_PASS, !sync);

	return amount > 0.5 ? rem1 : rem0; //hacky but good enough

For Blend3, maybe it could be something like:

	float amount = get_parameter(blend_amount);
	float rem0 = blend_input(0, p_time, p_seek, MAX(0, -amount), FILTER_PASS, !sync);
	float rem1 = blend_input(1, p_time, p_seek, 1.0 - ABS(amount), FILTER_BLEND, !sync);
	float rem2 = blend_input(2, p_time, p_seek, MAX(0, amount), FILTER_PASS, !sync);

	return amount > 0.5 ? rem2 : (amount < -0.5 ? rem0 : rem1); //hacky but good enough

Not sure if this would work as espected, It's not totally clear if this is something intuitive to me

@rcorre
Copy link
Contributor Author

rcorre commented Apr 21, 2019

Y'know, I can't for the life of me remember what I was trying to do with a filtered Blend3 😁 . I think I ended up needing Add3 after all.

I'll try to play around with this a bit though and see what the results are like.

@akien-mga
Copy link
Member

So what should we do with this PR and related issue? It sounds like the use case is not so clear anymore?

@rcorre
Copy link
Contributor Author

rcorre commented May 28, 2019

Sorry for letting this hang! I'll close this, and I'm happy to close #22923 as well, though I'm not the OP. The more I've worked with AnimationTree, the less I think I need a filtered Blend3 for anything.

@Antokolos
Copy link

Antokolos commented Aug 2, 2019

Well, I can give an example, when such functional can be needed.
Take a look at this video
https://www.youtube.com/watch?v=M1GXKbYCfdQ&feature=youtu.be
There are three animations: resting, head turn to the right and head turn to the left
Note that when resting, the girl swings back and forth and blinks
I was able to do what I need by using two chained Blend2 nodes, you can see it from 00:00 to 00:15
Then, from 00:00 to 00:41, I am showing, why I need the filters (when no filters are applied, blinking and swinging are gone when the head is in the rightmost and the leftmost position)
Then, from 00:42 till the end of the video, I am showing, why Add3 node with filters cannot be used (the head cannot be turned fully to the left or right for some reason, the rotation angle is quite limited)

You can take a look at the code here:
https://github.com/Antokolos/palladium3d-demo/blob/master/scenes/female.tscn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No "Edit Filters" button in "Blend3" node in AnimationTree
5 participants