Blog
Unity

Unity Chroma Key Alternative To Change and Animate Backgrounds

Learn how to remove and change backgrounds in Unity with our background subtraction technology. We describe a robust alternative for Unity chroma key functionality. It requires no physical green screen and can help you animate backgrounds in Unity using custom images or videos.

background hero

Our Face AR SDK is a cross-platform augmented reality platform that supports background subtraction in Unity. It allows developers to create Unity apps with a real-time background changer feature. The background remover works automatically and doesn't require a physical green screen. You can use it as an alternative to Unity chroma key solutions when you need to replace and animate backgrounds for the selfie mobile or web camera.

How to set background changer in Unity

Unity background changer is compatible with face filters and supports multi-face tracking. You can build cross-platform games with face tracking, video chats and augmented reality apps in Unity or even use this feature for mixed reality projects.

Start Free Trial

How does Unity chroma key and backgrounds subtraction differ

Unity chroma key needs a physical green screen behind a person. The shader then picks and removes a specific color from the background which is usually green. Developers need to avoid colors that match the skin tone so it won’t blend into the background.

Unlike Unity green screen shader, the background segmentation uses a neural network that recognizes not the color but the area which belongs to the person and background. It enables a background removal feature that works automatically, in real-time and requires just a camera.


Read More: Real-time Background Subtraction in Unity


How to change backgrounds in Unity with background subtraction

To test and integrate the background changer in your Unity app:

  1.  Get the latest trial version of Banuba Face AR SDK for Uniyt by submitting the website form. Along with the background changer, you'll be able to test face filters in Unity.
  2.  Download the files to compile the Demo app or integrate the SDK into your project.
  3.  Activate the token. With the SDK archive, you'll also receive the client token. See how to activate it.  
  4.  Enable the background segmentation feature in your Unity project. Follow the guide here.

Adding image as background

image as backgroundAdding image as background

  1.  Add texture and video to the project assets
  2.  Run the project and add texture to Background -> Raw Image -> Texture field

Adding video as background

video as background in unityAdding video as background

  1.   Add video player object to the root of the scene
  2.  Add your video file to the Video Player-> Video Clip field
  3.  Create new Render Texture in the project assets
  4.  Add created Render Texture to the Video Player->Target Texture field
  5.  In the Video Player set the field Aspect Ration to the Stretch
  6.  Add created Render Texture to the Background->Raw Image-> Texture field
  7.  Change some parameters of Render Texture:  Anti-aliasing - at least 2 samples and Wrap - Repeat
  8.  Run the Project

Want to add Face Filters in Unity? Explore our Unity Face AR Lite version!

Face AR Lite  Add Face Filters To Unity Go to Asset Store

Top
# Tags: