JannisX11 / blockbench

Blockbench - A low poly 3D model editor
https://www.blockbench.net
GNU General Public License v3.0
3.36k stars 290 forks source link

[Issue] Smooth-interpolated key frames aren't generating properly #1417

Closed Sprunkles137 closed 2 years ago

Sprunkles137 commented 2 years ago

The bug

Animations using "smooth" keyframes (known internally as catmullrom interpolation in discontinuous key frames) do not generate a "pre" property, and as such do not appear correctly in Minecraft. Normally this isn't an issue and interpolates properly between two or more catmull-rom key frames, or when that catmull-rom key frame is the first in its timeline, but following a linear key frame it's wrong; the game assumes it should interpolate to a value of [0, 0, 0]. Attached is an add-on exhibiting this issue: the spin1 animation has been generated by Blockbench, while the spin2 animation has been edited by hand to include the pre properties.

issue.zip

https://user-images.githubusercontent.com/64864915/168412956-57613949-5709-49b0-a16d-8b8a37df0502.mp4

Environment

Working with a Bedrock model. Blockbench desktop application. Windows 10 Home, version 21H2.

Sprunkles137 commented 2 years ago

As an addendum: contrary to #967, Bedrock edition does use the pre values for catmull-rom keyframes.

JannisX11 commented 2 years ago

For context on the commit, as I have explained several times on the issue #967, catmull rom interpolation only use the "post" field, the "pre" field is ignored. This issue demonstrates a different problem. When using a linear keyframe before a catmull rom curve, Minecraft uses linear interpolation before the actual curve starts. For that linear interpolation, the "pre" field is actually required, and I've fixed this in the commit linked above.

Sprunkles137 commented 2 years ago

I appreciate the fix, thanks!