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

Reduce cubic interpolated animation hitch #54730

Closed

Conversation

robfram
Copy link
Contributor

@robfram robfram commented Nov 7, 2021

Reduce cubic interpolated animation hitch

Cubic interpolation didn't wrap around first and last keys, clamping
pre and post keys to first and last before interpolating values.

Fixes #20087

@Calinou
Copy link
Member

Calinou commented Nov 7, 2021

Thanks for opening a pull request 🙂

Pull requests should be opened against the master branch instead of 3.x (as long as the feature/fix is relevant for master). This is because feature development occurs in the master branch. We can then cherry-pick specific PRs to the 3.x branch if they don't break backwards compatibility.

@robfram
Copy link
Contributor Author

robfram commented Nov 7, 2021

Pull requests should be opened against the master branch instead of 3.x (as long as the feature/fix is relevant for master). This is because feature development occurs in the master branch. We can then cherry-pick specific PRs to the 3.x branch if they don't break backwards compatibility.

Sorry, I can't PR against master branch because I can't test changes as my machine is not vulkan capable (and not even sure it compiles at all). I was looking for bugs in the 3.x branch for that reason, but I forgot this bug was still present in master.
My apologies.

@Calinou
Copy link
Member

Calinou commented Nov 7, 2021

I can't PR against master branch because I can't test changes as my machine is not vulkan capable (and not even sure it compiles at all).

The master branch now has OpenGL support for 2D rendering, which you can enable by using the --rendering-driver opengl3 --single-window command line arguments.

You can create a new project from the command line as follows:

# Create an empty `project.godot` file within a folder.
mkdir -p /tmp/test
touch /tmp/test/project.godot

# Replace "~/godot/bin/godot.linuxbsd.tools.64" with the path to your compiled Godot executable.
~/godot/bin/godot.linuxbsd.tools.64 --rendering-driver opengl3 --single-window /tmp/test/project.godot

The 3D editor viewport won't display anything, but you should be able to switch to the 2D tab and see sprites added there.

@robfram
Copy link
Contributor Author

robfram commented Nov 7, 2021

The master branch now has OpenGL support for 2D rendering, which you can enable by using the --rendering-driver opengl3 --single-window command line arguments.

You can create a new project from the command line as follows:

# Create an empty `project.godot` file within a folder.
mkdir -p /tmp/test
touch /tmp/test/project.godot

# Replace "~/godot/bin/godot.linuxbsd.tools.64" with the path to your compiled Godot executable.
~/godot/bin/godot.linuxbsd.tools.64 --rendering-driver opengl3 --single-window /tmp/test/project.godot

The 3D editor viewport won't display anything, but you should be able to switch to the 2D tab and see sprites added there.

Amazing! I'm trying to compile it right now, disabling all third party modules that throw errors. if I'm able to make it run, I could replace this PR with a new one against master, and try to use it for future ones.
Thanks!

@robfram
Copy link
Contributor Author

robfram commented Nov 9, 2021

The PR for master is #54811

I was able to compile it patching 2 thirdparty libraries (icu4c and basis_universal). Should I open an issue/PR for them or they are outside Godot scope being thirdparty libs?

Although the editor works (in 2D as you said), I can't run the scenes. I got this message:

Your video card driver does not support any of the supported Vulkan or OpenGL versions.
Please update your drivers or if you have a very old or integrated GPU, upgrade it.
If you have updated your graphics drivers recently, try rebooting.

For this PR this was not a problem, as the hitch was noticeable directly in the editor.

@akien-mga
Copy link
Member

I was able to compile it patching 2 thirdparty libraries (icu4c and basis_universal). Should I open an issue/PR for them or they are outside Godot scope being thirdparty libs?

We don't modify thirdparty libs unless we really can't fix issues differently. I'm not aware of any build issue for those libs on any platforms supported in our official builds though, I assume you're on a more exotic system? Please open issues for these.

@robfram
Copy link
Contributor Author

robfram commented Nov 10, 2021

Note: Perhaps this whole text should be it's own issue entry. I can move it to one if you want and delete it here. Thanks in advance, and I know this is not a common-enough scenario to be really attendend.

I assume you're on a more exotic system? Please open issues for these.

Yes, I'm on FreeBSD. Before opening issues for this (for basis_universal is only add one more defined comparison to get the same #include as MacOS), I want to confirm the building module system is working as expected.

I mean, I understand that they are options and modules (mainly talking about icu4c here) that can be enabled or disabled because:

  1. They are optional and not needed to compile a working version of Godot, and/or
  2. They can be provided system wide (aldreay present in the OS) instead as a Godot module when compiling.

When I tried to compile with builtin_icu=no, compilation fails due to others thirdparty modules dependences on it:

