hen drawing inside polygons using a GPU shader, if your shader outputs areas containing high contrast sloping lines, those lines will be aliased. Multisampling does nothing to fix the aliasing, as multisampling only serves to smooth the edges of geometry and not their interior fills.
Determine the arc width θ of your smoothing distance, for example the arc across a pixel by diving your field of view by the number of vertical pixels in your scene.
Convert θ to foreshorten ratio ω using the equation ω = 1 / sin(θ). If your scene's resolution and aspect ratio won't change, this value ω may be held in a constant.
Account for the distance and slope of the surface by multipling ω, z depth, and then dividing by dot product of the eye vector to surface normal vectors to form Ω i.e. Ω = ω * z / dot(eye, normal).
Ω is now the of number world units you'll need to blend with when anti-aliasing your lines.

// rings are spaced 1 unit apart var spacing = 1; // alternating red and white rings are sized equally var line = spacing / 2; // segment is the position of our current fragment inside a ring var segment = distance(fragment.xy, origin) % spacing; // we are going to aa only the right side if (segment < line) then color = red; // here is the aa part else if (segment < line + omega) color = mix(red, white, (segment - line) / omega); // and we are done else color = white;
