GLB transparent animation bug

Description of the problem

Hi; sometime with glb model i add full scene
when i play animation object become transparent and flickering.
problem that appeared recently on dev version of three.
I can’t understand where it comes from, if someone has already noticed this problem ?

Three.js version
  • Dev
  • r115
Browser
  • All of them
  • Chrome
  • Firefox
  • Internet Explorer
OS
  • All of them
  • Windows
  • macOS
  • Linux
  • Android
  • iOS
Hardware Requirements (graphics card, VR Device, …)

3 thoughts on “GLB transparent animation bug

  1. Note that GLTFLoader uses a custom interpolant (cubic spline) for some animations. The Always Sample Animation option in Blender would generally force linear interpolation, and avoid that custom interpolant. Perhaps it’s this interpolation that got broken by the change?

    // Spline Interpolation
    // Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#appendix-c-spline-interpolation
    function GLTFCubicSplineInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
    THREE.Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
    }
    GLTFCubicSplineInterpolant.prototype = Object.create( THREE.Interpolant.prototype );
    GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant;
    GLTFCubicSplineInterpolant.prototype.copySampleValue_ = function ( index ) {
    // Copies a sample value to the result buffer. See description of glTF
    // CUBICSPLINE values layout in interpolate_() function below.
    var result = this.resultBuffer,
    values = this.sampleValues,
    valueSize = this.valueSize,
    offset = index * valueSize * 3 + valueSize;
    for ( var i = 0; i !== valueSize; i ++ ) {
    result[ i ] = values[ offset + i ];
    }
    return result;
    };

    @lo-th if you’re avoiding the “Always Sample Animation” option to reduce file size, you may want to consider exporting with sampling, then using gltfpack to downsample and reduce file size. Exporting with sampling tends to work better in general, so (while I agree this is a bug), it’s worth considering too.

  2. I’m pretty sure there are a few, but I’d have to dig into the binary files to figure out which ones. 😅

    A unit test on PropertyMixer for custom interpolants might also help avoid this issue in the future.