Unity-Technologies / arfoundation-samples

Example content for Unity projects based on AR Foundation
Other
3.02k stars 1.12k forks source link

Modify AR background color (make darker) #974

Closed novavision closed 2 years ago

novavision commented 2 years ago

I am trying to find a way how can I make ar background darker for a dark room simulation. I am on 2021.1.17, URP 12.1.6. I tried to use custom materials but this doesn't work.

DavidMohrhardt commented 2 years ago

To accomplish this there are a few ways to go about it but the simplest way probably would be to copy your platforms background shader code (ARCore and ARKit packages both have an Assets folder that contains their respective background shaders) and modify the color output by some scalar property on the custom shader. Then you can create a material from the new shader and use it as the custom background material.

You can visit our forums to get more use-case focused assistance from the community at large: https://forum.unity.com/forums/ar.161/

novavision commented 2 years ago

@DavidMohrhardt the problem is that ARCoreBackground and ARKitBackground shaders are pink in editor and on the device also

DavidMohrhardt commented 2 years ago

@DavidMohrhardt the problem is that ARCoreBackground and ARKitBackground shaders are ping in editor and on the device also

I don't know what you mean by "ping". The shaders are only intended to run on their device so if they are not working on your devices you need to file a bug here: https://unity3d.com/unity/qa/bug-reporting

novavision commented 2 years ago

I don't know what you mean by "ping". The shaders are only intended to run on their device so if they are not working on your devices you need to file a bug here: https://unity3d.com/unity/qa/bug-reporting

I believe each developer who used to work with non Build-in pipeline knows what "pink" material means - the shader is not compatible with the current pipeline (URP in my case).

What this also means - the shader I grab from ARKit/ARCore package cache is suitable only for Build-in pipeline. I couldn't find any for URP. I found the thread at the forum where user provided modified versions BUT ARCore shader is not compatible to URP 12.x (seems it was written for URP 7.x) and only ARKit shader works, but it's a bit simplified.

DavidMohrhardt commented 2 years ago

Oh "pink" yes invalid shader. If the ARCore shader isn't working for URP then you need to file a bug as the shaders in question should support and work with URP: https://unity3d.com/unity/qa/bug-reporting

novavision commented 1 year ago

closed as completed ? Is it a joke? Seems AR Foudation still didn't fix it and there is no way to get shader sample to modify background on Android. Only iOS works as expected.