部分 Equirectangular 全景 Three.js [英] Partial Equirectangular Panorama Three.js

查看:50
本文介绍了部分 Equirectangular 全景 Three.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有完整的 equirectangular 图像与 Three.js 配合良好:

I've got full equirectangular images working well with 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 标准,但我宁愿将这一步从我的处理工作流程中删除.

But my images actually only contain 180x180 degrees (half the sphere) so I'm trying to get a square texture partially applied on the spherical mesh without stretching the image across the entire sphere. I figure it has something to do with the texture.offset.xyz parameters, but I haven't been successful. While I can continue to pad my images to conform to 2x1 Equirectangular standards, I'd rather cut this step out of my processing workflow.

您会在下面找到完整的等距柱状图和我正在尝试制作的方形图像.有没有人有任何关于如何实现这一点的线索?谢谢!

Below you'll find both the full equirectangular image and the square one I'm trying to get working. Does anyone have any clues on how to accomplish this? Thanks!

推荐答案

SphereBufferGeometry 有更多可选参数:

SphereBufferGeometry has more optional parameters:

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 来定义局部球体

you can use phiStart, phiLength, thetaStart and thetaLength to define partial sphere

所以要制作一个半球,您可以尝试以下操作:

so to do an half sphere you can try something like:

geometry = new THREE.SphereBufferGeometry( 500, 60, 40, 0, Math.PI, 0, Math.PI );

参考 http://threejs.org/docs/#Reference/Extras.Geometries/SphereBufferGeometry

这篇关于部分 Equirectangular 全景 Three.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