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.
  2. Dismiss Notice

How to use ARCameraBackground Custom Material ?

Discussion in 'AR' started by zulaman, Aug 5, 2020.

  1. zulaman

    zulaman

    Joined:
    May 12, 2017
    Posts:
    26
    I'm trying to get custom material to work using standard rendering pipeline.
    I have customMaterial checked on and I assigned a new material but no matter what shader I try (standard, unlit, skybox, etc...) I still don't see any video on device.
    When I check the custom material off everything is working and I do see the video in the background.
    Any ideas what shader do I need to use? I'm just looking for a starting point shader that I can build on top off.
    Thanks.
     
  2. zulaman

    zulaman

    Joined:
    May 12, 2017
    Posts:
    26
    Never-mind, I found the answer.
    Looks like the ARKitBackground.shader is the one to use.
     
  3. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,070
    Yes, and if someone is looking for Android shader, it's ARCoreBackground.shader.
     
  4. zulaman

    zulaman

    Joined:
    May 12, 2017
    Posts:
    26
    I also tried using the actual video texture ( CpuImages example) and add it to a Camera Plane (fg video with alpha) but I can't seem to line it up with the ARCameraBackground bg video. It must be using a different transform to display the video and I don't know how to access it.
     
  5. KyryloKuzyk

    KyryloKuzyk

    Joined:
    Nov 4, 2013
    Posts:
    1,070
    You can subscribe to ARCameraManager.frameReceived to access ARCameraFrameEventArgs.displayMatrix and ARCameraFrameEventArgs.projectionMatrix. Most of all, you need the displayMatrix if you have issues with correct image orientation.