… | |
… | |
16 | pixelOut main(vertexOut IN, uniform sampler2D Texture) |
16 | pixelOut main(vertexOut IN, uniform sampler2D Texture) |
17 | { |
17 | { |
18 | pixelOut OUT; |
18 | pixelOut OUT; |
19 | |
19 | |
20 | half SpecExpon = 200; |
20 | half SpecExpon = 200; |
21 | float4 AmbiColor = { 0.9, 0.9, 0.9, 1.0 }; |
|
|
22 | float4 LightColor = { 1, 1, 1, 1 }; |
21 | float4 LightColor = { 1, 1, 1, 1 }; |
23 | float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
22 | float4 diffuse_color = tex2D (Texture, IN.TexCoord.xy); |
24 | |
23 | |
25 | half3 Ln = normalize (IN.LightVec); |
24 | half3 Ln = normalize (IN.LightVec); |
26 | half3 Nn = normalize (IN.WorldNormal); |
25 | half3 Nn = normalize (IN.WorldNormal); |
… | |
… | |
29 | half3 Hn = normalize (Ln + Vn); |
28 | half3 Hn = normalize (Ln + Vn); |
30 | half ldn = dot (Ln, Nn); |
29 | half ldn = dot (Ln, Nn); |
31 | half hdn = dot (Hn, Nn); |
30 | half hdn = dot (Hn, Nn); |
32 | |
31 | |
33 | half4 litV = lit (ldn, hdn, SpecExpon); |
32 | half4 litV = lit (ldn, hdn, SpecExpon); |
34 | half4 diffContrib = diffuse_color * ((litV.y + 0.8) * LightColor + glstate.lightmodel.ambient); |
33 | half4 diffContrib = diffuse_color * ((litV.y + 0.1) * LightColor + glstate.lightmodel.ambient); |
35 | half4 specContrib = litV.y * litV.z * LightColor; |
34 | half4 specContrib = litV.y * litV.z * LightColor; |
36 | half4 result = diffContrib + specContrib; |
35 | half4 result = diffContrib + specContrib; |
37 | //half4 result = diffuse_color * litV.y + LightColor * litV.z; |
36 | //half4 result = diffuse_color * litV.y + LightColor * litV.z; |
38 | |
37 | |
39 | OUT.col = result; |
38 | OUT.col = result; |