Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[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. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    $Big_00001.png

    Ever needed to use a video in Unity but couldn't afford unity pro?

    This neat little package will enable you to use a series of sequential images as a video texture just like a standard video clip with synchronized sound. You can set your FPS, Play mode, Audio Source, and other advanced features to tweak it for your specific needs.

    Now with a simple API for controlling your video textures through script and support for customizable and interactive controls for both full screen and material video textures.

    Tested thoroughly and works like a charm with Unity Free / Pro, Web, iOS and Android.

    Includes memory management for maintaining the lowest possible memory footprint and optimal performance across all platforms.

    Universal Video Texture (UVT) is modular. You can attach multiple scripts for a single material (i.e. one script for diffuse, one script for bump, etc..).

    Check out my web demo.

    Demo 1 - Material UVT
    Demo 2 - Full Screen UVT
    Demo 3 - Interactive Material UVT
    Demo 4 - MultiScreen Interactive Material UVT

    Still not convinced?
    The following multi platform / multi res builds should give you an idea of how well 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.

    Price: $20 (Less than half the price of other solutions).

    Version 1.75

    - Major code reconstruction.
    - Changed VideoTexture.cs to VideoTexture_Material.cs to differentiate it from
    VideoTexture_FullScreen.cs and better reflect its purpose.
    - Moved audio management code to AudioManager.cs.
    - Moved all enumerators to Enums.cs (all public enums now start with uppercase
    while their respective local variables start with lowercase).
    - Added interactive controls for VideoTexture_Material using customizable controls.
    - Added a simple API for controlling all video textures.
    - Added Auto Play feature.
    - Added Auto Desctruct feature.
    - Added Auto Hide When Done feature.
    - Added Auto Load Scene When Done feature.
    - Added Force Audio Sync feature.
    - Added the ability to start PingPong play mode with reverse.
    - Added support for HeightMap / Parralax maps.

    Version 1.5

    - Added a new script for full screen playback with customizable scroll bar and interactive scrubbing.
    - Additional code cleaning and optimizations.

    Version 1.1

    - Added Random Playmode - Great for video filters and masks.
    - Added the ability to set a playback range (First Frame / Last Frame).
    - Added the ability to turn ON/OFF synchronized audio.
    - Added BruteForce low memory mode.
    - Added Shared Material mode for affecting multiple objects sharing the same video texture with a single script.
     
    Last edited: Aug 3, 2013
  2. Skeleton

    Skeleton

    Joined:
    Nov 18, 2011
    Posts:
    34
    hmmm looks ok but i think you use an texture arrray thats simple show and this is very easy to self creation :)

    so i think this is not 20$ worth :) the other solutions use real movies... and not textures that will played as an movie...
     
  3. homeros

    homeros

    Joined:
    Dec 23, 2009
    Posts:
    121
    I don't see anything wrong with texture array or the like as the 'real movies' are also image sequences with synced audio. But I would like to see a video where we can see if audio actually is in sync with some real motion(like moving characters or objects) in it.
     
  4. Skeleton

    Skeleton

    Joined:
    Nov 18, 2011
    Posts:
    34
    i say not that is wrong i just say it is simple and not 20$ worth ;)
     
  5. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Skeleton. And thank you for your input.

    Texture array is actually something I implemented for the initial release, however I dropped it for a single, memory managed texture placeholder for both performance and lowest memory footprint. Also, while a simple texture array is rather simple to create, adding all the other tweaks and bullet proofing them through each platform takes a while.
     
    Last edited: Jul 18, 2012
  6. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Homeros. You are more than welcome to check out the Sintel trailer with synchronized audio:

    I've included 2 versions:

    PC

    Android (APK)
     
  7. patch24

    patch24

    Joined:
    Mar 29, 2009
    Posts:
    120
    Hi, I'm curious what your workflow is. If you have, say, quicktime movies and want to use those on a texture, is the procedure to then extract every frame out of the movie file and import all those (possibly thousands of images) into your project? Are there any included utilities to help in the process?

    Also, how are you actually syncing up the sound...is it thru an update loop? I ask because I'm curious how performant it might or might not be to constantly check audio file position against frame number.

    Thanks!
    -p
     
  8. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Yeh I am with patch24.
    I am wondering exactly the same thing. Would your Universal Video Texture include utilities to convert movie/videos (avi/mpeg/mp4/mkv) to video textures to be used? I would imagine this would be the ideal case - one button solution where you just need to import the video file and this would automatically convert the videos sequential images and automatically synch up the sound in the original video file by itself.

    If you can make it work that way, you got a customer ;)
     
  9. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Patrick and thank you for your interest.

    UVT''s workflow is pretty straight forward: You export your movie as a series of still images (*.png , *.jpg etc..) and feed it into unity. Exporting sequence of images is a fundamental feature for almost every video editor I know, so you can probably use your own (I myself prefer Adobe After Effects) or just download Blender which is free and has a built in video editor which is more than enough for the job.
    Importing your images to unity is just as easy, basically just drug and drop to your Resources directory. However for longer, hi res clips I would recommend using external tool such as nVidia's DXT converter, AMD's ATI compressonator, or Imagination PVRTexTool. All these apps are free and can batch convert your images for use in unity much faster than unity's built in conversion (which happens automatically during the import process to unity). This way you can import your pre converted images to unity in no time.

    Regarding the audio sync.: As of version 1.1 the audio sync is calculated once per play iteration according to the chosen frame range, so it doesn't affect performance one bit.

    Also, right now I'm working on version 1.2 which (among other things) will include an additional script for full screen playback using Unity's built in GUI with an interactive progress bar and custom skins. This script will trigger an audio sync update with every user interaction (play / pause / scrubbing) with practically zero performance hit.

    Again, thank you for interest.

    Please let me know if you need any help.
     
  10. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    I hear ya, bawss. Indeed, it will be an ideal case. Unfortunately, this is not the case here. You're still gonna have to do the exporting / importing yourself, which is not that bad considering the benefits.

    I'll be more than happy to guide you through the process.

    See ya' in Amsterdam.. ;)
     
  11. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Everyone. Just released version 1.5 - a major update with new bells and whistles.

    Let me know what you think.

    All the best,

    Royie
     
  12. I am da bawss

    I am da bawss

    Joined:
    Jun 2, 2011
    Posts:
    2,574
    Awesome !! Thanks for the update!
    Also, can I make a suggestion? Can you allow the option to start playing the video in reverse?
     
    Last edited: Oct 30, 2012
  13. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Sure thing, Bawss. I'll get that one in the next update.
     
  14. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    hi
    i just purchase your asset, i got an issue try to play the providing video,i open the exemple scene, create a plane or a cube attach the script on it, use the exact same name VidTexUCL_ , set the number of frame drop the providing material, set it to loop, but nothing is display even tho the scene work fine.
    could you help me out , do i forget something?
    also sequence png take in account the transparency? so i can play a transparency shader in it?

    thanks for reading
     
  15. kahalany

    kahalany

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

    Just making sure:

    1. Did you attach the right script to the cube? (in your case it should be VideoTexture.cs and NOT VideoTexture_FullScreen.cs).
    2. Did you set the digits format (the number of running digits) correctly?

    Also, you can use alpha channel in your video texture just like any other material in your scene.

    If you still can't get it to work, feel free to contact me directly at kahalany@kahalany.net. I'd be more than happy to look into it.

    All the best,

    Royie
     
    Last edited: Nov 4, 2012
  16. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    fix the issue, was my fault i forget one extra 0, is by default it has 4 digit.
    work like a charms now, what does low memory mode does?

    thanks for ur reply

    cheers
     
  17. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Glad you nailed it, toto.

    Low memory mode makes sure each frame is freed from the memory after being projected.
    Basically it allows you virtually unlimited video texture length.

    Have fun at it!

    Royie
     
    Last edited: Nov 9, 2012
  18. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    hi kahalany
    i wonder if u can made a quick tutorial on how to use AMD's ATI compressonator, or Imagination PVRTexTool, i can t manage to batch the sequence of image. or what would be the proper way to do it without losing too much quality and still be able to drop the folder into unity in no time.
     
  19. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, toto.
    AMD's compressonator has a rather straight forward auto batcher, you can find it in the File menu (under Batch Compress), just select all the files you want to convert and your chosen output format (I use it mostly for DXT).

    For general use try this settings:

    Output File Format: DirectDraw Surface Textures
    Output Format : ATI 3Dc Compression
    Under Options select DXT1 or DXT5 (If you want to preserve the alpha channel)
    and just press Compress

    As far as i know Imagination PVRTexTool doesn't have a built in auto batcher. However it can easily be done using a Command line Batch file. I'll post a quick tutorial on how to do just that as soon as i can.

    All the best,

    Royie
     
  20. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    dude u re amazing, thanks for the support.
     
  21. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Okay, batching with PVRTexTool. Basically, this is how it goes:

    After installation copy both your images and the PVRTexTool.exe file to a new directory. For simplicity's sake, let's call this new directory "MyImages" under C: Drive.

    Launch windows console (Push the start button, type "cmd" and press enter).

    Get in your new directory (type "cd c:\MyImages").

    Now, If you simply execute PVRTexTool you'll see a list of its main parameters. Don't be overwhelmed, only few are needed for our task.

    Lets say we want to batch convert for iOS pvrtc format:

    In order to execute a batch operation you need to create a batch file (with .BAT extension) .

    Open any text editor and enter the following command (excluding the quotation marks):

    "for %%x in (*.png) do PVRTexTool -fpvrtc4 -pvrlegacy -yflip1 -i%%x"

    where png stands for your source images, pvrtc4 - for the output format, pvrlegacy is added to make it compatible with unity and flip1 reverse the auto flipping that occurs during this procedure.

    Save your file as PVRBatch.BAT in the same directory as your images and close the text editor.

    Run it, and the batch process will begin. Violla!

    you may add a quality setting as well (-pvrtcfast for lowest quality / fastest encoding or -pvrtcbest for highest quality / slowest encoding).

    the following, in my opinion are the best bang for buck settings for the iOS:

    "for %%x in (*.png) do PVRTexTool -fpvrtc2 -pvrlegacy -pvrtcbest -yflip1 -i%%x"

    This encodes the sequence with pvrtc2 format which takes half the size as pvrtc4, and combined with -pvrtcbest settings you can hardly tell the difference between the two. It does, however comes at the cost of encoding speed.

    you may also add resize parameters at the end:

    "for %%x in (*.png) do PVRTexTool -fpvrtc2 -pvrlegacy -pvrtcbest -yflip1 -i%%x -x512 -y512"

    where -x512 (width) and -y512 (height) specify the dimension of the output image in pixels.

    So, there you go. Let me know if you need anymore help.
    All the best,

    Royie
     
    Last edited: Nov 24, 2012
  22. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    hi royie

    i have some big issue here, i didn t manage to run my sequences of jpg, i open the samplescene from the package, i export with after effect a video into sequence of jpg, drop the output folder into _texture unity exemple folder, create a plane , attach the videotexture script, the sequence is name as 01_00000 jpg, so i name it as 01_ in inspector, nothing happen, i try another test by replacing the actual video VidTexUCL_ with 01_ but no result, should i place the ressource folder in a specific location or name it as ressource?

    regards
     
  23. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Toto.
    Your image sequence files HAVE to be inside a folder called "Resources", otherwise it won't work.
    Also, don't forget to put "00000" as the digits format, and "Postfix" as digits location.

    All the best,

    Royie
     
  24. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    works! i find out u have to call the folder "Resources" when in my langage we name ressources! :)
    but thanks again for you re awesome support, the amd s tool work perfect and is way more simplier to batch!
     
  25. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    hi kahalany
    i was wondering if it s possible to stop and restart the videotexture with a predefine fonction by script?

    cheers!
     
  26. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, Toto. Sorry for the delay.
    To Stop/Play a video texture you just need to call on TogglePlay() function. To restart a video texture reset index to firstFrame (index = firstFrame).

    Let me know if you need any help,

    Royie
     
  27. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    520
    hi kahalany
    thanks for the answer, i manage to fullfill my need just by disable/enable the script, and access to the index and put it at 0 to restart, i was wondering if there a way to get a callback fonction to know when the video is finish? that would be usefull i think.

    other than that work like a charms.

    toto
     
  28. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Don't worry toto,

    All of this and more will be implemented in the next update.

    All the best,

    Royie
     
  29. tevezisgod

    tevezisgod

    Joined:
    Feb 26, 2013
    Posts:
    1
    Hi Kahalany.
    How do you preserve alpha for a png sequence with UVT?
     
  30. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    If the png contains an alpha channel, it'll be preserved aumatically and used in UVT, with both full screen and material versions just like any other alpha enabled source.
     
  31. Play_Edu

    Play_Edu

    Joined:
    Jun 10, 2012
    Posts:
    722
    hi,


    it's nice tool. but can it work with any video format like Avi, mp4, 3gp, etc. plzzzzz. tell me. great work.


    regards
    play_edu
     
  32. imtrobin

    imtrobin

    Joined:
    Nov 30, 2009
    Posts:
    1,548
    I'm curious, with your low memory mode, is it possible to have streaming from server, if it can download images quickly and feed into your display buffer?
     
  33. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi.
    UVT can't work directly with video files. You'll have to export your videos as sequence of images (PNG, TIFF, DDS, etc..) and feed it to Unity.

    Let me know if you need any help.

    Royie
     
  34. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Hi, there.
    Streaming images from a server is not supported yet, as currently Unity can't stream pre converted textures at run time. All the images have to be compiled in the build just like any other asset.
     
  35. islanddreamer

    islanddreamer

    Joined:
    Apr 29, 2006
    Posts:
    473
    Is it possible for the image files to have an alpha channel? I didn't see any transparency options among the materials.
     
  36. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Sure, just make sure your images carry one and apply them to a transparent material. The web demo illustrates this - the green video noise affect is actually a transparent material on top of the trailer footage material.
     
  37. trelobyte

    trelobyte

    Joined:
    Nov 17, 2010
    Posts:
    54
    hello i have downloaded the free version, Thanks ! I have a questions before buying the full version.
    Can the movie be played on a plane or any other geometry without the need for it to go fullscreen ?

    [edit]

    ok i just saw the differences of the full version...purshased !
     
    Last edited: Apr 12, 2013
  38. BoilermakerTim

    BoilermakerTim

    Joined:
    Apr 20, 2013
    Posts:
    2
    A fast, easy and free way to convert a video file to a series of images is to use ffmpeg. It's a command line tool, but it's simple enough to use. I placed the ffmpeg.exe in the Windows/System32 folder, ran an elevated command prompt with my video on the C drive and did the following:

    ffmpeg -r 24 -i video.mpg -qscale 0 -r 24 VidTexUCL_%05d.png

    That will take the video.mpg with 24fps and output it with the same quality (-qscale 0) with 24 images for each second of video to filenames from VidTexUCL_00001.png to VidTexUCLxxxx9.png. Hope that helps someone.
     
  39. trelobyte

    trelobyte

    Joined:
    Nov 17, 2010
    Posts:
    54
    Is is possible to have video scrubbing in non fullscreen mode ?
    Thanks
     
  40. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Currently no. Is there something specific you're trying to accomplish?
    Do you need to scrub a material based UVT?
     
  41. trelobyte

    trelobyte

    Joined:
    Nov 17, 2010
    Posts:
    54
    I am trying to control a plane that has an image sequence of x-rays on it, when scrubbing i would like the plane to translate on the z and also play the image sequence on it so that the result shows that its scanning through an object.
    Is there a way to do this with Universal Video Texture ?
    Many Thanks

     
  42. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    96
    Excellent!
    1) Does this mean that by exporting png's with an alpha channel we can get video with a transparent background? I haven't been able to try it yet
    2) Slightly off top: but if I use this a lot - to decrease the size of what I am dev - would it be possible to link to to image/sound folder on line rather than in the internal Assets folder?
    Thanks
    be
     
  43. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    I see, Trelobyte. Unfortunately you cannot do that out of the box with the current version. You can try and manipulate the playback routine to use your z parameter instead of the default playback time.

    In the meantime I'll put that feature on UVT's wish list.
     
  44. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    Yup.

    Currently, linking to external asset folders isn't suitable for realtime applications. For instance - Although you can load png or jpg via www class Unity has to encode the image in run time - which can take up to a few seconds per image.
     
  45. Bentoon

    Bentoon

    Joined:
    Apr 26, 2013
    Posts:
    96
    Excellent
    I thought there was real time external management with video ... Maybe it's in pro. Or maybe because you are loading ind images.
    Regardless, you've done a great job . Thank you
     
  46. trelobyte

    trelobyte

    Joined:
    Nov 17, 2010
    Posts:
    54
    Thanks for the reply !
    Any ETA ?
     
  47. kahalany

    kahalany

    Joined:
    Jul 6, 2012
    Posts:
    80
    I can't say for sure as I'm still experimenting with some features.
    I'll keep you posted as soon as I nail them down.
     
  48. posh

    posh

    Joined:
    May 8, 2013
    Posts:
    2
    Hey Kahalany, just bought the UVT and got it to run easily. Is there a way to use TogglePlay when working with VideoTexture and not VideoTexture_FullScreen?
     
  49. kahalany

    kahalany

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

    With the VideoTexture script you can do that manually by setting playFactor to 0 which basically pauses the video and then resetting it to 1 for forward playback or -1 for reverse playback. If you have an audio attached you can toggle it on/off with the myAudio.Toggle() method.

    Thank you for supporting UVT.

    Royie
     
  50. posh

    posh

    Joined:
    May 8, 2013
    Posts:
    2
    Thanks, works great! Really easy to understand and modify your script :)
     
unityunity