Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Integrate 360 Degree Video in Unity for Better VR Experience - 3 Easy Steps

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 2.30k
    Comment on it

    360 video are also known as spherical video which records a view in every direction at same time. Unlike normal video 360 video gives you complete 360- angle view. While watching these video you can control viewing direction. These are recorded by special rig  cameras, or using a dedicated 360 camera that contains multiple camera lenses added into the device.

     

     

    Since new video component is added in unity it is possible to add 360 video. Si today in this tutorial, I will show you how to do Integrate 360 Video in Unity, for that first we need following Assets:

    •  Unity3d (5.6 or higher) - cross platform game editor we are using this for setup our scene
    • 360 video - we also need 360 video which we want to integrate
    • Android phone - for test our video

     

    Step 1 - Create scene

     

    The concept of 360 video is straightforward in unity we need rectangular frame for normal video and sphere frame for 360 video.

    • First add a sphere object in scene, and put its position in center (0,0,0) scale radius (60,60,60).
    • Also set camera position to (0,0,0)  which is position of your player.
    • Now run your scene and you can see that nothing going on because most game engine (unity) not allow to render inner side of object

    camera inside sphere

     

    Step 2  - Add shader

    To render object form inside we need to add shader that will apply on sphere’s Material. In unity this process called reversing normal.

    • Create  Material folder inside Assets and add one Material
    Assets> Create> Material

     

    • Create Shader folder and add NewSurfaceShader to it
    Shader> Create> Shader> NewSurfaceShader 

     

    • Now open NewSurfaceShader in editor and Replace the existing code/content with following code:
    Shader "Flipping Normals" {
        Properties {
            _MainTex ("Base (RGB)", 2D) = "white" {}
        }
        SubShader {
    
            Tags { "RenderType" = "Opaque" }
    
            Cull Off
            CGPROGRAM
            #pragma surface surf Lambert vertex:vert
            sampler2D _MainTex;
            struct Input {
                float2 uv_MainTex;
                float4 color : COLOR;
            };
            void vert(inout appdata_full v) {
                v.normal.xyz = v.normal * -1;
            }
            void surf (Input IN, inout SurfaceOutput o) {
                 fixed3 result = tex2D(_MainTex, IN.uv_MainTex);
                 o.Albedo = result.rgb;
                 o.Alpha = 1;
            }
            ENDCG
        }
          Fallback "Diffuse"
    

     

    This shader code will Flip your sphere. Now play your Scene, you will see a big ball in scene, you just need to add video on sphere.

     

    Step 3 - Add 360 video in sphere

     

    • Import 360 video you want to add in scene. Now pick this video and placed it in sphere as an video component
    • Download and import plugin for Google VR SDK . Go to File>Build setting click to Switch Platform (Android).
    • Go to Player Setting>Other Setting select Cardboard to add it to list. Also enter Bundle ID field(unique). Now Build and Run App in your Android  

     

    Integrate 360 Degree Video in Unity for Better VR Experience - 3 Easy Steps

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: