struct vertexOut { float4 HPosition : POSITION; float4 TexCoord : TEXCOORD0; float3 LightVec : TEXCOORD1; float3 EyeVec : TEXCOORD2; float3 WorldNormal : TEXCOORD3; float3 WorldView : TEXCOORD4; float3 test1 : TEXCOORD5; float3 test2 : TEXCOORD6; }; struct pixelOut { float3 col : COLOR; float depth : DEPTH; }; pixelOut main(vertexOut IN, uniform sampler2D Texture) { pixelOut OUT; half SpecExpon = 200; float4 LightColor = { 1, 1, 1, 1 }; float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); half3 Ln = normalize (IN.LightVec); half3 Nn = normalize (IN.WorldNormal); half3 Vn = normalize (IN.WorldView); half3 Hn = normalize (Ln + Vn); half ldn = dot (Ln, Nn); half hdn = dot (Hn, Nn); half3 litV = lit (ldn, hdn, SpecExpon); half3 diffContrib = diffuse_color * ((litV.y + 0.3) * LightColor + glstate.lightmodel.ambient); half3 specContrib = litV.y * litV.z * LightColor; half4 result = (diffContrib + specContrib).xyzx; //half3 result = diffuse_color * litV.y + LightColor * litV.z; OUT.col = result.xyz; //float depth = IN.HPosition.z / IN.HPosition.w; //OUT.depth = 0.5 * depth + 0.5; return OUT; }