Skip to content

Added an smart stretching option to BlendAction #1847

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

Closed
wants to merge 3 commits into from
Closed

Added an smart stretching option to BlendAction #1847

wants to merge 3 commits into from

Conversation

Ali-RS
Copy link
Member

@Ali-RS Ali-RS commented Aug 22, 2022

By default, BlendAction will stretch any action that doesn't have the same length. This will cause stretched actions to end up playing slowly so one needs to manually speed up action to resolve this. What smart stretching does is that it tries to loop the action when possible before stretching to resolve the slow animation effect.

Gives the best result when the max transition weight is set to something lower than 1 (e.g. 0.5)

Ali-RS added 3 commits August 22, 2022 09:46
…on will stretch any action that doesn't have the same length. This will cause stretched actions to end up play slowly so one need to manually speed up action to resolve this. What smart stretching does is that it tries to loop the action when possible before stretching to resolve the slow animation effect.
@Ali-RS
Copy link
Member Author

Ali-RS commented Aug 22, 2022

Drafted it until I test it with some more examples.

@Ali-RS
Copy link
Member Author

Ali-RS commented Aug 22, 2022

By the way, if you think the term "smart stretch" is not suitable or if you know a better one, please let me know.

@Ali-RS
Copy link
Member Author

Ali-RS commented Aug 22, 2022

I have a new idea that is simpler and visually looks better than this one.

Closing this draft:D

@Ali-RS Ali-RS closed this Aug 22, 2022
@MeFisto94
Copy link
Member

Is this related to #1303 ?

@Ali-RS
Copy link
Member Author

Ali-RS commented Aug 23, 2022

Yes.

Well, the looping idea generates some visual artifacts while blending from one to another. Artifacts can be greatly reduced by setting the max transition weight to 0.5 or something.

In the new idea instead of looping I want to dynamically change the speed. So BlenAction.getSpeed() will not return a static number but based on the current blend weight it will interpolate a speed factor. I will submit the PR soon, so you can take a closer look at it. This way blending looks much smoother and does not requires using the max transition weight.

@Ali-RS
Copy link
Member Author

Ali-RS commented Aug 23, 2022

See my new PR here: #1848

@Ali-RS
Copy link
Member Author

Ali-RS commented Aug 27, 2022

I made a demo video showing how blending looks with the smart-stretching approach. Not promising

https://youtu.be/DJHwDaTy79o

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

Successfully merging this pull request may close these issues.

2 participants