@@ -35,8 +35,10 @@ SamplerState g_sampler : register(s0);
35
35
36
36
//-------------------------------------------------------------------------
37
37
//-------------------------------------------------------------------------
38
- float3 evaluateLight (in float3 normal, in float3 pos)
38
+ float3 evaluateLight (in float3 normal, in float3 pos, in float3 tex )
39
39
{
40
+ float ambient = 0.1f ;
41
+
40
42
// directional light. from the point toward the light is the opposite direction.
41
43
float3 pointToLight = -g_lightDir.xyz;
42
44
float diffuse = saturate (dot (pointToLight, normal));
@@ -46,11 +48,12 @@ float3 evaluateLight(in float3 normal, in float3 pos)
46
48
float specDot = saturate (dot (reflected, pointToLight));
47
49
float specular = pow (specDot, g_specularColor.a);
48
50
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);
52
55
53
- color = pow (color, 1.0f / 1.5f );
56
+ color += (specular * g_specularColor.xyz );
54
57
55
58
return color;
56
59
}
@@ -68,7 +71,7 @@ float4 ps(VS_OUT input) : SV_TARGET0
68
71
69
72
// clamp the streaming texture to the mip level specified in the min mip map
70
73
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 );
72
75
73
76
if ((g_visualizeFeedback) && (mipLevel < 16 ))
74
77
{
0 commit comments