Recently I asked a question, what is the fastest way to render 2D lines using DirectX, and one of the answers mentioned this paper on Fast Prefiltered Lines which uses Pixel Shaders to accomplish wireframe drawing. This paper draws quads per line segment then uses a pixel shader to draw a line by computing distance from the pixel to the line down the centre of the quad before filling with line-color or transparent.
So, I'm wondering how can this be done? I wasn't aware the pixel shader can get knowledge of the input geometry (e.g. the quad) that creates it. Is the following possible? Ideally in DirectX9 but DX10 or OpenGL solutions also appreciated!
Turns out I don't draw the quad like that, but like this. So the question is: How can I get information about x1y1 x2y2 into the pixel shader so I can compute distance to line edge & get a nice antialiased line segment?