Hello everyone, I was following this article:
https://mattdesl.svbtle.com/drawing-lines-is-hard#screenspace-projected-lines_2
And I'm trying to understand how the algorithm works. I'm currently testing it in Unity3D to first get a grasp of it and later port it to webgl.
What I'm having problems with is the space in which the calculations take place. First the author calculates the position in NDC and takes into account the aspect ratio of the screen. Later, he calculates a displacement vector which he calls offset, and adds that to the position that is still in projective space, with the offset having a W value of 1. What's going on here? why can you add a vector in NDC to the resulting position of the projection? what's the relation there?. Also, what is that value of 1 in W doing? shouldn't it be 0 ?
Supposedly this algorithm makes the thickness of the line independent of the depth, but I'm failing to see why.
Any help is appreciated. Thanks
↧