KhronosGroup / glTF-Sample-Assets

To store all models and other assets related to glTF
257 stars 30 forks source link

Suggestion: Sample with discrete/constant interpolation of scale 0↔1 #77

Closed donmccurdy closed 4 months ago

donmccurdy commented 2 years ago

In a thread on the three.js forums we've come to the conclusion that a significant number of viewers cannot display constant interpolation of scale, particularly scale 0↔1.

The 'broken' three each show slightly different results — Spark AR doesn't appear to support constant interpolation at all, whereas Babylon.js plays the animation correctly once and then reaches a broken state when trying to loop it.

It's a useful technique for 'baking' simulations as flipbook-style animations, showing each mesh for a single frame, but does depend on correct support for animating scale with constant interpolation.

DRx3D commented 7 months ago

This has been untouched for over a year. Is there anything to do here?

If there is no response, then this issue will be closed by 27 Nov.

bghgary commented 7 months ago

Babylon.js has already fixed this, but a sample model could still be useful.

javagl commented 7 months ago

By "constant", you mean STEP interpolation?

There is a pending PR for the InterpolationTest at https://github.com/KhronosGroup/glTF-Sample-Assets/pull/26 . I could just change the values of the respective accessor...

  accessor10.setArray(new Float32Array([
    1, 1, 1, 
    0.5, 0.5, 0.5,  // Change to 0 0 0
    1, 1, 1, 
    0.5, 0.5, 0.5,  // Change to 0 0 0
    1, 1, 1
  ]));

if this is it...

donmccurdy commented 7 months ago

Yes, thanks – STEP interpolation with scale is what I had in mind.

javagl commented 7 months ago

This is what the InterpolationTest could look like with a scale of 0:

Khronos InterpolationTestScale0

An archive with the GLB and the code (hand-edited output of gltfTransformifier) for generating it:

InterpolationTestFix0004_scale0.zip

If people agree, I can update https://github.com/KhronosGroup/glTF-Sample-Assets/pull/26 with this.

donmccurdy commented 7 months ago

An archive with the GLB and the code (hand-edited output of gltfTransformifier) for generating it:

total aside, but that is a wild and beautiful solution 🤯

javagl commented 7 months ago

OT: The name was inspired by BCELifier. It's a very rough "proof-of-concept" for now, but I try to allocate some time to maybe turn it into something useful.

javagl commented 7 months ago

I have updated the PR at https://github.com/KhronosGroup/glTF-Sample-Assets/pull/26#issuecomment-1821000772 with the latest state that was posted here, where the scale interpolations go down to (0,0,0). When this PR is merged, then this issue can probably be closed.

javagl commented 4 months ago

The current version of the InterpolationTest at https://github.com/KhronosGroup/glTF-Sample-Assets/tree/main/Models/InterpolationTest now includes a STEP interpolation that scales between 0.0 and 1.0, so I assume that this can be closed.