Hi all,
I am having a weird problem with normals on my generated terrain. I am not sure whether is it is shader or mesh issue, but here is how it looks:

As you can see, I get this pattern along the edges of the triangles. This reminds me of per vertex shading however I am aiming for per pixel shading.
Here are my vertex and pixel shaders:
VS:
cbuffer cbToProjection
{
float4x4 matToProj;
}
struct VS_IN
{
float4 Position : POSITION;
float3 Normal: NORMAL;
};
struct VS_OUT
{
float4 Position : SV_POSITION;
float3 NormalWS: TEXCOORD1;
};
VS_OUT main(VS_IN IN)
{
VS_OUT OUT;
OUT.Position = mul(IN.Position,matToProj);
OUT.NormalWS = normalize(IN.Normal);
return OUT;
} PS:
struct PS_IN
{
float4 Position : SV_POSITION;
float3 NormalWS: TEXCOORD1;
};
float4 main(PS_IN IN): SV_TARGET0 {
float3 normal = normalize(IN.NormalWS);
float3 toLight = normalize(float3(1,3,-2));
float NDotL = saturate(dot(toLight,normal));
float4 color = float4(1.0f,1.0f,1.0f,1.0f);
color.rgb *= NDotL;
return color;
} so what am I doing wrong?



