我有完整的equirectangular图像与Three.js配合良好:
scene = new THREE.Scene();
geometry = new THREE.SphereBufferGeometry( 500, 60, 40 );
geometry.scale(-1, 1, 1);
material = new THREE.MeshBasicMaterial({ map: texture });
mesh = new THREE.Mesh(geometry, material);
mesh.rotation.y = Math.PI;
scene.add( mesh );
但我的图像实际上只包含180x180度(球体的一半),所以我试图在球形网格上部分应用方形纹理,而不是在整个球体上拉伸图像。我认为它与texture.offset.xyz参数有关,但我还没有成功。虽然我可以继续填充我的图像以符合2x1 Equirectangular标准,但我宁愿从我的处理工作流程中删除这一步。
在你的下方,我会找到完整的equirectangular图像和我试图工作的方形图像。有没有人有任何关于如何做到这一点的线索?谢谢!
答案 0 :(得分:1)
SphereBufferGeometry有更多可选参数:
SphereBufferGeometry(radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength)
radius — sphere radius. Default is 50.
widthSegments — number of horizontal segments. Minimum value is 3, and the default is 8.
heightSegments — number of vertical segments. Minimum value is 2, and the default is 6.
phiStart — specify horizontal starting angle. Default is 0.
phiLength — specify horizontal sweep angle size. Default is Math.PI * 2.
thetaStart — specify vertical starting angle. Default is 0.
thetaLength — specify vertical sweep angle size. Default is Math.PI.
你可以使用phiStart,phiLength,thetaStart和thetaLength来定义部分球体
所以做一个半球你可以试试像:
geometry = new THREE.SphereBufferGeometry( 500, 60, 40, 0, Math.PI, 0, Math.PI );
参考http://threejs.org/docs/#Reference/Extras.Geometries/SphereBufferGeometry