如何在A-Frame中创建180度/半球/片段/部分视频球?

ngo*_*vin 5 aframe

<a-videosphere src="myvideo.mp4">在整个360度球体上显示视频,但我想显示视频或图像,但仅限于像半球一样的球体的一部分.就像是:

http://mathworld.wolfram.com/images/eps-gif/SphericalSegment_1000.gif

我怎么在A-Frame中这样做?

ngo*_*vin 5

您可以使用球体几何体(<a-entity geometry="primitive: sphere"><a-sphere>)并控制phiLength/thetaLength球体的角度以指定线段.Theta长度控制水平扫掠角度,phi长度控制垂直扫掠角度:

http://forums.mediabox.fr/wiki/_media/tutoriaux/flashplatform/affichage/3d/carrousel_papervision/sphere/theta_phi.png

对于半球,我们会这样做:

<a-entity geometry="primitive: sphere; thetaLength: 180; radius: 5000; segmentsWidth: 64; segmentsHeight: 20" scale="1 1 -1" material="src: #myVideo; shader: flat"></a-entity>
Run Code Online (Sandbox Code Playgroud)

要么:

<a-sphere theta-length="180">
Run Code Online (Sandbox Code Playgroud)

然后应用材料.

对于videosphere,我们可以更新它:

<a-videosphere src="#myVideo" geometry="thetaLength: 180"></a-videosphere>
Run Code Online (Sandbox Code Playgroud)

但是,视频不会像您期望的那样被裁剪.所以你可能需要事先裁剪.如果你想让它像裁剪一样background-size: cover,我们可能需要做一些特殊的事情,比如隐藏球体的部分.