Search Unity

Question Custom AR Background With URP and AR Core

Discussion in 'AR' started by op_unity374, Oct 17, 2022.

  1. op_unity374

    op_unity374

    Joined:
    Jul 12, 2022
    Posts:
    3
    Hello,

    I'm trying to create a custom AR background shader so that I can tint the background, similar to this thread https://forum.unity.com/threads/custom-background-with-lwrp.781622/. I'm assigning the custom background material at runtime and fading in the tint. For the custom shaders I'm using the shaders from the AR Kit and AR Core as reference and simply multiplying the result:

    -Packages/com.unity.xr.arcore/Assets/Shaders/ARCoreBackground.shader
    -Packages/com.unity.xr.arkit/Assets/Shaders/ARKitBackground.shader


    The AR Kit custom shader works just fine but the AR Core custom shader seems to not be supported. When I try to assign my custom shader or even the standard AR Core background shader to a material it shows up as "Not Supported". When I build to device, the AR background looks fine until I assign the custom material, and then it turns pink. I've tried several versions of URP and AR Core with the same result. Is there a version of the AR Core background shader that will work better for the custom shader?

    Here's what I'm using:
    -Unity 2020.3.20f1
    -URP 10.6.0
    -AR Foundation 4.2.1
    -AR Core 4.1.7
    -AR Kit 4.1.7

    Thanks in advance!
     

    Attached Files:

  2. op_unity374

    op_unity374

    Joined:
    Jul 12, 2022
    Posts:
    3
    Oh, my bad... I just forgot to use GLSL functions instead of Cg... Here's the update if anyone's looking for the same thing.
     

    Attached Files:

    novaVision and andyb-unity like this.
  3. novaVision

    novaVision

    Joined:
    Nov 9, 2014
    Posts:
    518
    Thanks @op_unity374 , finally you made it work! By some reason my shader didn't work at all
     
  4. Tucan444

    Tucan444

    Joined:
    Jul 20, 2021
    Posts:
    3
    still getting just a purple screen