Shader "MannteraShader"
{
Properties
{
_MainTex("Texture",2D) = "red"{}
}
SubShader
{
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float4 normal : NORMAL;
float2 uv : TEXCOORD0;
};
struct v2f
{
float4 pos : SV_POSITION;
float3 normal : NORMAL;
float2 uv : TEXCOORD0;
};
v2f vert(appdata v)
{
v2f _out;
_out.pos = UnityObjectToClipPos(v.vertex);
_out.normal = UnityObjectToWorldNormal(v.normal);
_out.uv = v.uv;
return _out;
}
sampler2D _MainTex;
float4 frag(v2f _in) : SV_Target
{
float4 col = (float4)0;
float4 texColor = tex2D(_MainTex, _in.uv);
float3 lightVector = normalize(_WorldSpaceLightPos0.xyz);
float d = dot(lightVector, _in.normal);
d = saturate(d);
col = d * texColor;
return col;
}
ENDCG
}
}
}