How to create VR Video player using Google Cardboard SDK for Unity

后端 未结 5 1498
走了就别回头了
走了就别回头了 2020-12-23 08:34

I just downloaded Google Cardboard SDK for unity. I am fine and able to create VR project. Setup is fine and everything is working fine.

I am noob at VR Apps. Just s

5条回答
  •  醉话见心
    2020-12-23 09:29

    I saw the answers above but all of them either required Easy Movie Texture Unity plug-in or coding your way through.. There's another easy solution to this as well which won't require you to buy that asset or code your way through.. Oculus provides an already built free sample framework which you can use without much trouble.. The solution below shows both how to create both a photo viewer as well as video viewer for Unity..

    Building your 360 degree PhotoViewer:

    1. Go to Blender and delete all the prexisitng objects (if any) and make an icosphere and increase the subdivisions to a point where it looks more like a sphere like 6 and hit Generate UVs (both these options are found in settings underneath the create tab in add to sphere) and go to edit and choose Flip Normals so that you can see inside out rather than outside inwards and save it.
    2. Bring that icosphere saved file into your assets folder in Unity.
    3. Download GoogleVR SDK and bring GoogleVR plugin into your assets folder as well.. (You can download it here: https://developers.google.com/vr/unity/)
    4. Delete the main camera and directional light present in default.
    5. Bring your icosphere asset into your project.
    6. Bring GVR Main from your assets folder into your project: GoogleVR plugin -> Legacy -> Prefab -> GVR Main
    7. Take any panaroma or 360 photo and bring it in your assets folder.
    8. Take this photo in your asset folder and put it above the icosphere in your scene and hit play. You should be able to see your 360 degree photos.

    Building your 360 degree MoviePlayer:

    1. Step 1 same.
    2. Now go to the Oculus developer console and download this file and bring this to your assets folder. https://developer3.oculus.com/downloads/game-engines/1.5.0/Oculus_Sample_Framework_for_Unity_5_Project/
    3. Bring this file you downloaded above to your assets folder.
    4. Find MoviePlayer in your assetsFolder in bring it in your project.
    5. Bring the icosphere you downloaded into your assets folder as well and scale it a little bit so you can see correctly.
    6. Copy the MoviePlayer sample script and Audio Source in the components of the MovieSurface from the project and add it in the components of the sphere in the scene, also get rid of the animator in the components of the sphere.
    7. Bring the Movie Player material found in the Materials under Mesh Renderer in MovieSurface and add it on top of your sphere.
    8. Now this sphere formed is your 360 degree movie player so store it as an asset in the asset folder.
    9. Create a new scene, delete the directional light and bring your saved icosphere asset into this scene and move the main camera at the centre.
    10. Delete the non required assets to clean up some space in your project other than MoviePlayer, Plugins and Streaming Assets.
    11. You'll have to convert the desired mp4 into an ogv file as well for the plugin to play in VR and bring both the mp4 and ogv files into your streaming assets folder and change the MovieName and click Play. You should be able to see your 360 degree video playing.

    *To play it in your devices, just go to build settings and choose the desired platform and delete all the scene and just Add Open Scene and click on the Virtual Reality Supported in Other Settings under Player Settings. To play it in your android phone you need to download the GoogleVR SDK just like above and bring it in your assets folder and find the GVRViewerMain in the assets folder and bring it in the scene and uncheck the Virtual Reality Supported you did above and just build and run the whole thing in your device (You should be able to see the view in you game mode when you hit play in Unity). You should be able to see the video in your respective gear.

    • There's also a video tutorial available but I'm only able to share only 2 links with my new StackOverFlow profile.

提交回复
热议问题