我已通过Three.js(v.0.8.0)代码将立方体相机添加到我的A帧场景中,并且当我想将捕获的立方体相机纹理作为envMap投影到例如一个球体,这是结果:cubecamera texture on sphere
它基本上不显示周围对象的纹理,并且某些对象是纯黑色的。我尝试了几个小时,而Iam筋疲力尽。一些技巧和/或解决方案?谢谢!
我的立方相机代码:
function setupCubecam(){
var cubeCamera = new THREE.CubeCamera( 0.005, 100000, 64 );
scene.add( cubeCamera );
var cubecamMaterial = new THREE.MeshStandardMaterial({
color: 0xffffff,
envMap: cubeCamera.renderTarget.texture,
metalness: 1,
roughness: 0,
});
sphere.material = cubecamMaterial;
sphere.visible = false;
cubeCamera.position.copy( sphere.position );
cubeCamera.update( renderer, scene );
sphere.visible = true;
renderer.render( scene, camera );
}
编辑:
当将cubeCamera作为envMap分配给Material时,我得到了这个错误:
Error: WebGL warning: texParameteri: pname 0x2802: Invalid param 0x0000. three.js:18014:4
Error: WebGL warning: texParameteri: pname 0x2803: Invalid param 0x0000. three.js:18015:4
Error: WebGL warning: texParameteri: pname 0x2802: Invalid param 0x0000. three.js:18014:4
Error: WebGL warning: texParameteri: pname 0x2803: Invalid param 0x0000. three.js:18015:4
编辑2:当我从其他对象中删除材质时,它起作用了。 without other materials
这些是其他材料:
var wall_MAT = new THREE.MeshStandardMaterial({
map: wallTexture,
aoMap: wallAO,
metalness: 0,
lights: true,
});
var floor_MAT = new THREE.MeshStandardMaterial({
map: floorTexture,
aoMap: floorAO,
metalnessMap: floorMETAL,
envMap: floorENV,
metalness: 1,
roughness: 0,
lights: true,
});
编辑3:所以我发现纹理是我的问题。它可以使用纯色。 (但是为什么?)example