我遇到了另一个问题的解决方案问题,three.js webgl custom shader sharing texture with new offset ..
阅读后我得出结论我可能要使用克隆方法();很简单,但我确定我错过了一些东西,因为我在我的网格上得到了黑色渲染结果。
originalM = new THREE.ShaderMaterial({
uniforms: uniforms,
vertexShader: document.getElementById( 'vShader' ).textContent,
fragmentShader: document.getElementById( 'fShader' ).textContent,
wireframe: true,
side: THREE.FrontSide
} );
for ( j = 0; j < row; j ++ ) {
var shader2 = originalM.clone();
shader2.uniforms = THREE.UniformsUtils.clone( originalM.uniforms );
shader2.needsUpdate = true;
shader2.uniforms.tX.value = 0.20 * t;
shader2.uniforms.tY.value = 0.20 * j;
for ( i = 0; i < geometry.length; i ++ ) {
var mesh = new THREE.Mesh( geometry[ i ][ 0 ], shader2);
group.add(mesh);
}
}