Shader "Custom/Half Lambert" {
Properties {
}
SubShader {
Tags {
"RenderType"="Opaque"
}
LOD 200
Pass {
Name "FORWARD"
Tags {
"LightMode"="ForwardBase"
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
#pragma multi_compile_fwdbase_fullshadows
#pragma target 3.0
struct VertexInput {
float4 vertex : POSITION;
float4 normal : NORMAL;
};
struct VertexOutput {
float4 pos : SV_POSITION;
float3 nDirWS : TEXCOORD0;
};
VertexOutput vert (VertexInput v) {
VertexOutput o = (VertexOutput)0;
o.nDirWS = UnityObjectToWorldNormal(v.normal);
o.pos = UnityObjectToClipPos( v.vertex );
return o;
}
float4 frag(VertexOutput i) : COLOR {
float3 nDir = i.nDirWS;
float3 lDir = normalize(_WorldSpaceLightPos0.xyz);
float HalfLambert = (dot(lDir,nDir)*0.5+0.5);
return float4(HalfLambert,HalfLambert,HalfLambert,1.0);
}
ENDCG
}
}
FallBack "Diffuse"
}
Half Lambert
最新推荐文章于 2024-02-01 12:36:36 发布