calculate directional light

This commit is contained in:
lightling 2022-03-19 16:39:01 -04:00
parent 9ca7b66945
commit 57650e310e
Signed by: lightling
GPG key ID: 016F11E0AA296B67

View file

@ -12,5 +12,10 @@ cbuffer ExternalData : register(b0)
float4 main(VertexToPixel input) : SV_TARGET
{
input.normal = normalize(input.normal);
return float4(input.normal, 1);
float3 ambientTint = ambient * tint;
float3 directionalLight1Dir = normalize(-directionalLight1.Direction);
float diffuse = saturate(dot(input.normal, directionalLight1Dir));
float3 final = (diffuse * directionalLight1.Color * tint) + ambientTint;
return float4(final, 1);
}