I'm rendering a map generated from noise. For debugging purposes, I'm just using the normals as color. I'm not sure how good/correct my calculated normals are, either way, I'd expect a smooth colored map, but that's not what I'm seeing.

enter image description here

As you can see, on steep terrain, I'm getting quad patterns. Those are the quads (two triangles) my terrain consists of, however since the normals are just passed through to the pixel shader, they should be nicely interpolated. All I'm doing in my PS is:

float4 main(float3 normal : NORMAL) : SV_TARGET
    return float4(normalize(normal), 1.0f);

I fired up the graphics debugger, and it seems like those vertices (normals) at the very top or bottom of the hill, which are obviously pointing a lot more in Y direction (which is green) have far too much impact on the normals in the center. You can see this green "line" which goes through all of the quads, even though the left and right vertices, as well as the vertices in the middle of the slope, have a steep normal. TLDR: How to solve this, is the only way to just use more geometry? I could flip the triangles, however then I'd have the same problem in the other axis.

  • \$\begingroup\$ Upvoted for having flagged yourself the question has duplicate. And because it is well asked. \$\endgroup\$
    – Vaillancourt
    Commented Oct 27, 2021 at 2:04


Browse other questions tagged .