Search Unity

  1. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Help Wanted Removing video background

Discussion in 'Unity MARS' started by herra_lehtiniemi, Aug 31, 2021.

  1. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    96
    Hi!

    New to Mars. I was wondering if there’s an easy way to remove video background? Interested in both:
    1) Detect human and make all other pixels in video feed transparent.
    2) Make pixels in video feed beyond certain depth transparent

    Grateful for even some vague directions on how to approach. Manipulating the video feed seems like a mystery.
     
  2. jmunozarUTech

    jmunozarUTech

    Unity Technologies

    Joined:
    Jun 1, 2020
    Posts:
    266
    Hey there,

    to access the camera texture you can check on https://forum.unity.com/threads/access-camera-image-and-or-environment-probes.935555/ where @amydigiov mentions that you can grab your camera image directly from
    MarsRuntimeUtils.GetActiveCamera(true).GetComponent<ARCameraManager>()


    MARS supports body tracking (iOS only), so you could perhaps use a body avatar https://docs.unity3d.com/Packages/com.unity.mars@1.3/manual/BodyTracking.html that uses an unlit shader, then after grabbing the texture (as I mentioned above) you can discern pixel by pixel which part of the image belongs to the tracked avatar and one that belongs to the camera feed.

    There are lots of way to achieve that; this is one approach. Hope it helps! :)
     
  3. herra_lehtiniemi

    herra_lehtiniemi

    Joined:
    Feb 12, 2017
    Posts:
    96
    jmunozarUTech likes this.
unityunity