patch update - fix sunlight shader
Prend en compte les paramètres direction et intensité
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user