9
\$\begingroup\$

This morning I've seen the following animation on 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. 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):

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?

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. And it is not too bad, but again the joint is too obvious and now I have two joints instead of one:

\$\endgroup\$
2
  • \$\begingroup\$ You might be able to do this by rendering the same object twice with two different shaders which output different Z-buffer values (to get the overlapping right) and calculate light differently (to get the light direction right). But unfortunately shader programming isn't my area of expertise. \$\endgroup\$
    – Philipp
    Jan 30, 2020 at 15:22
  • \$\begingroup\$ I have a thought about using the vertex shader to kind of "twist" the projection from one side of the image to another. So stuff on the left side of the camera's view is projected as though the camera is looking down from above, and stuff in the middle is projected as though the camera is looking straight-on, but vertically shifted to still line up with the expected arc, and this transformation occurs continuously over the image rather than at discrete cutoff points or cross-fades. The math will take some work though... \$\endgroup\$
    – DMGregory
    Jan 30, 2020 at 16:27

1 Answer 1

5
\$\begingroup\$

After some effort, I've found a temporal approach: overlapping the panels and using a shader mask to combine both images in the middle.

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.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .