- Home /
Transparent shadow receiving plane for AR app to receive only shadows and not light reflections
Hello, I'm working on a transparent shadow receiving shader for Augmented Reality app, that is put into a plane which will receive shadows from point light or spotlight. It works fine, but the plane receives light also as you can see in the image.
I'm using unity 5.6.3p4. Please tell me what could be the problem in this script or what should I change in this code to receive only shadows and not light reflections on the plane?
The Shader Script is below:
Shader "SP/InvisibleShadowCasterForPointOrSpotLight" { Properties { _MainTex("Base (RGB)", 2D) = "white" {} } SubShader { Pass { Blend One One Tags { "LightMode" = "ForwardAdd" } CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" #pragma multi_compile_fwdadd_fullshadows #include "AutoLight.cginc" sampler2D _MainTex; float4 _MainTex_ST; struct v2f { float4 pos : SV_POSITION; LIGHTING_COORDS(0,1) float2 uv : TEXCOORD2; }; v2f vert(appdata_base v) { v2f o; o.pos = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX (v.texcoord, _MainTex); TRANSFER_VERTEX_TO_FRAGMENT(o); return o; } fixed4 frag(v2f i) : COLOR { float attenuation = LIGHT_ATTENUATION(i); return tex2D (_MainTex, i.uv) * attenuation; } ENDCG } } Fallback "VertexLit" }
Your answer
Follow this Question
Related Questions
Shadow/shader in Aughmented Reality 0 Answers
AR Shadows blurry and pixelated 0 Answers
How to Fade out Custom Unity Shader ? 0 Answers
make masked object transparant 0 Answers
Shadow Support in Custom Shader 0 Answers