Whenever I draw a polygon using opengl the edges look bad because straight lines look bad. I want the edges to have nice soft antialiased edges but that's not how opengl draws polygons. Multisampling AA doesn't help as much as I expect it to.
-
Show this thread
-
Replying to @mcclure111
a surprising amount of code in solvespace exists solely to draw antialiased edges with shaders. i don't understand most of it
2 replies 0 retweets 14 likes -
Replying to @whitequark @mcclure111
I have literally spent the last two years of my career on this problem. :)
2 replies 3 retweets 13 likes -
I think I’ve basically solved it and it’s not even that hard. (Short answer: calculate line equation in a fragment shader and then use a lookup texture on m and b to give you the appropriate shade of gray.) But the devil’s in the details, and there sure are a whole lot of them…
1 reply 0 retweets 6 likes -
Replying to @pcwalton @mcclure111
so we have this shaders, i wonder how close are they to what you have in mind? https://github.com/solvespace/solvespace/blob/master/res/shaders/edge.vert …https://github.com/solvespace/solvespace/blob/master/res/shaders/edge.frag …
1 reply 0 retweets 2 likes -
Replying to @whitequark @mcclure111
Smoothstep is a very poor mapping from distance to area. Common mistake. Even linear interpolation is better. (I posted a graph a while back.)
1 reply 0 retweets 4 likes -
(Referring to https://github.com/solvespace/solvespace/blob/master/res/shaders/edge.frag#L28 … here.)
1 reply 0 retweets 3 likes -
Try replacing smoothstep with this function: https://github.com/servo/webrender/blob/ad6cec76254030e8fcc4e6c7e5e300c69b6d36ca/webrender/res/shared.glsl#L91 … You’ll get a much better result. (I wrote the error bounds in the comment there.)
2 replies 0 retweets 7 likes
Patrick Walton Retweeted Patrick Walton
Here’s the graph of error you get from smoothstep:https://twitter.com/pcwalton/status/959225099143430144 …
Patrick Walton added,
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.