作为标题,太奇怪了,变形目标较少的Object3D将受到另一个变形目标较多的Object3D的影响。

我通过将具有4个变形目标的多维数据集添加到Three.js官方示例here中来复制错误webgl_morphtargets。原始示例只有一个具有8个变形目标的多维数据集。

在示例中,顶部8个输入栏更改了灰色立方体的morphTargetInfluences,底部4个输入栏更改了蓝色立方体。两个多维数据集具有不同的几何形状和材质,但是调整顶部8个输入条会影响蓝色多维数据集。

morphTargets代码的一部分粘贴在下面。已经为此困扰了好几天,无法解决。任何指导将不胜感激,谢谢!

            // first cube
            var geometry = new THREE.BoxGeometry( 100, 100, 100 );
            var material = new THREE.MeshLambertMaterial( { color: 0xffffff, morphTargets: true } );

            // construct 8 blend shapes
            for ( var i = 0; i < geometry.vertices.length; i ++ ) {
                var vertices = [];
                for ( var v = 0; v < geometry.vertices.length; v ++ ) {
                    vertices.push( geometry.vertices[ v ].clone() );
                    if ( v === i ) {
                        vertices[ vertices.length - 1 ].x *= 2;
                        vertices[ vertices.length - 1 ].y *= 2;
                        vertices[ vertices.length - 1 ].z *= 2;
                    }
                }
                geometry.morphTargets.push( { name: "target" + i, vertices: vertices } );
            }
            mesh = new THREE.Mesh( geometry, material );
            scene.add( mesh );

            // second cube
            var geometry2 = new THREE.BoxGeometry( 100, 100, 100 );
            var material2 = new THREE.MeshLambertMaterial( { color: 0x00ffff, morphTargets: true } );

            // construct 4 blend shapes
            for ( var i = 0; i < geometry2.vertices.length/2; i ++ ) {
                var vertices = [];
                for ( var v = 0; v < geometry2.vertices.length; v ++ ) {
                    vertices.push( geometry2.vertices[ v ].clone() );
                    if ( v === i ) {
                        vertices[ vertices.length - 1 ].x *= 2;
                        vertices[ vertices.length - 1 ].y *= 2;
                        vertices[ vertices.length - 1 ].z *= 2;
                    }
                }
                geometry2.morphTargets.push( { name: "target" + i, vertices: vertices } );
            }
            geometry2.computeMorphNormals();
            mesh2 = new THREE.Mesh( geometry2, material2 );
            mesh2.position.x = 200;
            scene.add( mesh2 );

最佳答案

这是一个错误,现在已在新库中解决。

09-17 06:57