如何在A帧中创建180度/半球/段/部分视频球? [英] How to create a 180-degree/semisphere/segment/partial video sphere in A-Frame?

查看:70
本文介绍了如何在A帧中创建180度/半球/段/部分视频球?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< a-videosphere src = myvideo.mp4> 在整个360度范围内显示视频,但我想显示视频或图像,但仅在半球这样的球体的一部分上。





(来自MathWorld-Wolfram网络资源:

(来源: mediabox.fr ))



对于半球,我们可以这样做:

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

或:

 < a-sphere theta-length = 180> 

然后应用材料。



对于videosphere,我们可以对其进行更新:

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

但是,视频不会像您期望的那样被裁剪。因此,您可能必须事先进行裁剪。如果您希望它像 background-size:cover 那样裁剪,我们可能需要做一些特别的事情,例如隐藏球体的一部分。


<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?

解决方案

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.

这篇关于如何在A帧中创建180度/半球/段/部分视频球?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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