使用three.js创建一个凹半球 [英] Create a concave half sphere with three.js
问题描述
我是一名拥有良好 js 经验的 Web 开发人员,我目前正在探索 Three.js 的可能性.但是,我对 3D 形状和词汇不是很熟悉,我无法弄清楚如何构建我需要的形状.
I'm a web developer with a good js experience, and I'm currently exploring three.js possibilities. However, I'm not very familiar with 3D shapes and vocabulary, and I can't figure out how to build the shape I need.
我想创建一个半球体,并且能够在这个球体内部投影视频.我有一个全景球面视频,我需要对其进行扭曲以使其看起来像平面".感谢 Paul 的教程,我画了一个球体并将我的视频投影在它上面.但是外球面是凸面的,我需要一个凹面!我无法弄清楚如何实现这一目标.从我最初的球体中挤出一个更小的球体?
I want to create a half sphere, and be able to project a video INSIDE this sphere. I have a panoramic spherical video, and I need to distort it to make it look like "plane". Thanks to Paul's tutorial, I have drawn a sphere and projected my video on it. But the external sphere surface is convex, and I need a concave one ! I can't figure out how to achieve this. Extruding a smaller sphere out of my initial one ?
请帮忙!
推荐答案
您可以通过设置附加的 SphereGeometry
参数来创建半球:
You can create a half-sphere by setting the additional SphereGeometry
parameters:
SphereGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength )
不断试验,直到得到你想要的东西.
Experiment until you get exactly what you want.
您还必须将用于球体的材料的 side
属性设置为 THREE.BackSide
或 THREE.DoubleSide
>.
You will also have to set the side
property of the material you use for the sphere to either be THREE.BackSide
or THREE.DoubleSide
.
material.side = THREE.DoubleSide;
EDIT - SphereBufferGeometry
,它在内存方面更高效,现在也可用.它的构造函数具有相同的参数.
EDIT - SphereBufferGeometry
, which is more efficient memory-wise, is now also available. Its constructor has the same arguments.
(Three.js r.82)
(Three.js r.82)
这篇关于使用three.js创建一个凹半球的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!