Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

U Chroma Key image effect

Discussion in 'Assets and Asset Store' started by CatsPawGames, Oct 24, 2014.

  1. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    twitter_forums.JPG

    U Chroma Key image effect does what its name implies - it's GPU-based chroma key solution for Unity.

    It's based on Colorify flexible color range selection algorithm and includes webcam support, so you don't have to access webcam classes through code if you don't want to. (WebCamTexture is still available for manipulation if you need it). Same algorithm is used in Advanced Selective Coloring image effect.

    Asset Store link

    Manual

    P.S. You can also check my other asset : ArcReactor procedural rays generator

    Image.JPG
     
    Last edited: May 22, 2020
  2. angelodelvecchio

    angelodelvecchio

    Joined:
    Nov 15, 2012
    Posts:
    170
    hi! so its possible to import a video and mix with a unity3d scene ? like to put a nice girl like that in a viking village with global illumination support in unity5 ?
     
  3. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello!

    Yes, it's possible, that's the reason this asset was created. The only problem is I didn't test it on Unity5, so there might be compatibility issues.
     
  4. yeye77

    yeye77

    Joined:
    Apr 5, 2015
    Posts:
    1
    hello! ^^ I bought this system one month ago, and I have few questions about chromakey size.
    the default size is too big to me T_T
    How can i cutdown the size?
     
  5. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
  6. Riffel

    Riffel

    Joined:
    Nov 20, 2014
    Posts:
    6
    Make a virtual studio (augmented reality) I will pay double price!
     
  7. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Just purchased this today through the company and its a great solution. Works better than another asset we had on the store, and very nice edge results on one of our videos. I did have to modify the shader to allow for a standard texture (_MainTex) rather than your custom variation, so that it will work with VTP.

    Nice controls, but I am unsure what the point of the "Main Color" property on the shader is used for? Seems to just cause issues if set to anything but white.

    Would be nice to know if you would be able to implement more of a feathering effect around the edges of the cutout area. So it fades off rather than a hard cut, as I think these can give nicer results.

    In all, great product, looking forward to doing more tests with it.
     
  8. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Thanks for feedback! Glad you liked it.

    As for shaders, you can also just choose "Texture" source and assign your source texture to chromaKeyTexture variable(it will take any kind of texture - render, webcam etc.) of UChromaKey component - it will assign needed shader parameters on its own. Just a hint for those uncomfortable with modifying shaders. Use this, for example, if you already have WebCamTexture handled by other scripts and just need to feed it to UChromaKey.

    - "Main Color" property is used for primitive color correction/tinting of your video source, but you're right that it's best to leave it white.

    - Feathering effect is feasible, although it would make a performance hit since it'll add 2 passes for mask generation and mask blurring. I think I'll make a toggle for that in next version.
     
    mimminito likes this.
  9. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    Thanks for the help! Great to know its being supported.

    I had to modify the shader unfortunately as the texture for VTP is generated via a script, and not accessible via the inspector. I did try to set the texture for your shader programatically but that didnt work for some reason. At least I have it working now!
     
  10. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
    Hi @CatsPawGames,

    If you read this thread maybe you can help to improve ChromaKey Shader for realtime video compositing into Unity !

    http://forum.unity3d.com/threads/vi...xture-bitmap-adjustments.321299/#post-2083959

    Is wonderful if your shader can make the:

    - Works with video-texture.
    - Generate respective Shadow of visible video elements after chroma applied. (optional)
    - allow change contrast, bright, and other color corrections after apply the chroma result.
    - Apply color correction palletes ( optional, like Cinema Themes ).

    With this Unity can be a great video compositing tool !



    To inspire you:
     
    Last edited: Apr 25, 2015
  11. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Sorry for late reply.

    I'm currently working on updated version of UChromaKey shader that'll be completely decoupled from other UChromaKey parts so you can plug it into your project without adding other components - this'll solve video texture issue.

    As for contrast, brightness and color corrections - this component isn't really targeted as dedicated video composing tool, and I'm pretty sure benefits of adding that functionality are too small to justify huge amounts of additional work and performance drop. If you need these effects, I suggest adding other image effects on top of UChromaKey (thankfully Unity image effect pipeline allows for making chains of effects pretty easily).
     
  12. rebit

    rebit

    Joined:
    Nov 13, 2014
    Posts:
    133
    Hi, thanks your reply.

    I understand.

    But, as you said, if the image effects are applied on top of UChromakey, this will not solve the problem to fit the chromakey object of excataly color that designer needs on the scene, all the components needs to fit a color to be realistic.

    Pls, consider a separately aditional options to post-process color correction on your chroma-shader to make Unity a video compositing tool !

    Another feature is the shadow, generating shadows is important to accelerate the workflow.

    Any chance ?
     
  13. ram_saa

    ram_saa

    Joined:
    Feb 18, 2014
    Posts:
    3
    Maybe is a stupid question, but, does it works with Vuforia?
     
  14. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    To be honest, I have no idea. Probably not out of the box.
     
  15. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    My (not-so-reliable)hosting killed ArcReactor site that was hosting demos and manual, so they are unavailable right now. I'm in the process of moving materials to my own server, new links should be up at the beginning of next week.

    My apologies to people who was trying to access demos or manual.
     
  16. paramama

    paramama

    Joined:
    May 10, 2014
    Posts:
    6
    My situation: in webcam video i have green/gray background and only one color object. Can your plugin get texture this object
    Продублирую по-русски: у меня снимает вебкамера, отображается зеленый/серый фон и там же находится объект цветной (те я наложил на фон маску и выделил этот объект). Вопрос: ваш плагин может распознать этот объект и взять с него текстуру
     
  17. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Плагин может выделить этот объект(сделать фон прозрачным), после чего результат можно наложить на экран в виде пост-эффекта, или использовать в качестве текстуры в шейдерах, которые идут в комплекте. С небольшими доработками текстуру можно использовать в любых шейдерах.
     
  18. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Coming soon in version 1.2: "Direct source" shader that will accept source texture without using global manager component, which will make UChromaKey significantly easier to use on materials.
     
    rebit and mimminito like this.
  19. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    rebit likes this.
  20. gau098

    gau098

    Joined:
    Dec 24, 2013
    Posts:
    3
    @CatsPawGames : Please do post email id..have few queries could not find anywhere....
     
  21. gau098

    gau098

    Joined:
    Dec 24, 2013
    Posts:
    3
  22. ACastor

    ACastor

    Joined:
    Nov 4, 2014
    Posts:
    1
    I just want to know before i buy this software... Is this working in UNITY 5.3.4... i just want to know if there are problem. thank you.
     
  23. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello, I tested it on 5.3.4, all works as intended.
     
  24. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I got a bugreport with Android compatibility issues in Unity 5.3+.
    Fix is currently awaiting approval by AS team, but if you need it right now you can send me email to my publisher support mail with your invoice.
     
  25. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.3 is awaiting approval by Asset Store.

    Changelog:
    • Unity 5.5 compatibility fixes
    • enabled stacking of multiple chroma-key components on single camera (full-screen effect)
     
  26. nerdSenpai

    nerdSenpai

    Joined:
    Dec 25, 2016
    Posts:
    2
    Hello,

    With this asset, would it be possible to put a 3D scene behind the person who is using their front cam of their phone, in real time?

    Thank you.
     
  27. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello. Yes, it was the main reason this asset was made.

    Of course you'll need more-or-less evenly colored background behind the person recording. Phone motion tracking can also be potential problem depending on your app, and this asset doesn't handle that.
     
  28. CristianArrow

    CristianArrow

    Joined:
    Mar 13, 2017
    Posts:
    3
    Hi! i need load a jpg in real time and bring the options for select the background image in real time then i have to save a png of final image, is this posible?
    i think the most important question is if i can save the result to a png. and how...
    Thanks!
     
  29. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello. You need to use RenderTextures for that, but it's possible. Please send me a message to my support email with your invoice number and I'll reply with updated version (it's more convenient to use it with RenderTextures) and some examples.
     
  30. ridvanuyn

    ridvanuyn

    Joined:
    Apr 20, 2017
    Posts:
    1
    Hi, I need to Sample of Vuforia Transparent Video making with this tool ? Please can you help me ?
     
  31. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I received your email, but I'll duplicate my reply here just in case

    If you want to show video on target or nearby, easiest way would be to use Direct Source unlit transparency shader (UChromaKey/Direct source/Unlit transparent).

    Create a material, select this shader and put your video texture into Video Source slot. Then apply this material to quad or plane object. Placing this object near your target is easily done through Vuforia.
     
  32. androidunity

    androidunity

    Joined:
    Oct 25, 2012
    Posts:
    3
    I am using UCK version1.3, and Unity5.6.1f1. it works well in FullScreen Image Effect, but I would like to use a plane to display Webcam video, but not clear how to do this. My current method is: Add UChromaKey component to main camera, and set Device for Chroma Key Source; then add a Plane to scene and set UChromaKey/Unlit transparent Shader for Material. Below picture is the result, the chair on the left is the desired result,removed the blue background;The right side of the chair is the wrong result, there has been a piece of red and yellow areas.

    I am trying to directly add UChromaKey component to plane, but it is not work.

    Could you tell me:
    1. Right way for using UCK to material, such as a plane or cube.
    2. How to fix the piece of red and yellow areas.

     
  33. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    You were using UCK the right way, I found the bug in Unlit shader that's causing that behavior on Unity 5.6. Thank you for reporting it.

    Fix will be available on Asset Store in 4-7 days, and I'll send you fixed version to your email. If anyone else needs that fix, please send your request along with invoice # to support email.
     
  34. androidunity

    androidunity

    Joined:
    Oct 25, 2012
    Posts:
    3
    Thank you, it works well now.
     
  35. sd52

    sd52

    Joined:
    Jun 21, 2017
    Posts:
    1
    Добрый вечер!

    Мне необходимо проиграть на планшете Android записанное видео №1 (содержит выступление артиста с chrome key), наложив его при этом на видео №2 (содержит задний фон - офис) изображение с камеры планшета при помощи Vuforia, так чтобы при просмотре получалось, что артист выступает не на сцене, а в офисе.

    Подскажите это возможно сделать с помощью Вашего модуля?

    Возможно ли увидеть образец на видео работы Вашего модуля и пример настроек/кода в Unity/Vuforia?

    Чтобы получить такой результат достаточно настроить Ваш модуль через интерфейс или придется и настоечный код использовать?

    Буду благодарен за любые пояснения по этому вопросу.

    Unity 5.6
    Vuforia 6.2
     
  36. mos257

    mos257

    Joined:
    Sep 25, 2016
    Posts:
    4
    Hello!

    Would it be possible to put in chroma instead of the range colors selected, the rest of the colors ? Like an Inverted Chroma... I'll buy this if I have this functionality.


    Thanks a lot!
     
    Last edited: Jul 5, 2017
  37. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I don't see much use for that effect, but it's definitely possible - it would require very simple shader change, I can do that if you'll send me your invoice #. Before you buy it, you can send me screenshot/illustration of what you have in mind to my support email - just so we're sure we are talking about same thing.
     
  38. bradsears

    bradsears

    Joined:
    Jun 30, 2015
    Posts:
    12
    Hi. I'm trying to follow the instructions but getting unexpected results similar to @androidunity above. I'm in 2017.1 and using the unity video player rendering to a texture.

    The keying works using the Direct Source unlit transparency shader but the green turns into pink and white. I can see objects behind but they are tinted by these colours.
     
  39. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello. Please send screenshot of this problem and your invoice # to my support email (available in publisher profile on Asset Store), we'll figure it out.
     
  40. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.4 is available on Asset Store.

    Main changes:
    • Addition of alpha ChromaKey shader. It allows you to process your textures during run-time and save results to RenderTexture. Also added wrapper method for this shaders that automatically invokes Blit and provides needed parameters.
    • 3-colors version of Unlit shader and fullscreen effect.
     
  41. myddt

    myddt

    Joined:
    May 13, 2015
    Posts:
    6
    How to use this on mobile? I build Demo scene to Android mobile,but it was broken.
     
  42. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    What in particular was broken? Fullscreen effect didn't show, pink objects, errors in the log?
     
  43. myddt

    myddt

    Joined:
    May 13, 2015
    Posts:
    6
    This video is my mobile screen,and my system is Android 5.1.
     
  44. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Ok, I see the problem, I'll test some things on my side and get back to you. Please send me email with your invoice # to my support email , if fix will be necessary I'll send it to you in reply.

    Just to be clear - this project doesn't contain any other content except UChromaKey?
     
  45. myddt

    myddt

    Joined:
    May 13, 2015
    Posts:
    6
    Yes,only UChromaKey Demo Scene.
    And I can't find my invoice,this is my company account.
    I don't know when to buy it.
     
  46. HanSoloYolo

    HanSoloYolo

    Joined:
    May 22, 2017
    Posts:
    19
    I managed to get this working fairly quickly, however with Vuforia there is a long delay and a white screen for some time before the video starts playing.

    I got rid of the white screen by changing it's alpha all the way down. It still takes time to load, which throws my audio out of sync.

    Worst case scenario, how do I put a delay on the Audio Source?
    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEngine.Video;
    3. using Vuforia;
    4.  
    5. public class ExtendedTrackableHandler : DefaultTrackableEventHandler
    6. {
    7.     public bool restartVideoOnTrackingLost = false;
    8.  
    9.  
    10.     protected override void OnTrackingLost()
    11.     {
    12.         base.OnTrackingLost();
    13.         var videoComponents = GetComponentsInChildren<VideoPlayer>(true);
    14.         var audioComponents = GetComponentsInChildren<AudioSource>(true);
    15.         foreach (var vp in videoComponents)
    16.         {
    17.             if (restartVideoOnTrackingLost)
    18.             {
    19.                 vp.Stop();
    20.             }
    21.             else
    22.             {
    23.                 vp.Pause();
    24.             }
    25.         }
    26.         foreach (var audio in audioComponents)
    27.         {
    28.             if (restartVideoOnTrackingLost)
    29.             {
    30.                 audio.Stop();
    31.             }
    32.             else
    33.             {
    34.                 audio.Pause();
    35.             }
    36.         }
    37.     }
    38.  
    39.     protected override void OnTrackingFound()
    40.     {
    41.         base.OnTrackingFound();
    42.         var videoComponents = GetComponentsInChildren<VideoPlayer>(true);
    43.         var audioComponents = GetComponentsInChildren<AudioSource>(true);
    44.         foreach (var vp in videoComponents)
    45.         {
    46.             vp.Play();
    47.         }
    48.         foreach (var audio in audioComponents)
    49.         {
    50.             if (restartVideoOnTrackingLost)
    51.             {
    52.                 audio.Play();
    53.             }
    54.         }
    55.     }
    56. }
     
  47. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Can you use profiler and try to look what's causing the delay you're experiencing? Also worth trying UCK with some simple texture to exclude webcam handling conflicts.

    As for Audio Source, I'm sorry but I have little experience working with sound in Unity. Off the top of my head, you can use coroutine or timed trigger in Update loop to start playing your sound.
     
  48. eduardobreno

    eduardobreno

    Joined:
    Jul 23, 2013
    Posts:
    2
    @CatsPawGames, I just bought this assets and I am trying to working together with vuforia, but seens like the demo script is overriding the ARCamera from Vuforia, do you have a example to work with Vuforia ARCamera?
     
    Last edited: Mar 9, 2018
  49. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello. To use UChromaKey with vuforia, you have to use direct source shaders (UChromaKey/DirectSource folder), not UCrhomaKey script.
     
  50. eduardobreno

    eduardobreno

    Joined:
    Jul 23, 2013
    Posts:
    2
    Hi, I tried to use these shaders, but I really didn't get to understand how it works.

    Do you have a scene example with it working?