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.
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.
- I project the video on a sphere and capture, with a virtual camera, the interesting part, which is taken and rendered on a plane.
- 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?