简体   繁体   English

Unity 中的莫比乌斯效应

[英]Möbius effect in Unity

This morning I've seen the following animation on Twitter.今天早上我在 Twitter 上看到了以下动画。 It is a kind of Möbius strip effect.它是一种莫比乌斯带效应。

It's cool!这个很酷! Isn't it?不是吗? So I've decided to build something similar using Unity, just for fun.所以我决定使用 Unity 构建类似的东西,只是为了好玩。 I want to build the effect using just the cameras, as this way we can use it for any rotating scene.我想只使用相机来构建效果,这样我们就可以将它用于任何旋转场景。 The first step has been to create a circle scene and make it rotate:第一步是创建一个圆形场景并使其旋转:

Note that the camera uses an ortographic projection so perspective does not deform it.请注意,相机使用正交投影,因此透视不会使其变形。 This is important so we can merge different views later.这很重要,因此我们可以稍后合并不同的视图。

Then I've replaced the main camera by two different ones, located in opposite positions (horizontal and vertical) and rendering to textures.然后我用两个不同的相机替换了主相机,它们位于相反的位置(水平和垂直)并渲染到纹理。 A simple Canvas with two panels (divided vertically) shows the partial result (one camera texture per panel):带有两个面板(垂直划分)的简单 Canvas 显示了部分结果(每个面板一个相机纹理):

I know this is cool, but not perfect yet, as the center of the rendered output shows clearly where a panel finishes and the other one starts.我知道这很酷,但还不完美,因为渲染输出的中心清楚地显示了一个面板的完成位置和另一个面板的开始位置。 Look at the center of the rendered output above.查看上面渲染输出的中心。

The original inspiration video shows no perspective in the center, and I think that is the trick, but I cannot achieve that with an orthographic camera (or I don't know how).最初的灵感视频没有显示中心的透视,我认为这就是诀窍,但我无法用正交相机实现这一点(或者我不知道如何实现)。

Do you know any approach to distort the camera or something similar, so the cameras are perpendicular in the middle of the scene (and only in the middle)?你知道有什么方法可以扭曲相机或类似的东西,所以相机在场景的中间是垂直的(并且只在中间)? Are you able to think a solution to dissimulate the joint of both camera views?你能想出一个解决方案来掩盖两个相机视图的联合吗?

Note:笔记:

As a first approach (dismissed for the moment) I've tried to add another camera, perpendicular to the scene so there is no perspective in that point.作为第一种方法(暂时关闭),我尝试添加另一个相机,垂直于场景,因此在那一点没有透视。 Then I render its output in the UI in another panel on top of the previous ones.然后我在之前面板之上的另一个面板中的 UI 中呈现其输出。 And it is not too bad, but again the joint is too obvious and now I have two joints instead of one:而且还不错,但是关节又太明显了,现在我有两个关节而不是一个:

Funny challenge, right?有趣的挑战,对吧? Any idea to solve the problem?有解决问题的想法吗?

After some effort, and thanks to @joreldraw's suggestion, I've found a better approach for the moment: overlapping the panels and using a shader mask to combine both images in the middle.经过一番努力,感谢@joreldraw 的建议,我现在找到了一个更好的方法:重叠面板并使用着色器蒙版将两个图像组合在中间。

Anyway I'm sure there must be a way to make the camera perpendicular in the middle and not on the sides.无论如何,我确信必须有一种方法可以使相机垂直于中间而不是侧面。 Hopefully somebody can give us some ideas about how to do it.希望有人能给我们一些关于如何做的想法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM