In Amplify forum I found this shader:
We've performed some changes to the XRay sample in order to allow for the effect that you've requested.
Here's a package that contains updated shaders, together with materials and >sample scene:
XrayWithIntersections.unitypackage
http://amplify.pt/forum/viewtopic.php?f=8&t=710
you can easily make this effect by using ZTEST Operators
:
render first pass by unlit gray color and ZTEST Greater
,ZWrite Off
.

as you can see when mario is behind of something it will be gray:

then render second pass Albedo by ZTest Default(ZTEST LEqual)
:

to making dots effect you can sample your texture by screen space-mapped texture sample or dithering.

I wrote this shader without Amplify:
Shader "Custom/Mario/DotsBehindWall" {
Properties {
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Dots("Dots",2D) = "white"{}
_Size("Size",Vector) = (1,1,1,1)
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
GrabPass
{
"_BackgroundTexture"
}
ZWrite Off
ZTest Greater
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float4 grabPos : TEXCOORD1;
};
sampler2D _MainTex,_Dots;
float4 _MainTex_ST;
float4 _Size;
v2f vert (appdata v)
{
v2f o;
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
return o;
}
fixed4 frag (v2f i) : SV_Target
{
float2 screen = i.vertex.xy/_ScreenParams.xy;
float4 tex = tex2D(_Dots, screen /_Size);
return tex;
}
ENDCG
}
ZWrite On
ZTest LEqual
CGPROGRAM
#pragma surface surf Standard fullforwardshadows
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
another way to make this effect is using stencil buffer that I explained In this post