You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.2 KiB
Plaintext
64 lines
1.2 KiB
Plaintext
// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
|
|
Shader "Enviro/Standard/ShadowCookie"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex ("Texture", 2D) = "white" {}
|
|
}
|
|
SubShader
|
|
{
|
|
// No culling or depth
|
|
Cull Off ZWrite Off ZTest Always
|
|
|
|
Pass
|
|
{
|
|
CGPROGRAM
|
|
#pragma vertex vert
|
|
#pragma fragment frag
|
|
#pragma target 2.0
|
|
#include "UnityCG.cginc"
|
|
#pragma exclude_renderers gles
|
|
struct appdata
|
|
{
|
|
float4 vertex : POSITION;
|
|
float2 uv : TEXCOORD0;
|
|
};
|
|
|
|
struct v2f
|
|
{
|
|
float2 uv : TEXCOORD0;
|
|
float4 vertex : SV_POSITION;
|
|
};
|
|
|
|
v2f vert (appdata v)
|
|
{
|
|
v2f o;
|
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
|
o.uv = v.uv;
|
|
return o;
|
|
}
|
|
|
|
uniform sampler2D _MainTex;
|
|
uniform float _shadowIntensity;
|
|
uniform int _shadowMode;
|
|
uniform float _Rotation;
|
|
|
|
float2 rotateUV(float2 uv, float rotation)
|
|
{
|
|
float s = sin ( rotation );
|
|
float c = cos ( rotation );
|
|
float2x2 rotationMatrix = float2x2( c, -s, s, c);
|
|
return mul ( uv - 0.5, rotationMatrix ) + 0.5;
|
|
}
|
|
|
|
fixed4 frag (v2f i) : SV_Target
|
|
{
|
|
fixed4 col = 1 - (tex2D(_MainTex, rotateUV(i.uv,_Rotation)) * _shadowIntensity);
|
|
return float4(col.r,col.r,col.r,col.r);
|
|
}
|
|
ENDCG
|
|
}
|
|
}
|
|
}
|