How to create a 180-degree/semisphere/segment/partial video sphere in A-Frame?

雨燕双飞 提交于 2019-12-10 15:23:48

问题


<a-videosphere src="myvideo.mp4"> displays a video on an entire 360-degree sphere, but I want to display a video or image, but only on a portion of a sphere like a hemisphere. Something like:


(from MathWorld - A Wolfram Web Resource: wolfram.com)

How would I do this in A-Frame?


回答1:


You can use the sphere geometry (<a-entity geometry="primitive: sphere"> or <a-sphere>) and control the phiLength/thetaLength angles of the sphere to specify a segment. Theta length controls horizontal sweep angle and phi length controls vertical sweep angle:


(source: mediabox.fr)

For a hemisphere, we would do:

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

Or:

<a-sphere theta-length="180">

And then apply the material.

For videosphere, we can update it:

<a-videosphere src="#myVideo" geometry="thetaLength: 180"></a-videosphere>

However, the video won't be cropped as you'd expect. So you might have to crop beforehand. If you want it to crop like background-size: cover, we might have to do something special like hide portions of the sphere.



来源:https://stackoverflow.com/questions/38857027/how-to-create-a-180-degree-semisphere-segment-partial-video-sphere-in-a-frame

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!