@@ -35,8 +35,10 @@ SamplerState g_sampler : register(s0);
3535
3636//-------------------------------------------------------------------------
3737//-------------------------------------------------------------------------
38- float3 evaluateLight (in float3 normal, in float3 pos)
38+ float3 evaluateLight (in float3 normal, in float3 pos, in float3 tex )
3939{
40+ float ambient = 0.1f ;
41+
4042 // directional light. from the point toward the light is the opposite direction.
4143 float3 pointToLight = -g_lightDir.xyz;
4244 float diffuse = saturate (dot (pointToLight, normal));
@@ -46,11 +48,12 @@ float3 evaluateLight(in float3 normal, in float3 pos)
4648 float specDot = saturate (dot (reflected, pointToLight));
4749 float specular = pow (specDot, g_specularColor.a);
4850
49- float ambient = 0.1f ;
50-
51- float3 color = (.9f * diffuse * g_lightColor.xyz) + (specular * g_specularColor.xyz) + ambient;
51+ float3 color = ambient + (diffuse * g_lightColor.xyz);
52+ color *= tex;
53+ color = pow (color, 1.0f / 1.3f );
54+ color = saturate (color);
5255
53- color = pow (color, 1.0f / 1.5f );
56+ color += (specular * g_specularColor.xyz );
5457
5558 return color;
5659}
@@ -68,7 +71,7 @@ float4 ps(VS_OUT input) : SV_TARGET0
6871
6972 // clamp the streaming texture to the mip level specified in the min mip map
7073 float3 color = g_streamingTexture.Sample (g_sampler, input.tex, 0 , mipLevel).rgb;
71- color * = evaluateLight (input.normal, input.worldPos);
74+ color = evaluateLight (input.normal, input.worldPos, color );
7275
7376 if ((g_visualizeFeedback) && (mipLevel < 16 ))
7477 {
0 commit comments