Search Unity

[RELEASED] Universal Video Texture 1.1 Update - Video for Unity free and more

Discussion in 'Assets and Asset Store' started by kahalany, Jul 18, 2012.

  1. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Hi

    Does it work with data loaded with AssetBundles?
     
  2. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, imtrobin.

    Currently UVT does not support AssetBundles.
    That may change in future updates.
     
  3. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Hi, this looks interesting.
    I do have one question, how does this perform on mobile, seeing that Resource.Load is called.
    Just by itself, nothing else in the scene and a guiTexture, what's the fps one is to get?

    I'm thinking of having a short movie in the background in my menu, and maybe more in-game... is it possible even?
     
  4. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Defero.

    Performance is pretty smooth across all platforms, just as long you keep in mind the target's hardware limitations (You wouldn't want to throw 2K textures on an iphone ;)
    As far as PC / Mac goes - you can play insane resolutions (4K and up) in realtime as long as you have a fast enough SSD and a decent GPU.

    The only limitation is Unity's build size cap (still a 32bit architecture).

    Thank you for your interest.

    Royie
     
    Last edited: Jun 5, 2013
  5. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    Is there a Unity limitation that is preventing that from happening? If not, I like to tackle this as I need this functionality.
     
  6. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    I'm not aware of a Unity limitation regarding asset bundles.

    I believe it can be done, however I'm not sure about performance efficiency.
    With asset bundles you'll either have to compile each texture into a separate bundle which may cause an overhead, or compile several textures into an asset bundle and let Unity search and locate the specific texture inside the asset bundle at runtime which may not be suited to real time performance.
     
    Last edited: Jun 7, 2013
  7. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I noticed you use Resource.Load everytime, you could cache that up, no?
     
  8. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Imtrobin, I tried caching in earlier versions, but found it to be less than ideal for efficient memory management, as well as counter productive for longer scenes.
     
  9. Defero

    Defero

    Joined:
    Jul 9, 2012
    Posts:
    200
    Too bad that the image sequence files take alot of space. For a 1 minute good quality movie one could easly hit 70~MB because of unity/cpu correct compression.
     
  10. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Yeah, GPU compression is not as efficient as video compression, storage wise. However, performance wise it's far superior as it enables HD texture play even on an entry level hardware.
     
  11. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    230
    Hi, I'm having problems with unity default MovieTextures, do you think your solution can solve these problems?

    -Slow playback in some videos
    -Suddenly slows sometimes
    -Flick when videos loop

    All videos are 720p

    Thanks :D
     
  12. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Paulo.

    What hardware are you targeting for?
     
  13. Paulo-Henrique025

    Paulo-Henrique025

    Joined:
    Dec 12, 2010
    Posts:
    230
    I'm targeting PC.
     
  14. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    You shouldn't have any problem with 720p with UVT. However keep under consideration that the closest rectangular texture to 720p is 1024x512 which takes 256KB per frame (non mipmapped) - that will amount to about 6-7MB per second of video.

    You can check the free version to see if it suits your needs.

    Let me know if you need any help.

    Royie
     
  15. greg3d

    greg3d

    Joined:
    May 18, 2013
    Posts:
    5
    Kahalany,

    First, thanks for UVT, it is awesome and works great! Can't wait for further updates. Can you steer me in the correct direction, I'm new to scripting and Unity and trying to get a button to toggle the video texture to begin playing. I prefer the video not play until a GUI button is pressed. The following is not working for me...

    using UnityEngine;
    using System.Collections;

    [ExecuteInEditMode]
    public class button2 : MonoBehaviour
    {
    public Rect buttons = new Rect(15, 15, 200, 110);
    public string buttonLabel = "My Button";

    private void OnGUI()
    {
    if (GUI.Button(buttons, buttonLabel))
    VideoTexture.playFactor = 0;
    }
    }

    Thanks,
    greg3d
     
  16. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Greg.

    You need to make playFactor a public variable and get a reference to the VideoTexture script:

    1. Add "public" before "float playFactor"

    2. Declare a local VideoTexture to hold the reference: VideoTexture_FullScreen myVideoTexture;

    3. Reference your local VideoTexture to your object's VideoTexture myVideoTexture = GameObject.Find("YourGameObject").GetComponent("VideoTexture_FullScreen");

    4. Set its playFactor to 0: myVideoTexture.playFactor = 0;

    5.Your OnGUI() should look like this:

    if (GUI.Button(buttons, buttonLabel))
    myVideoTexture.playFactor = 1;

    Next update will include an AutoPlay toggle.

    Royie
     
    Last edited: Jun 14, 2013
  17. greg3d

    greg3d

    Joined:
    May 18, 2013
    Posts:
    5
    Royie, thanks so much for the support. I will give it a try!
     
  18. greg3d

    greg3d

    Joined:
    May 18, 2013
    Posts:
    5
    Royie,

    I couldn't seem to get this to work. Steps #2 - 4, does that script go inside the VideoTexture.cs file or in my button.cs file? Also, do I need to declare this as a variable? And this is for a Video Texture, not the FullScreen Texture. Any help would be appreciated, but if you can't I understand. Basically, I want to add a GUI button to start the VideoTexture playing if that makes sense. Sorry, newbie here. Thank you, Greg

    VideoTexture_FullScreen myVideoTexture;
    myVideoTexture = GameObject.Find("YourGameObject").GetComponent("VideoTexture_FullScreen");
    myVideoTexture.playFactor = 0;
     
  19. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Greg, these lines go into your button script:

    using UnityEngine;
    using System.Collections;

    [ExecuteInEditMode]
    public class button2 : MonoBehaviour
    {
    public Rect buttons = new Rect(15, 15, 200, 110);
    public string buttonLabel = "My Button";

    VideoTexture myVideoTexture;

    void Start()
    {
    myVideoTexture = GameObject.Find("YourGameObject").GetComponent("VideoTexture");
    myVideoTexture.playFactor = 0;
    }


    private void OnGUI()
    {
    if (GUI.Button(buttons, buttonLabel))
    myVideoTexture.playFactor = 1;
    }
    }

    * I don't know why there's a space in the "Vi deoTexture" - must be a bug in the post system. It should be "VideoTexture".
    ** Also you change the "YourGameObject" to the name of the object you attached the VideoTexture to.
     
  20. greg3d

    greg3d

    Joined:
    May 18, 2013
    Posts:
    5
    Royie,

    Thanks so much for the help. It's working now, but had to modify a few things...

    In the button script I had to add "as VideoTexture" as seen in the line below...
    myVideoTexture = GameObject.Find("Plane").GetComponent("VideoTexture") as VideoTexture;

    In the VideoTexture script I had to change the following line:
    "if (intIndex <= firstFrame)" to this: "if (intIndex != firstFrame)"
     
  21. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Thanks for the update, Greg.
    Glad it worked out.
     
  22. rhubarb

    rhubarb

    Joined:
    Jul 15, 2013
    Posts:
    2
    A question about audio loops:

    I'm using around 10 low res video textures that play simultaneously, and each one has its own audio source. UVT seems to handle this well, but once in a while, a few audio sources will skip their loop. This is with Audio Source > Loop unchecked. If Audio Source > Loop is checked, the audio will never skip a loop, but becomes out of sync with some of the videos.

    Any suggestions? Thanks
     
  23. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, rhubarb.

    I haven't done that many simultaneous UVTs yet. Let me see if get this straight: You mean that once in a while an audio clip will not play for an entire loop, but then may resume play in the next? It seems to me that it's an FPS issue - meaning the first couple of frames may be skipped due to performance overhead and so the audio play command will not be sent to the audio handler.

    Which version of Unity are you using?
     
  24. rhubarb

    rhubarb

    Joined:
    Jul 15, 2013
    Posts:
    2
    Yes this is what's happening.

    I'm using Unity 4.1.5

    Any ideas for a quick fix?
     
  25. Fiore

    Fiore

    Joined:
    May 15, 2013
    Posts:
    2
    Hi, I am having problems with using the UVT script with the Oculus Prefab camera. When using the prefab within Unity, I can use layers to limit each eyes view. When I introduce UVT to the scene, it causes both cameras to see all layers. Any ideas on how to get this to work?
     
  26. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Rhubarb, a quick fix would be to call an audio sync with each update, but that would introduce audio artifacts.

    Luckily, I'm just about to finish the next update (due this month) which, among other things handles audio sync and video texture control much better than the current version.
     
  27. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Fiore, does this happen with the material VideoTexture or the full screen one?
     
  28. Fiore

    Fiore

    Joined:
    May 15, 2013
    Posts:
    2
    Kahalany, it happens with the material.
     
  29. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Fiore, since I haven't used the Oculus SDK myself I can't say for sure, but using UVT should not affect layer visibility as it only switches textures at runtime. In your case, when using the same texture and material for both eyes you should only apply one VideoTexture.cs script to either the right or the left eye and set "shared material" option on.

    This should take care of any conflict you might have between the two.

    Great to hear it's being experimented with the Oculus SDK.
    Please let me know how it goes

    Royie
     
  30. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Last edited: Jul 26, 2013
  31. Mars91

    Mars91

    Joined:
    Mar 6, 2012
    Posts:
    572
    Hi.
    Whatare the differences between lite and full version?
    I'm targetting iOS/Android what do you think will be the best resolution?
     
  32. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
  33. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    While the new version is pending review you can check out the following builds running Sintel Trailer using UVT at different resultions.

    This should give you an idea of how UVT performs on your device:

    512x256 UVT Resoultion: PC / Mac / Android
    1024x512 UVT Resoultion: PC / Mac / Android
    2048x1024 UVT Resoution: PC / Mac

    Instructions:

    * Use the WASD keys to move around.
    * Hold the Middle Mouse Button to look around.
    * Click the screen to toggle playback On/Off.
    * Use the scrollbar to scrub through the video texture.

    Thank you all for supporting UVT.

    Royie
     
    Last edited: Jul 30, 2013
  34. bex

    bex

    Joined:
    Jul 31, 2013
    Posts:
    2
    helo, is it possible to play with alpha channel ??
    and can I play more than 1 alpha channel movie as texture in 1 scene
     
  35. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Sure, bex.

    Just as simple as using more than one alpha enabled material in a scene.
     
  36. bex

    bex

    Joined:
    Jul 31, 2013
    Posts:
    2
    thx your reply, kahalany
    two more question, it is possible to play arround 5 alpha channel movie@720P in a scene?? after that, i want to build an android and ios application.
     
  37. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Bex, I assume you're talking about 5 alpha channel movies running at the same time..? While it's possible - that would require a VERY fast hard drive or an SSD and would probably be way too much for a mobile platform.
     
    Last edited: Aug 1, 2013
  38. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    v1.75 has just passed Unity's QA and is now available on the asset store.

    Thank you for supporting UVT.

    Royie
     
  39. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Just updated to the latest v1.75 and it caused a FATAL ERROR for the first time and crashed my Unity 3.5.7 on OSX 10.6.8. :(
    Is the latest version not supporting older version of Unity?
     
  40. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hey, bawss.

    Did you import the package to a new project or overwritten an old one?
    AFAIK none of v1.75 changes should affect compatibility with older versions of Unity.

    Try openning a fresh new project, import the package and play the sample scenes.

    Let me know how it goes.

    Worry not, though - I can always compile a 3.5.7 build if things go sour.
     
  41. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Same thing happened when I started a brand new project. It didn't even finish importing, just hard crash about 90% way through (while compiling I think).

    Error message as follow :

    FATAL ERROR :
    Type == kMetaAssetType pathName.find ("library/metadata") !=0
     
  42. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Working on a 3.5.7 build for you..

    [UPDATE] The package is now ready and available via private request. This should only be of a concern to users who wish to use the latest UVT with older versions of Unity (prior to 4.0.0). Please include your invoice number in your request.
     
    Last edited: Aug 5, 2013
  43. nilton_felicio

    nilton_felicio

    Joined:
    May 17, 2012
    Posts:
    66
    I'm getting a following error after importing your asset. I'm using the paid version. Could it fixed?
    $error_video.jpg
     
  44. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Kahalany, I just tried the latest v1.7.5 build with 3.5.7 fix - but there is a conflict with PhotonNetwork -
    Script name Enums.cs is in conflict with PhotonNetwork's Enums.cs. So, could you change the name of Enums.cs to something else like maybe UVT_Enums.cs?
    Also, Is it possible in the next update to make it 3.5.7 compatible (easier to update)?
     
  45. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Nilton. It seems like a conflict with PlayMaker.
    I haven't tried the two to together yet.

    Which Unity and PlayMaker versions are you using?
     
  46. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Bawss, next update will be 3.5.7 compatible.
    In the meantime you can manually rename UVT's Enums.cs to avoid conflict.
     
  47. nilton_felicio

    nilton_felicio

    Joined:
    May 17, 2012
    Posts:
    66
    I'm using Unity 4.2.1f4 and playmaker 1.7.4f3.
     
  48. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Ok, Nilton. I can now confirm these errors are a result of a conflict between UVT and PlayMaker. Apparently, some of their global variables share the same name. I'll add that to the fix list for the next update. In the meantime don't use the latest version of UVT with PlayMaker.
     
  49. nilton_felicio

    nilton_felicio

    Joined:
    May 17, 2012
    Posts:
    66
    I look forward for this update. Because I need both Playmaker as UVT in my project. Have any prediction?
     
  50. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Nilton, I believe next month would be a safe bet.