[SOLVED] Question about updateMatrices of pc.SkinInstance

 updateMatrices: function () {

            var pos = this.rootNode.getPosition();
            for (var i = this.bones.length - 1; i >= 0; i--) {
                this.matrices[i].mul2(this.bones[i].getWorldTransform(), this.skin.inverseBindPose[i]);
                this.matrices[i].data[12] -= pos.x;
                this.matrices[i].data[13] -= pos.y;
                this.matrices[i].data[14] -= pos.z;
            }
        },

@contributers, why do we need to eliminate the rootNode’s position here, and uniform ‘skinPosOffset’ (rootNode’s world position) to shader? I mean why don’t we just make it simple (delete ‘skinPosOffset) as following code snippet’:

updateMatrices: function () {
            for (var i = this.bones.length - 1; i >= 0; i--) {
                this.matrices[i].mul2(this.bones[i].getWorldTransform(), this.skin.inverseBindPose[i]);
            }
        },

I think this is due to loss of precision in the vertex shader if skinned hierarchies more far from the origin. You start to notice vertices ‘wobble’. If I remember incorrectly, I’m sure @Mr_F will give the real reason.

@will is correct. We had to add skinPosOffset to prevent jittering of very faraway objects (what is “far” is device-dependent).