mojira.dev
MC-261040

Interpolation of scale between two display entity transformations appears non-linear

I've been messing around with item displays for my Blockbench plugin that exports animations to Minecraft, and it appears as though I've run into an in-game interpolation issue.

I've included a video of what the animation is expected to look like (recorded in Blockbench), what it looks like in Minecraft, and a comparison of a couple of the matrices that display incorrect interpolation.

How to reproduce

  • Summon an item_display with any item model (It doesn't have to be a custom model).

  • Place down two command blocks and put stone buttons on top of them

  • Put Command 1 into the first command block

  • Put Command 2 into the second command block

  • Activate the command blocks sequentially and notice the awkward bouncing interpolation. 

Command 1:

data modify entity @e[type=item_display,limit=1] {} merge value {transformation:[1f,0f,0f,0.0625f,0f,-0.4243065522280399f,0.3082767551050003f,1.540635741691493f,0f,-0.5877852522924748f,-0.8090169943749459f,0.125f,0f,0f,0f,1f],start_interpolation:0}

Command 2:

data modify entity @e[type=item_display,limit=1] {} merge value {transformation:[1f,0f,0f,0.0625f,0f,-0.457812552688941f,0.23326714669302423f,1.5093316794159124f,0f,-0.4539904997395463f,-0.891006524188368f,0.125f,0f,0f,0f,1f],start_interpolation:0}

Attachments

Comments 4

This is not a duplicate of MC-260874. That is a separate interpolation issue and is not the root cause of this issue, nor is this error a side effect of that issue.

To be clear, this bug is about interpolation between two transformations not being linear. Not about interpolation failing or resetting because of repeated transformation applications.

This happens because of how matrix decomposition works. To convert from the matrix form to the decomposed form, it uses singular value decomposition (https://en.wikipedia.org/wiki/Singular_value_decomposition). This algorithm has multiple solutions. For any given matrix input, there are 24 configurations of the scale matrix by rearranging the values and flipping their signs. This means there is ambiguity in the output.

The two transformations provided in the description resolve to the following decomposed forms:

Transformation 1:

{left_rotation: [0.70710677f, 0.0f, 0.0f, -0.7071067f], translation: [0.0625f, 1.5406357f, 0.125f], right_rotation: [-0.4539905f, 0.0f, 0.0f, 0.89100665f], scale: [1.0000002f, 1.0000001f, 0.52447176f]}

Transformation 2:

{left_rotation: [1.0f, 0.0f, 0.0f, 9.860346E-7f], translation: [0.0625f, 1.5093317f, 0.125f], right_rotation: [-0.23344587f, 0.0f, 0.0f, -0.9723699f], scale: [1.0000002f, 0.5138151f, 1.0000002f]}

Focus on the scale component specifically, it is the most plain to see here. Despite the two transformations being very similar, the Y and Z components have switched around between the two transformations. When the game interpolates between these two transformations, it has to take a much longer path than would be visually expected in-game. In the context of an entire animation, it causes a "bounce" to occur at that frame.

A fix to this would be to have the decomposition take into account the previous transformation and choose the solution which is closest to it.

Is this still an issue in 1.20 pre4? I can't seem to reproduce the bouncing effect.

I believe this may have been accidentally fixed?
I cannot reproduce it in 1.20 pre-4 either.

SnaveSutit

(Unassigned)

Community Consensus

Platform

Low

Commands, Entities

1.19.4

Retrieved