Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

How to use a 360x180 video as Skybox

Discussion in 'Getting Started' started by vrnl, Jan 12, 2016.

  1. vrnl

    vrnl

    Joined:
    Jan 12, 2016
    Posts:
    5
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    Using mp4 files as a skybox isn't supported out of the box. That's not to say you can't roll your own solution to do it, but I have to imagine it wouldn't be a simple endeavor. That said, I don't think this fits under "Getting Started" so much as it would Graphics or Scripting.
     
  3. vrnl

    vrnl

    Joined:
    Jan 12, 2016
    Posts:
    5
    Really? I would think that immersive video is beginning to become so common nowadays that this would be a question to be exepected. At least it should be... Am I ahead of my time? :)
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    I'd say so, yes. Immersive video is still pretty niche. Even still, assuming it were more commonplace, I have to believe there are difficulties resource-wise when trying to use 360 degree 4K video as a background. Not saying it can't be done, but it's certainly not the way most (any?) games do backgrounds to this point.
     
  5. vrnl

    vrnl

    Joined:
    Jan 12, 2016
    Posts:
    5
    Maybe it's because I am not really concerned with gaming. My business is making virtual tours (http://virtualtours.nl) and I am learning Unity to turn my tours (normally web based) into apps. The fact that Unity is presented as a platform for architectural applications, convinced me to pursue this, but I now am beginning to think that this is not the right platform for me...
     
    Last edited: Jan 12, 2016
  6. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    15,702
    Not at all. Unity can use movies as textures. I was able to get it working after only a few minutes of downloading QuickTime and a sample movie from Apple. Once QuickTime is installed you simply drag and drop the movie into your Asset folder.

    From there I simply created a skybox material (Skybox/6 Sided), attached it to the global skybox (Window/Lighting), and dragged the movie texture into the Front side of the skybox's cube map. After that I simply wrote a script to play it.

    You may have to write a custom skybox shader though in order to get the desired appearance you want.

    Code (csharp):
    1. using UnityEngine;
    2.  
    3. public class skyboxscript : MonoBehaviour {
    4.    public MovieTexture texture;
    5.  
    6.    void Start () {
    7.       texture.Play();
    8.    }
    9. }
    http://docs.unity3d.com/Manual/class-MovieTexture.html
     
    Last edited: Jan 13, 2016
    Schneider21 likes this.
  7. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    2,914
    @Ryiah never stops proving me wrong, which I am very thankful for.
     
  8. vrnl

    vrnl

    Joined:
    Jan 12, 2016
    Posts:
    5
    When using the movie for the Front side only, it will not wrap around the Skybox, will it? Anyway, I tried doing this, but for some reason the movie will not start playing.
     
  9. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    15,702
    No. That's why I mentioned you may have to write a custom shader. I'm not at all familiar with shaders though so I don't know where to start with this. There may be a solution on the Asset Store.

    I did have trouble when I tried using an MP4 extracted from YouTube but I don't know what the actual reason was.

    I wasn't positive either but I knew about movie textures and decided to just try it. :p
     
  10. AmarBagh

    AmarBagh

    Joined:
    Sep 27, 2015
    Posts:
    4
    dumb question but what do you attach the script to
     
  11. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    15,702
    If I recall correctly, it has been a while after all, you attach it to the camera.
     
  12. Sizoo8

    Sizoo8

    Joined:
    Mar 17, 2017
    Posts:
    2
    My video works fine on a GameObject (ie a cube) but following these instructions for the skybox (attaching the script to the camera) I get the error <MissingComponentException: There is no 'Renderer' attached to "MainCamera" gameobject, but a script is trying to access it>

    Could anyone help?
     
  13. Sizoo8

    Sizoo8

    Joined:
    Mar 17, 2017
    Posts:
    2
    Oops.. I was using still using the unity code sample. Replaced it with the above code and its working perfectly ;) Thanks
     
unityunity