Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    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,148
    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,148
    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.