struct appdata { float3 Position : POSITION; float3 Normal : NORMAL; }; struct vpconn { float4 Hposition : POSITION; float4 TexCoord0 : TEXCOORD0; float4 TexCoord1 : TEXCOORD1; float4 Color0 : COLOR0; }; vpconn main(appdata IN, uniform float4x4 WorldViewProj, uniform float4x4 TexTransform, uniform float3x3 WorldIT, uniform float3 LightVec) { vpconn OUT; float3 worldNormal = normalize(mul(WorldIT, IN.Normal)); float ldotn = max(dot(LightVec, worldNormal), 0.0); OUT.Color0.xyz = ldotn.xxx; float4 tempPos; tempPos.xyz = IN.Position.xyz; tempPos.w = 1.0; OUT.TexCoord0 = mul(TexTransform, tempPos); OUT.TexCoord1 = mul(TexTransform, tempPos); OUT.Hposition = mul(WorldViewProj, tempPos); return OUT; } struct v2f_simple { float4 Hposition : POSITION; float4 TexCoord0 : TEXCOORD0; float4 TexCoord1 : TEXCOORD1; float4 Color0 : COLOR0; }; float4 main(v2f_simple IN, uniform sampler2D ShadowMap, uniform sampler2D SpotLight) : COLOR { float4 shadow = tex2D(ShadowMap, IN.TexCoord0.xy); float4 spotlight = tex2D(SpotLight, IN.TexCoord1.xy); float4 lighting = IN.Color0; return shadow * spotlight * lighting; }