Surface Occlusion
Can we use Surface Occlusion in ARFoundation?
so that you, for example, stand behind a wall and that you will no longer be able to see your object. And is it possible to give the ground a collider so that if you throw something in AR that also stays on the ground. And why cant we use the ARCore light estimation shaders
Examples:
https://www.youtube.com/watch?v=yrSGzoo1Ikw https://www.youtube.com/watch?v=vzbz8UgM_qc
Both are possible. For occlusion, you just need to use a shader that only writes to the Z buffer, and assign that to your ARPlane's MeshRenderer's material. Something like this should work:
Shader "AR/Occlusion"
{
SubShader
{
Tags { "RenderType"="Opaque" }
Tags { "Queue" = "Geometry-1" }
ZWrite On
ZTest LEqual
ColorMask 0
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
float4 vertex : SV_POSITION;
};
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
return fixed4(0.0, 0.0, 0.0, 0.0);
}
ENDCG
}
}
}
For the collision, you just need a MeshCollider on your ARPlane. The AR Default Plane prefab used in the sample already has this.
We have a sample that demonstrates how to achieve this: https://github.com/Unity-Technologies/arfoundation-samples#planeocclusion