I have a simplistic shader program that adds reference coordinate planes to a scene.
These planes are drawn as intersecting lines.
When viewed at a distance, a visual artifact is created; there is a ripple of lighter and darker areas going left to right across the image.
Given how simple the shader program is, I think this must be due to the interpolation that occurs between the vertex and fragment shaders.
- (a) Does this type of artifact have a name?
- (b) What causes it?
I looked into whether this was being caused by anti-aliasing. However, disabling the anti-aliasing shows that the pattern is created beforehand. See here:
- this is a Moire pattern (see lfgtm's answer)
- it is caused by trying to map a perspective projection of parallel lines onto a fixed grid of pixels. (see zoran's answer)
When looking at ways to address this problem, I thought that drawing the lines as surfaces with a gradient transparency across the width of the line would help by allowing the line to straddle pixels and giving it a more accurate width.
Here is how the grid looks when drawn as simple lines vs surfaces with gradient transparency.
This improved the definition between lines at a distance (i.e. they don't overlap each other and create a solid plane). However, this had little appreciable effect on the light & dark ripples.