|
|
|
|
|
by jasmcole
1858 days ago
|
|
Nice article! When we wrote the instanced WebGL line renderer for https://count.co one of the tricky parts was switching between mitre and bevel joins based on the join angle - for very acute angles the mitre join shoots off to infinity. Another nice extension (that we are yet to implement) is anti-aliasing, but I think that requires extra geometry to vary the opacity over. |
|
There’s a way to do it where you pass one extra vec2 from the vertex shader and use that to determine how much of the pixel is covered by the lines. (This has the effect of thinning the line, so you may want to thicken it to compensate)
Here’s an example of a pair of shaders that do this: https://github.com/paulgb/experiments/tree/master/2021-05-20...
Here’s a demo: https://twitter.com/paulgb/status/1394824275635408907