Initial Commit
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'
|
||||
|
||||
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
|
||||
|
||||
Shader "Unlit/NormalShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_Cutoff ("Threshold", Range(0,1)) = 0.5
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
// make fog work
|
||||
#pragma multi_compile_fog
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float3 normal : NORMAL;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float3 normalWorld : TEXCOORD1;
|
||||
UNITY_FOG_COORDS(1)
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
float _Cutoff;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.normalWorld = normalize( mul( float4( v.normal, 0.0 ), unity_WorldToObject ).xyz );
|
||||
UNITY_TRANSFER_FOG(o,o.vertex);
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
clip( dot(i.normalWorld, float3(0,1,0)) - _Cutoff );
|
||||
// apply fog bc why not
|
||||
UNITY_APPLY_FOG(i.fogCoord, col);
|
||||
return half4(0,1,0,1);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user