Unity implements panorama

1 Introduction

        There are two ways to achieve panoramic viewing, one is to create a sky box, and the other is to render the panorama on a sphere and view it from inside the inner sphere. Both can be achieved with the skybox material Skybox.

2. Create a skybox material

        First create a shader named Sky. In the Shader drop-down menu, click Skybox. There are four options in the Skybox, namely 6 Sided, Cubemap, Panoramic, and Procedural. The 6 Sided method requires 6 pictures corresponding to the 6 sides of the square. Cubemap is a single image split into six parts, and the Texture Shape of the texture needs to select Cube. The Panoramic method knows what it is from the name, wraps the scene in a spherical shape with a single texture, and can also do panoramic videos. These three types are all texture classes, and the procedural class is a text implementation, that is, handwritten by yourself. The reference is as follows: Unity day and night cycle sky ball (Procedural Skybox) bazyd

And I chose the Panoramic method here, just drag the panorama over after selecting it. As shown below:

 3. Realize the panorama

        The above mentioned two ways to realize the panorama, the first is that the skybox can also achieve the panorama effect, the steps are as follows:

        1. From the menu bar, click Window > Rendering > Lighting > Environment

        2. Just replace the skybox material in Skybox Material.

        But this is more suitable for the background, and the second method is needed if more free operations such as zooming can be performed in the scene. Proceed as follows:

        1. Create a Sphere in the scene.

        2. In the MeshRender component, replace the default shader with the Sky shader.

        3. Put the camera inside the Sphere.

4. Panoramic video

        Can refer to:

        2022-08-26 Unity video playback 4 - panoramic video

 

Guess you like

Origin blog.csdn.net/qq_26540577/article/details/131664422