源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

80 行
2.5 KiB

// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
Shader "Unlit/shadow2"
{
Properties
{
_MainTex("Base (RGB)", 2D) = "white" {}
_ShadowCol("Color", color) = (0,0,0,1)
_ShadowAlpha("ShadowAlpha", Float) = 0.5
_StencilID("StencilID", Int) = 0
_Plane("Plane", vector) = (0,1,-0.6,0)
_LightDir("LightDir", vector) = (1,-1,-0.1,0)
}
SubShader
{
Tags{ "RenderType" = "Transparent" "Queue" = "Transparent" }
Pass
{
Name "Shadowpass"
Stencil{
Ref [_StencilID]
Comp NotEqual
Pass replace
}
zwrite off
blend srcalpha oneminussrcalpha
offset -1,-1
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
};
struct v2f
{
// UNITY_FOG_COORDS(0)
float4 vertex : SV_POSITION;
fixed4 col : COLOR;
//float2 uv : TEXCOORD0;
};
sampler2D _MainTex;
fixed4 _ShadowCol;
fixed _ShadowAlpha;
float4 _Plane;
float4 _LightDir;
v2f vert (appdata v)
{
v2f o;
float4 worldPos = mul(unity_ObjectToWorld, v.vertex);
half t = (_Plane.w - dot(worldPos.xyz, _Plane.xyz)) / dot(_LightDir.xyz, _Plane.xyz);
worldPos.xyz = worldPos.xyz + t*_LightDir.xyz;
o.vertex = mul(unity_MatrixVP, worldPos);
_ShadowCol.a = _ShadowAlpha;
o.col = _ShadowCol *step(0, t);
//UNITY_TRANSFER_FOG(o,o.vertex);
// o.uv = v.texcoord;
return o;
}
fixed4 frag (v2f i) : SV_Target
{
//fixed4 col = tex2D(_MainTex, i.uv);
//fixed4 col2 = i.col;
//col2.a = col2.a*col.a;
// UNITY_APPLY_FOG(i.fogCoord, col2);
return i.col;
//return col2;
}
ENDCG
}
}
}