[ 29%] build_gdnative_api_struct(["modules/gdnative/include/gdnative_api_struct.gen.h", "modules/gdnative/gdnative_api_struct.gen.cpp"], ["modules/gdnative/gdnative_api.json"])
[ 32%] modules/text_server_adv/text_server_adv.cpp:38:10: fatal error: 'thirdparty/icu4c/icudata.gen.h' file not found
#include "thirdparty/icu4c/icudata.gen.h"
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 34%] 1 error generated.
[ 37%] tza_to_cpp(["thirdparty/oidn/weights/rtlightmap_hdr.gen.cpp"], ["thirdparty/oidn/weights/rtlightmap_hdr.tza"])
scons: *** [modules/text_server_adv/text_server_adv.linuxbsd.tools.64.llvm.o] Error 1
scons: building terminated because of errors.
[Time elapsed: 00:00:28.468]

So, I proceed with module_text_server_adv_enabled=no, and then it's the turn for basis_universal to fail. Again, no problem, time to disable that module too with module_basis_universal_enabled=no, and continue compiling.

And then, finally, when we try to execute it following the previous indication for OpenGL, we have a core dumped:

$ godot.linuxbsd.tools.64.llvm --rendering-driver opengl3 --single-window -e .
Godot Engine v4.0.dev.custom_build.e8870ddef - https://godotengine.org
ERROR: Property not found: rendering/quality/2d/use_nvidia_rect_flicker_workaround
   at: _get (core/config/project_settings.cpp:246)
ERROR: Property not found: rendering/quality/shading/force_lambert_over_burley
   at: _get (core/config/project_settings.cpp:246)
ERROR: Property not found: rendering/quality/shading/force_blinn_over_ggx
   at: _get (core/config/project_settings.cpp:246)
OpenGL Renderer: Mesa DRI Intel(R) HD Graphics 3000 (SNB GT2)
ERROR: Condition "!props.has(p_prop)" is true.
   at: set_custom_property_info (core/config/project_settings.cpp:977)
ERROR: Condition "!props.has(p_prop)" is true.
   at: set_custom_property_info (core/config/project_settings.cpp:977)
ERROR: Property not found: rendering/quality/2d/use_software_skinning
   at: _get (core/config/project_settings.cpp:246)
ERROR: Property not found: rendering/quality/2d/ninepatch_mode
   at: _get (core/config/project_settings.cpp:246)
  Undefined symbol "snd_dlpath"
  Undefined symbol "snd_config_is_array"
W: [(null)] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support.

ERROR: TextServer: Unable to create TextServer interface.
   at: setup2 (main/main.cpp:1859)
ERROR: A Thread object has been destroyed without wait_to_finish() having been called on it. Please do so to ensure correct cleanup of the thread.
   at: ~Thread (core/os/thread.cpp:124)
Segmentation fault (core dumped)

First of all, compiled with the patched modules (with all the default modules enabled at compilation time) works good enough. Secondly, we can really ignore the core dump, as the important part is the ERROR: TextServer: Unable to create TextServer interface. message I think. Is module_text_server_adv mandatory?

Perhaps if the text_server_adv module could use system wide ICU, then no additional module modification would be needed at all. Otherwise, disabling the ICU module should disable text_server_adv automatically.

I don't mind trying to generate elaborated patches to thirdparty modules if it will fix the compilation problem to a runnable executable.

@akien-mga
Copy link
Member

akien-mga commented Nov 15, 2021

If you disable text_server_adv, you need to enable text_server_fb (fallback), which has less features but should give you a functional editor.

But yes, please open issues about the compilation problems for basis_universal and icu4c, they should be fixed.

Edit: Closed by mistake.

@akien-mga akien-mga added this to the 3.5 milestone Nov 15, 2021
@akien-mga akien-mga closed this Nov 15, 2021
@akien-mga akien-mga reopened this Nov 15, 2021
@akien-mga
Copy link
Member

Closing as superseded by #54811 so we keep reviews in a single place (the master PR should be trivial to cherry-pick to 3.x once approved and merged).

@akien-mga
Copy link
Member

I was too fast, the master PR says that things likely need a different implementation for 4.0 so it definitely makes sense to keep the 3.x implementation around.

Copy link
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine for 3.x. However, for 4.0 #54811 (comment), there is a problem as I mentioned there, so please let me postpone it see #58344.

@@ -1718,11 +1718,19 @@ T Animation::_interpolate(const Vector<TKey<T>> &p_keys, float p_time, Interpola
case INTERPOLATION_CUBIC: {
int pre = idx - 1;
if (pre < 0) {
pre = 0;
if (p_loop_wrap) {
Copy link
Member

@TokageItLab TokageItLab Feb 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (p_loop_wrap) {
if (loop && p_loop_wrap) {

These keys should not be looked up when not looping.

}
int post = next + 1;
if (post >= len) {
post = next;
if (p_loop_wrap) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (p_loop_wrap) {
if (loop && p_loop_wrap) {

@TokageItLab
Copy link
Member

Superseded by #58651.

@TokageItLab TokageItLab closed this Mar 1, 2022
@TokageItLab TokageItLab removed this from the 3.5 milestone Mar 1, 2022
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.

4 participants