[Shader] displays the effect of a character on one side of the wall.
// When an object is blocked, the perspective effect Shader "Custom/SeeThroughWall" {Properties {_ MainTex ("Texture", 2D) of the contour is displayed on one side of the wall) = "white" {}// highlight Color of the outline of the object displayed through the wall _ EdgeColor ("Edge Color", Color) = )} subShader {Tags {"RenderType" = "Opaque"} // display outline highlight Pass {// If the depth is larger than other objects during the deep test (BLOCKED) // render the highlighted contour ZTest Greater Blend One CGPROGRAM # pragma vertex vert # pragma fragment frag # include "UnityCG. cginc "struct appdata {float4 vertex: POSITION; float2 uv: TEXCOORD0; // @ add float3 normal: NORMAL;}; struct v2f {float2 uv: TEXCOORD0; float4 vertex: SV_POSITION; // @ add float3 normal: NORMAL; float3 viewDir: TEXCOORD1;}; sampler2D _ MainTex; float4 _ MainTex_ST; float4 _ EdgeColor; v2f vert (appdata v) {v2f o; o. vertex = UnityObjectToClipPos (v. vertex); o. uv = TRANSFORM_TEX (v. uv, _ MainTex); // @ add o. normal = UnityObjectToWorldNormal (v. normal); o. viewDir = normalize (_ WorldSpaceCameraPos. xyz-mul (unity_ObjectToWorld, v. vertex ). xyz); return o;} fixed4 frag (v2f I): SV_Target {float NdotV = 1-dot (I. normal, I. viewDir) * 1.5; return _ EdgeColor * NdotV;} ENDCG} // draw the object Pass {ZTest Less CGPROGRAM # pragma vertex vert # pragma fragment frag # include "UnityCG. cginc "struct appdata {float4 vertex: POSITION; float2 uv: TEXCOORD0 ;}; struct v2f {float2 uv: TEXCOORD0; gradient (1) float4 vertex: SV_POSITION ;}; sampler2D _ MainTex; float4 _ MainTex_ST; v2f vert (appdata v) {v2f o; o. vertex = UnityObjectToClipPos (v. vertex); o. uv = TRANSFORM_TEX (v. uv, _ MainTex); UNITY_TRANSFER_FOG (o, o. vertex); return o;} fixed4 frag (v2f I): SV_Target {fixed4 col = tex2D (_ MainTex, I. uv); return col ;}endcg }}}