calculate directional light
This commit is contained in:
parent
9ca7b66945
commit
57650e310e
1 changed files with 6 additions and 1 deletions
|
@ -12,5 +12,10 @@ cbuffer ExternalData : register(b0)
|
||||||
float4 main(VertexToPixel input) : SV_TARGET
|
float4 main(VertexToPixel input) : SV_TARGET
|
||||||
{
|
{
|
||||||
input.normal = normalize(input.normal);
|
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);
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue