patch update - fix sunlight shader

Prend en compte les paramètres direction et intensité
This commit is contained in:
2025-01-23 22:45:59 +01:00
parent d8851cc679
commit 425224a96c
4 changed files with 29 additions and 34 deletions

View File

@@ -24,8 +24,6 @@ struct PixelInputType
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
float3 lightDir : TEXCOORD1;
float intensity : TEXCOORD2;
};
////////////////////////////////////////////////////////////////////////////////
@@ -34,7 +32,6 @@ struct PixelInputType
float4 SunLightPixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float3 lightDir;
float4 color;
float lightIntensity;
float4 colorArray;
@@ -44,10 +41,10 @@ float4 SunLightPixelShader(PixelInputType input) : SV_TARGET
textureColor = shaderTexture.Sample(SampleType, input.tex);
// Calculate the different amounts of light on this pixel based on the direction of the light.
lightIntensity = saturate(dot(input.normal, input.lightDir)) * input.intensity;
lightIntensity = saturate(dot(input.normal, -lightDirection));
// Determine the diffuse color amount of the light.
colorArray = diffuseColor * lightIntensity;
colorArray = (diffuseColor * lightIntensity) * intensity;
// Initialize the sum of colors.
colorSum = float4(0.0f, 0.0f, 0.0f, 1.0f);