Hi
Does anyone know if it’s possible to get a shadow on a completely transparent object?
Need to cast a shadow from the 3d character on the sidewalk
That should be possible. It would be called a matte shadow and there are various topics on this on the forum.
It does not work in Unity 5 ![]()
UP
This one works for me:
Shader "Shadow Collector" {
Properties
{
_Color("Main Color", Color) = (1,1,1,.5)
_ShadowIntensity("Shadow Intensity", Range(0, 1)) = 0.6
}
SubShader
{
Tags{ "Queue" = "AlphaTest" }
Pass
{
Tags{ "LightMode" = "ForwardBase" }
Cull Back
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fwdbase
#include "UnityCG.cginc"
#include "AutoLight.cginc"
uniform fixed4 _Color;
uniform float _ShadowIntensity;
struct v2f
{
float4 pos : SV_POSITION;
LIGHTING_COORDS(1,2)
};
v2f vert(appdata_base v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
fixed4 frag(v2f i) : COLOR
{
float attenuation = LIGHT_ATTENUATION(i);
return fixed4(0,0,0,(1 - attenuation)*_ShadowIntensity) * _Color;
}
ENDCG
}
}
Fallback "VertexLit"
}