improved the shader of mesh renderer to make the global lighting better
This commit is contained in:
Binary file not shown.
@@ -11,11 +11,13 @@ float4 main(Input input) : SV_Target0
|
||||
{
|
||||
float3 normal = normalize(input.WorldNormal);
|
||||
|
||||
// Initial ambient component
|
||||
float3 result = input.Color.rgb * GlobalLightColor * GlobalAmbientIntensity;
|
||||
// Initial ambient component (Soft blue sky ambient)
|
||||
float3 ambientColor = float3(0.6f, 0.7f, 0.9f);
|
||||
float3 result = input.Color.rgb * ambientColor * GlobalAmbientIntensity;
|
||||
|
||||
// Directional light contribution
|
||||
float ndotl = max(dot(normal, -GlobalLightDirection), 0.0);
|
||||
float3 sunDir = normalize(-GlobalLightDirection);
|
||||
float ndotl = max(dot(normal, sunDir), 0.0);
|
||||
result += input.Color.rgb * GlobalLightColor * ndotl;
|
||||
|
||||
// Point lights
|
||||
@@ -42,5 +44,8 @@ float4 main(Input input) : SV_Target0
|
||||
}
|
||||
}
|
||||
|
||||
// Simple Gamma correction
|
||||
result = pow(result, 1.0 / 2.2);
|
||||
|
||||
return float4(result, input.Color.a);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user