Search Unity

  1. We are migrating the Unity Forums to Unity Discussions. On July 12, the Unity Forums will become read-only.

    Please, do not make any changes to your username or email addresses at id.unity.com during this transition time.

    On July 15, Unity Discussions will become read-only until July 18, when the new design and the migrated forum contents will go live.


    Read our full announcement for more information and let us know if you have any questions.

Projecting a 360 degree VR video on a sphere

Discussion in 'AR/VR (XR) Discussion' started by shivam3d, Dec 28, 2015.

  1. shivam3d

    shivam3d

    Joined:
    Nov 13, 2012
    Posts:
    10
  2. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    I wish I could help but without seeing any scripts or knowing anything about that asset there's very little to go on.

    Maybe contact the creators of Easy Movie Texture and ask them specifics about the texture created.

    Why type of texture is it?
    When is it created (end of a frame? at time intervals? In the update method?)
    Does it work on Android?

    Then try to piece together where things are going wrong. If your sphere doesn't work can you make the render texture work on a flat surface? (Answering this would at least prove that the render to texture asset works in VR.)

    If you can gather/share more information I might be able to help. Don't get discouraged. VR is still in its early stages.

    ~E
     
  3. shivam3d

    shivam3d

    Joined:
    Nov 13, 2012
    Posts:
    10
    Okay, I don't know the reason but I just used the sphere demo that came with the plugin and now it is working fine on Android. The problem is that the video is not stereo. There is just one sphere on which I'm applying the mp4 texture and the Google Cardboard Camera Prefab inside it.

    To make it stereo, I did this:

    I duplicated the sphere. I renamed them as "LeftSphere" and "RightSphere" then I added them to layers called left and right. Then, I changed the camera's settings such that the left camera only renders the left sphere and the right camera only renders the right sphere (culling mask).

    However, when I run the app on my phone, only the left camera shows video and the right one just shows a white sphere. The logic is correct. I tested it by adding a cube and adding the cube to the "right" layer. Google Cardboard's right camera correctly shows the cube and the left camera do not (as it is supposed to). However, the problem arises when a movie texture is applied to the sphere.

    Can you help me? Basically, I want to run virtual reality (360 degree 3d videos) on the unity engine.

    If you need, I can upload the Unity Project folder.
     
  4. SniperEvan

    SniperEvan

    Joined:
    Mar 3, 2013
    Posts:
    161
    I don't know much about this bit I can offer general trouble shooting advice.

    Does the render aset you bought let you render on two things at once? Try it out on two things visible to the same camera.

    You said the cube show's up in the right eye but no video. Can you apply the video to a cube as a test?

    If you CANT render to two things then that's your problem. Maybe you could request this feature (from the asset you bought) or implement it yourself.

    Let me know what you find out. I'm always happy to try and help.
     
  5. DerrickBarra

    DerrickBarra

    Joined:
    Nov 19, 2013
    Posts:
    210
    Try using two low resolution video's (1080p or lower) for testing. If both left and right videos show up you might be encountering the one video 4K limit most devices have. In that case only one video would appear on the device while the other would be blank (white or black depending on what asset store asset your using (Easy Movie Texture vs MPMP).

    There is a script in either Easy Movie Texture or MPMP to replicate the texture from one eye to the other, so you can at the very least get a mono 4K 360 video to play in each eye, since that would only require one video to play.

    Or you could use a TB (Top-Bottom) or SBS (Side-By-Side) video on your left eye at 4K, and replicate that to the right eye. Then you could set the material for each sphere to only display the part of the video you want it to see (stretching/tiling options). That would lower your resolution to 2k per eye roughly, but you would indeed get a stereo 360 VR video within the limitation of only being able to play one 4K video.
     
  6. Thiago-Crawford

    Thiago-Crawford

    Joined:
    Jan 7, 2013
    Posts:
    92
    I've done this exact thing. Here is what you need to do...

    - Outside Unity -
    1. Create one Sphere for each Eye.
    2. Depending on the eye, arrange the UVs of the sphere accordingly. (this must reflect the format of your stereo video, ie above below or side by side)
    3. With a samsung S6, keep video resolution at 3840x1920

    - In Unity -
    4. Use EasyMovietexture to play the video on the texture of 1 esphere and copy that playback using the other EasyMovieTexture script. (Because of different UVs, the video playback on spheres will look different)
    5. Create 2 layers in the scene, one for left eye and one for right. Place the Left and Right eye speheres, into their respective layers.
    6a. Using the Oculus camera rig, duplicate the actual camera. Set one camera to exclude left eye layer and the other the right eye layer.
    6b. Set the "Target Eye" for each camera.

    That is the gist of it.
     
    ilmario and Nuitari like this.
  7. Nuitari

    Nuitari

    Joined:
    Oct 24, 2013
    Posts:
    25
    Thank you! This solved my issues with the two sphere setup based on http://bernieroehl.com/360stereoinunity/ ! Doing it the way he suggests with two separate materials leads to video sync issues. Using different UV maps and ONE material is the key, plus only attaching the video to one sphere and copying it with the copy script to the other.
     
  8. Thiago-Crawford

    Thiago-Crawford

    Joined:
    Jan 7, 2013
    Posts:
    92
    Hey glad it helped you out ;)
     
    Nuitari likes this.
  9. wesloc

    wesloc

    Joined:
    Feb 4, 2017
    Posts:
    14
    Sorry to bring up the topic again. As I am new to unity, I cannot seem to figure out how to
    "arrange the UVs of the sphere accordingly"?

    Is this done in the Inspector for the sphere? I cannot find where in the inspector is the UV map setting.

    Thank you very much.
     
  10. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
    No, he did say "Outside of Unity", meaning the 3D modeling program of your choice. The Unity sphere has some warping when used for such a thing. Making your own sphere in a 3D modeling program like Maya or 3DStudio will allow you to tweak the UV mapping of the sphere to have a better look.
     
    wesloc likes this.
  11. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    wesloc likes this.
  12. screenname_taken

    screenname_taken

    Joined:
    Apr 8, 2013
    Posts:
    663
    wesloc likes this.
  13. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
  14. MMN91

    MMN91

    Joined:
    Mar 12, 2017
    Posts:
    1
    Also bringing this up again - I would really appreciate any advice on the UV sphere mapping stuff. I tried using unity spheres with a shader to flip the faces - but the top and bottom of the video is just stretched and doesn't look great.

    I'm using blender to create spheres and I get as far as unwrapping the sphere but then don't know what to do..

    Building for Oculus - I have a stereoscopic top-bottom video and struggling to get it working properly in Unity. At the moment my set up is two spheres with left/right layers and the OVR cameras left/right anchors set up to read each one individually. I'm using the Video Player and one Render Texture which is on both spheres.

    When using two different materials and the custom shader on the spheres I am unable to set the tiling/offset values which is why i'm turning to blender as it seems I can edit that there? (new to blender and unity!).

    Thanks for any help :)
     
    wesloc likes this.
  15. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    I'm not sure proper way to do this in Blender (youtube search for Blender Skydome Tutorial). However I do show how to make the sphere with Maya and texture using Photoshop:
     
    ilmario and wesloc like this.
  16. wesloc

    wesloc

    Joined:
    Feb 4, 2017
    Posts:
    14
    Thanks for all the comments. I was away from this topic for a while.