I’m trying to make a material for drawing AAed lines. The idea is to:

- Interpolate the screen coordinate of the vertices along the length of the line
- use the distance between the screen coordinate and the frag coordinate to find a suitable alpha value

I modified the unshaded.vert (I assumed a resolution of 1920x1080):

```
varying vec2 screenPos;
...
...
screenPos = vec2( ((gl_Position.x/gl_Position.w)+1.)*1920./2. , ((gl_Position.y/gl_Position.w)+1.)*1080./2.);
```

And unshaded.frag:

```
gl_FragColor = vec4(color.xyz,1-distance(screenPos,gl_FragCoord.xy)/4.5);
```

The results look good to me, except that lines which have a component normal to the viewing plane are weirdly tapered.

This lead me to think that transformation to screen coordinates was somehow wrong. But I haven’t been able to figure out how. Or maybe there is something more fundamental that I don’t understand?

Thanks in advance for you time.