0
\$\begingroup\$

For a Unity project I have a 360 camera which produces an equirectangular video. I need to realize preview of this video for putting it on a plane.

In most cases the part of the video to be drawn on the plane is the central part of the video, which is not so stretched and so it can be drawn as is. In some cases, instead, the camera has to be put above the scene, upside down, in order to capture the scene below, as shown in the following image.

360 camera upside down

In this kind of situation I need to produce a preview from the upper part of the video; in other words I need to project a portion of the upper part of the video on a plane.

I imagined two ways, the first one is easy but not so effective, the second one is tricky but surely better.

  1. I project the video on a sphere and capture, with a virtual camera, the interesting part, which is taken and rendered on a plane.
  2. I write an appropriate shader which, given the equirectangular video, crops the portion of it and draws it correctly on a plane.

May you give me a hand on writing the shader?

\$\endgroup\$
  • \$\begingroup\$ I wrote an Equirectangular shader do you need something like this \$\endgroup\$ – Seyed Morteza Kamali Oct 29 '19 at 8:40
  • \$\begingroup\$ You don't need anything special to do this. The very same equirectangular shader you might use on a sphere "just works" on a plane. The shader doesn't know whether the triangle it's drawing right now is part of a sphere or a plane, so one that gives the correct result for every triangle in a sphere will also give the correct result for every triangle in the plane. One example is available in this past Q&A. \$\endgroup\$ – DMGregory Oct 29 '19 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.