[C++ DirectX HLSL]
Bonjour a tous,
J'utilise les shaders (.fx) pour éclairer ma scène et curieusement apparaissent des lignes horizontales sur tous les objets. Impossible de m'en débarrasser. Le code étant trop long pour être mis sur le forum, je ne joins que le code HLSL, sachant que l'erreur pourrait venir d'ailleurs.
Screenshot:
[URL=http://img225.imageshack.us/my.php?image=screen01ud9.jpg][IMG]http://img225.imageshack.us/img225/1724/screen01ud9.th.jpg[/IMG][/URL]
et code:
float4x4 WorldViewProj : WORLDVIEWPROJECTION;
float4x4 World :WORLD;
float4 LPos;
struct VS_INPUT
{
float3 Position : POSITION;
float3 Normal : NORMAL;
float2 texCoord : TEXCOORD0;
float4 Color : COLOR0;
};
struct VS_OUTPUT
{
float4 Position : POSITION;
float2 texCoord : TEXCOORD0; // coordonnees de texture 2D
float4 Color : COLOR0;
};
// VERTEX SHADER
VS_OUTPUT vs( VS_INPUT IN )
{
VS_OUTPUT OUT = (VS_OUTPUT)0;
float3 posWorld;
float3 normal;
float3 light;
float lightIntensity;
float3 lightColor;
float4 color;
posWorld = mul(IN.Position, World).xyz; //get the vertex to world space
normal = mul(IN.Normal, World).xyz; //get the normal to world space
light = normalize(LPos - posWorld); //calculating the light direction
lightIntensity = clamp(dot(normal, light), 0, 1); //calculate the light intensity and clamp it to a range
lightColor = float3(1.0f, 1.0f, 10.0f); //set the light color
color = float4(lightColor * lightIntensity, 1.0f); //calculate the color of the vertex
color.rgb += 0.2f; //add an ambient color to the shader
OUT.Position = mul(float4(IN.Position,1), WorldViewProj);
OUT.texCoord = IN.texCoord;
OUT.Color = clamp(color, 0, 1); //set the color to the output color
return OUT;
}
//technique simpletechnique
{
pass Pass0
{
VertexShader = compile vs_2_0 vs();
}
}
Quelqu'un a une idée de l'origine de ce probleme?
Un grand merci d'avance.