i have a GLSL fragment shader:

#version 130 varying vec4 position_in_world_space; out vec4 MyFragColor; void main(void)\n {[attachment=4792:aliasing.png] // Grid vec4 circ_dist_to_grid_lines = abs( position_in_world_space - floor(position_in_world_space) ); if(circ_dist_to_grid_lines.x > 0.01 && circ_dist_to_grid_lines.x < 0.99) { circ_dist_to_grid_lines.x = 1.0; } else{ if(circ_dist_to_grid_lines.x >= 0.99) { circ_dist_to_grid_lines.x = 1.0 - circ_dist_to_grid_lines.x; } circ_dist_to_grid_lines.x *= 100.0; } if(circ_dist_to_grid_lines.y > 0.01 && circ_dist_to_grid_lines.y < 0.99) { circ_dist_to_grid_lines.y = 1.0; } else{ if(circ_dist_to_grid_lines.y >= 0.99) { circ_dist_to_grid_lines.y = 1.0 - circ_dist_to_grid_lines.y; } circ_dist_to_grid_lines.y *= 100.0; } if(circ_dist_to_grid_lines.z > 0.01 && circ_dist_to_grid_lines.z < 0.99) { circ_dist_to_grid_lines.z = 1.0; } else{ if(circ_dist_to_grid_lines.z >= 0.99) { circ_dist_to_grid_lines.z = 1.0 - circ_dist_to_grid_lines.z; } circ_dist_to_grid_lines.z *= 100.0; } vec3 bri = vec3(1.0) - circ_dist_to_grid_lines.xyz; MyFragColor.rgb = bri * 0.5; }(Sorry about the 0.99 and 0.01 stuff. I've yet to finish the code and clean it up.)

-Which gets an interpolated world-space position for the fragment in position_in_world_space,

and through that draws gridlines for every axis in separate colors: X:red, Y:green, Z:blue.

Here we have its output for a straight X,Y plane:

Now I'm getting severe aliasing on the gridlines, and i could obviously better it by increasing the line thickness.

Do any of you guys have a suggestion as of how to avoid the aliasing? Should i sample nearby fragments?

Thanks a bunch!